--- parser3/src/include/Attic/pa_vmframe.h 2001/02/25 18:02:12 1.9 +++ parser3/src/include/Attic/pa_vmframe.h 2001/03/08 12:13:35 1.14 @@ -1,5 +1,5 @@ /* - $Id: pa_vmframe.h,v 1.9 2001/02/25 18:02:12 paf Exp $ + $Id: pa_vmframe.h,v 1.14 2001/03/08 12:13:35 paf Exp $ */ #ifndef PA_VMFRAME_H @@ -13,7 +13,7 @@ class VMethodFrame : public WContext { public: // Value // all: for error reporting after fail(), etc - const char *type() const { return "MethodFrame"; } + const char *type() const { return "method_frame"; } // frame: my or self_transparent Value *get_element(const String& name) { Value *result=static_cast(my.get(name)); @@ -43,12 +43,14 @@ public: // usage my(apool), self(0) { if(Method* method=junction.method) { // method junction? - // remember local var names - // those are flags that name is local == to be looked up in 'my' - for(int i=0; ilocals_names.size(); i++) { - my.put( - *static_cast(method->locals_names.get(i)), - NEW VUnknown(pool())); + if(method->locals_names) { // there are any local var names? + // remember them + // those are flags that name is local == to be looked up in 'my' + for(int i=0; ilocals_names->size(); i++) { + my.put( + *static_cast(method->locals_names->get(i)), + NEW VUnknown(pool())); + } } } } @@ -57,19 +59,26 @@ public: // usage void store_param(Value *value) { Method *method=junction.method; - if(store_param_index==method->params_names.size()) + int max_params=method->params_names?method->params_names->size():0; + if(store_param_index==max_params) THROW(0,0, - &name(), - "call: too many params (max=%d)", method->params_names.size()); + &junction.self.name(), + "%s method '%s' accepts maximum %d parameters", + junction.self.type(), + method->name.cstr(), + max_params); - my.put(*static_cast(method->params_names.get(store_param_index++)), value); + String& name=*static_cast(method->params_names->get(store_param_index++)); + my.put(name, value); + value->set_name(name); } void fill_unspecified_params() { - Method *method=junction.method; - for(; store_param_indexparams_names.size(); store_param_index++) - my.put( - *static_cast(method->params_names.get(store_param_index)), - NEW VUnknown(pool())); + Array *params_names=junction.method->params_names; + if(params_names) // there are any parameters might need filling? + for(; store_param_indexsize(); store_param_index++) + my.put( + *static_cast(params_names->get(store_param_index)), + NEW VUnknown(pool())); } public: