POETCode* eval_cvar_attr(CodeVar* cv, LocalVar* lv) { CvarSymbolTable::Entry cv_e = cv->get_entry(); LvarSymbolTable* symTable = cv_e.get_symTable(); LvarSymbolTable::Entry e = lv->get_entry(); if (symTable->find(e.get_name()) != lv) return 0; POETCode* res = 0; switch (e.get_entry_type()) { case LVAR_CODEPAR: res = eval_tuple_access(cv->get_args(), e.get_code()); break; case LVAR_ATTR: for (int i = 0; i < cv_e.attr_size(); ++i) { if (cv_e.get_attr(i) == lv) { POETCode* tuple = cv->get_attr(); if (tuple == 0) res = e.get_code(); else res = eval_tuple_access(tuple,i); break; } } break; default: /*QY: access is a local variable. treat this as tuple access*/ res = eval_tuple_access(cv, lv); } return res; }
std:: string ParameterDecl:: toString(ASTOutputEnum config) { LvarSymbolTable::Entry e = var->get_entry(); std::string res = "<parameter " + e.get_name()->toString(OUTPUT_NO_DEBUG); if (parse != 0) res = res + " parse=" + parse->toString(ASTOutputEnum(config | DEBUG_NO_VAR)); if (e.get_restr() != 0) res = res + " type=" + e.get_restr()->toString(ASTOutputEnum(config | DEBUG_NO_VAR)); if (init != 0) res = res + " default=" + init->toString(ASTOutputEnum(config | DEBUG_NO_VAR)); if (msg != 0) res = res + " message=" + msg->toString(ASTOutputEnum(config | DEBUG_NO_VAR)); res = res + "/>"; return res; }