コード例 #1
0
ファイル: Internals.cs プロジェクト: vrajeshbhavsar/mcjs
 public static bool CallProperty(mdr.DObject input, string propName, out mdr.DValue output)
 {
     if (input != null)
     {
         var propDesc = input.GetPropertyDescriptor(propName);
         var prop     = new mdr.DValue();
         propDesc.Get(input, ref prop);
         mdr.DFunction func = null;
         if (prop.ValueType == mdr.ValueTypes.Function)
         {
             func = prop.AsDFunction();
             //if (toString != null)
             //{
             mdr.CallFrame callFrame = new mdr.CallFrame();
             callFrame.This     = (input);
             callFrame.Function = func;
             func.Call(ref callFrame);
             if (ValueTypesHelper.IsPrimitive(callFrame.Return.ValueType))
             {
                 output = callFrame.Return;
                 return(true);
             }
         }
     }
     output = new mdr.DValue();
     output.SetUndefined();
     return(false);
 }
コード例 #2
0
ファイル: Internals.cs プロジェクト: reshadi2/mcjs
 public static bool CallProperty(mdr.DObject input, string propName, out mdr.DValue output)
 {
   if (input != null)
   {
     var propDesc = input.GetPropertyDescriptor(propName);
     var prop = new mdr.DValue();
     propDesc.Get(input, ref prop);
     mdr.DFunction func = null;
     if (prop.ValueType == mdr.ValueTypes.Function)
     {
       func = prop.AsDFunction();
       //if (toString != null)
       //{
       mdr.CallFrame callFrame = new mdr.CallFrame();
       callFrame.This = (input);
       callFrame.Function = func;
       func.Call(ref callFrame);
       if (ValueTypesHelper.IsPrimitive(callFrame.Return.ValueType))
       {
         output = callFrame.Return;
         return true;
       }
     }
   }
   output = new mdr.DValue();
   output.SetUndefined();
   return false;
 }