Пример #1
0
 public void SetAttribute(string name, IodineObject value)
 {
     if (value is IodineMethod)
     {
         IodineMethod method = (IodineMethod)value;
         if (method.InstanceMethod)
         {
             Attributes [name] = new IodineInstanceMethodWrapper(this, method);
         }
         else
         {
             Attributes [name] = value;
         }
     }
     else if (value is IodineInstanceMethodWrapper)
     {
         IodineInstanceMethodWrapper wrapper = (IodineInstanceMethodWrapper)value;
         Attributes [name] = new IodineInstanceMethodWrapper(this, wrapper.Method);
     }
     else if (value is IodineProperty)
     {
         IodineProperty property = (IodineProperty)value;
         Attributes [name] = new IodineProperty(property.Getter, property.Setter, this);
     }
     else
     {
         Attributes [name] = value;
     }
 }
Пример #2
0
 public void SetAttribute(string name, IodineObject value)
 {
     if (value is IodineMethod)
     {
         IodineMethod method = (IodineMethod)value;
         Attributes [name] = new IodineBoundMethod(this, method);
     }
     else if (value is BuiltinMethodCallback)
     {
         BuiltinMethodCallback callback = (BuiltinMethodCallback)value;
         callback.Self     = this;
         Attributes [name] = value;
     }
     else if (value is IodineBoundMethod)
     {
         IodineBoundMethod wrapper = (IodineBoundMethod)value;
         Attributes [name] = new IodineBoundMethod(this, wrapper.Method);
     }
     else if (value is IodineProperty)
     {
         IodineProperty property = (IodineProperty)value;
         Attributes [name] = new IodineProperty(property.Getter, property.Setter, this);
     }
     else
     {
         Attributes [name] = value;
     }
 }
Пример #3
0
 public void SetAttribute(string name, IodineObject value)
 {
     if (value is IodineMethod) {
         IodineMethod method = (IodineMethod)value;
         if (method.InstanceMethod) {
             attributes [name] = new IodineInstanceMethodWrapper (this, method);
         } else {
             attributes [name] = value;
         }
     } else if (value is IodineInstanceMethodWrapper) {
         IodineInstanceMethodWrapper wrapper = (IodineInstanceMethodWrapper)value;
         attributes [name] = new IodineInstanceMethodWrapper (this, wrapper.Method);
     } else if (value is IodineProperty) {
         IodineProperty property = (IodineProperty)value;
         attributes [name] = new IodineProperty (property.Getter, property.Setter, this);
     } else {
         attributes [name] = value;
     }
 }