Exemplo n.º 1
0
 public override bool TryGetMember(GetMemberBinder binder, out object result)
 {
     if (internalObject.HasAttribute (binder.Name)) {
         IodineObject obj = internalObject.GetAttribute (binder.Name);
         if (!IodineTypeConverter.Instance.ConvertToPrimative (obj, out result)) {
             result = new IodineDynamicObject (obj, internalVm);
         }
         return true;
     }
     result = null;
     return true;
 }
Exemplo n.º 2
0
 public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)
 {
     IodineObject[] arguments = new IodineObject[args.Length];
     for (int i = 0; i < args.Length; i++) {
         IodineObject val = null;
         if (!IodineTypeConverter.Instance.ConvertFromPrimative (args [i], out val)) {
             if (args [i] is IodineObject) {
                 val = (IodineObject)args [i];
             } else {
                 result = null;
                 return false;
             }
         }
         arguments [i] = val;
     }
     IodineObject returnVal = internalObject.Invoke (internalVm, arguments);
     if (!IodineTypeConverter.Instance.ConvertToPrimative (returnVal, out result)) {
         result = new IodineDynamicObject (returnVal, internalVm);
     }
     return true;
 }