示例#1
0
 StackObj getContextVar(uint16_t context_id, uint16_t var_id) {
     if (context_id == bf_->scopeId()) {
         if (scope_vars.size() < var_id) {
             throw new std::runtime_error("Uncorrect var");
         }
         return scope_vars[var_id];
     } else if (parent_ != NULL) {
         return parent_->getContextVar(context_id, var_id);
     } else {
         throw new std::runtime_error("Uncorrect var");
     }
 }
示例#2
0
        void storeContextVar(StackObj var, uint16_t context_id, uint16_t var_id) {
            if (context_id == bf_->scopeId()) {
                if (scope_vars.size() < var_id) {
                    throw new runtime_error("Uncorrect var");
                }
                scope_vars[var_id] = var;
            } else if (parent_ != NULL) {
                parent_->storeContextVar(var, context_id, var_id);
            } else {
                throw new std::runtime_error("Uncorrect Var");
            }

        }