|
|
| version 1.10, 2001/03/01 13:52:59 | version 1.14, 2001/03/08 12:13:35 |
|---|---|
| Line 13 class VMethodFrame : public WContext { | Line 13 class VMethodFrame : public WContext { |
| public: // Value | public: // Value |
| // all: for error reporting after fail(), etc | // 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 | // frame: my or self_transparent |
| Value *get_element(const String& name) { | Value *get_element(const String& name) { |
| Value *result=static_cast<Value *>(my.get(name)); | Value *result=static_cast<Value *>(my.get(name)); |
| Line 43 public: // usage | Line 43 public: // usage |
| my(apool), | my(apool), |
| self(0) { | self(0) { |
| if(Method* method=junction.method) { // method junction? | if(Method* method=junction.method) { // method junction? |
| // remember local var names | if(method->locals_names) { // there are any local var names? |
| // those are flags that name is local == to be looked up in 'my' | // remember them |
| for(int i=0; i<method->locals_names.size(); i++) { | // those are flags that name is local == to be looked up in 'my' |
| my.put( | for(int i=0; i<method->locals_names->size(); i++) { |
| *static_cast<String *>(method->locals_names.get(i)), | my.put( |
| NEW VUnknown(pool())); | *static_cast<String *>(method->locals_names->get(i)), |
| NEW VUnknown(pool())); | |
| } | |
| } | } |
| } | } |
| } | } |
| Line 57 public: // usage | Line 59 public: // usage |
| void store_param(Value *value) { | void store_param(Value *value) { |
| Method *method=junction.method; | 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, | THROW(0,0, |
| &name(), | &junction.self.name(), |
| "call: too many params (max=%d)", method->params_names.size()); | "%s method '%s' accepts maximum %d parameters", |
| junction.self.type(), | |
| method->name.cstr(), | |
| max_params); | |
| String& name=*static_cast<String *>(method->params_names.get(store_param_index++)); | String& name=*static_cast<String *>(method->params_names->get(store_param_index++)); |
| my.put(name, value); | my.put(name, value); |
| value->set_name(name); | value->set_name(name); |
| } | } |
| void fill_unspecified_params() { | void fill_unspecified_params() { |
| Method *method=junction.method; | Array *params_names=junction.method->params_names; |
| for(; store_param_index<method->params_names.size(); store_param_index++) | if(params_names) // there are any parameters might need filling? |
| my.put( | for(; store_param_index<params_names->size(); store_param_index++) |
| *static_cast<String *>(method->params_names.get(store_param_index)), | my.put( |
| NEW VUnknown(pool())); | *static_cast<String *>(params_names->get(store_param_index)), |
| NEW VUnknown(pool())); | |
| } | } |
| public: | public: |