Diff for /parser3/src/include/Attic/pa_vobject.h between versions 1.3 and 1.15

version 1.3, 2001/02/25 08:12:21 version 1.15, 2001/03/09 04:47:27
Line 5 Line 5
 #ifndef PA_VOBJECT_H  #ifndef PA_VOBJECT_H
 #define PA_VOBJECT_H  #define PA_VOBJECT_H
   
 #include "pa_value.h"  #include "pa_valiased.h"
 #include "pa_vjunction.h"  #include "pa_vjunction.h"
   #include "pa_vclass.h"
   
 class VObject : public Value {  class Temp_class_alias;
   
   class VObject : public VAliased {
           friend Temp_class_alias;
 public: // Value  public: // Value
                   
         // all: for error reporting after fail(), etc          // all: for error reporting after fail(), etc
         const char *type() const { return "Object"; }          const char *type() const { return "object"; }
   
         // object_instance: (field)=value;(STATIC)=hash;(method)=method_ref          // object_instance: (field)=value;(CLASS)=vclass;(method)=method_ref
         Value *get_element(const String& name) {          Value *get_element(const String& name) {
                 // $STATIC=STATIC hash                  // $CLASS=my class
                 if(name==STATIC_NAME)                  if(name==CLASS_NAME)
                         return &vclass.STATICS;                          return fclass_alias;
                   // $BASE=my parent
                 // $method=junction(this+method)                  if(name==BASE_NAME)
                 if(Method *method=static_cast<Method *>(vclass.methods().get(name))) {                          return fclass_alias->base();
                         Junction& j=*NEW Junction(pool(),                   // $method=junction(self+class+method)
                                 *this,                  if(Junction *junction=fclass_real.get_junction(*this, name))
                                 method,0,0,0,0);                          return NEW VJunction(*junction);;
                   // $field=ffields.field
                         return NEW VJunction(j);                  return static_cast<Value *>(ffields.get(name));
                 }  
   
                 // $field=fields.field  
                 return static_cast<Value *>(fields.get(name));  
         }          }
   
         // object_instance: (field)=value          // object_instance: (field)=value
         void put_element(const String& name, Value *value) {          void put_element(const String& name, Value *value) {
                 // speed1:                  // speed1:
                 //   will not check for '$STATIC(subst)' trick                  //   will not check for '$CLASS(subst)' trick
                 //   will hope that user ain't THAT self-hating person                  //   will hope that user ain't THAT self-hating person
                 // speed2:                  // speed2:
                 //   will not check for '$method_name(subst)' trick                  //   will not check for '$method_name(subst)' trick
                 //   -same-                  //   -same-
   
                 fields.put(name, value);                  ffields.put(name, value);
         }          }
   
         // object_class, object_instance: object_class          // object_class, object_instance: object_class
         VClass *get_class() { return &vclass; }          VClass *get_class() { return &fclass_real; }
   
 public: // creation  public: // creation
   
         VObject(Pool& apool, VClass& vclass) :           VObject(VClass& aclass_real) : VAliased(aclass_real.pool(), aclass_real), 
                 Value(apool),                   fclass_real(aclass_real),
                 vclass(vclass),                  ffields(aclass_real.pool()) {
                 fields(apool) {  
         }          }
   
 private:  private:
   
         VClass& vclass;          VClass& fclass_real;
         Hash fields;          Hash ffields;
 };  };
   
 #endif  #endif

Removed from v.1.3  
changed lines
  Added in v.1.15


E-mail: