--- parser3/src/include/Attic/pa_vmframe.h 2001/03/08 13:13:39 1.16 +++ parser3/src/include/Attic/pa_vmframe.h 2001/03/08 16:54:25 1.18 @@ -1,5 +1,5 @@ /* - $Id: pa_vmframe.h,v 1.16 2001/03/08 13:13:39 paf Exp $ + $Id: pa_vmframe.h,v 1.18 2001/03/08 16:54:25 paf Exp $ */ #ifndef PA_VMFRAME_H @@ -53,9 +53,10 @@ public: // usage // remember them // those are flags that name is local == to be looked up in 'my' for(int i=0; isize(); i++) { - my->put( - *static_cast(method.locals_names->get(i)), - NEW VUnknown(pool())); + Value *value=NEW VUnknown(pool()); + String& name=*static_cast(method.locals_names->get(i)); + value->set_name(name); + my->put(name, value); } } } @@ -71,31 +72,38 @@ public: // usage if(store_param_index==max_params) THROW(0,0, &junction.self.name(), - "%s method '%s' accepts maximum %d parameters", + "%s method '%s' accepts maximum %d parameter(s)", junction.self.type(), method.name.cstr(), max_params); if(method.numbered_params_count) { // are this method params numbered? *fnumbered_params+=value; - } else { // named params + } else { // named param + // clone it String& name=*static_cast( method.params_names->get(store_param_index++)); - my->put(name, value); - value->set_name(name); + Value *copy=value->clone(); // make a copy of a value so to safely rename it + my->put(name, copy); // remember param + copy->set_name(name); // rename 'copy' to param's 'name' } } void fill_unspecified_params() { Method &method=*junction.method; if(method.numbered_params_count) { // are this method params numbered? - for(; store_param_indexset_name(/*"Param#" . store_param_index*/); + *fnumbered_params+=value; + } } else { // named params if(method.params_names) // there are any parameters might need filling? - for(; store_param_indexsize(); store_param_index++) - my->put( - *static_cast(method.params_names->get(store_param_index)), - NEW VUnknown(pool())); + for(; store_param_indexsize(); store_param_index++) { + Value *value=NEW VUnknown(pool()); + String& name=*static_cast(method.params_names->get(store_param_index)); + value->set_name(name); + my->put(name, value); + } } }