Exemple #1
0
        private static void GetArrayValue(object obj, ScriptArrayResolution scriptArrayResolution, IScriptContext context)
        {
            scriptArrayResolution.Evaluate(context);
            object[] param     = (object[])context.Result;
            IBinding indexBind = RuntimeHost.Binder.BindToIndex(obj, param, false);

            if (indexBind != null)
            {
                context.Result = indexBind.Invoke(context, null);
            }
            else
            {
                throw MethodNotFoundException("indexer[]", param);
            }
        }
Exemple #2
0
        private static void SetArrayValue(object obj, ScriptArrayResolution scriptArrayResolution, IScriptContext context, object value)
        {
            scriptArrayResolution.Evaluate(context);

            object[] indexParameters  = (object[])context.Result;
            object[] setterParameters = new object[indexParameters.Length + 1];
            indexParameters.CopyTo(setterParameters, 0);
            setterParameters[indexParameters.Length] = value;

            IBinding setter = RuntimeHost.Binder.BindToIndex(obj, setterParameters, true);

            if (setter != null)
            {
                setter.Invoke(context, null);
                return;
            }

            throw MethodNotFoundException("setter", indexParameters);
        }
Exemple #3
0
    private static void GetArrayValue(object obj, ScriptArrayResolution scriptArrayResolution, IScriptContext context) {
        scriptArrayResolution.Evaluate(context);
        object[] param = (object[])context.Result;
        IBinding indexBind = RuntimeHost.Binder.BindToIndex(obj, param, false);

        if (indexBind != null) {
            context.Result = indexBind.Invoke(context, null);
        } else {
            throw MethodNotFoundException("indexer[]", param);
        }
    }
Exemple #4
0
    private static void SetArrayValue(object obj, ScriptArrayResolution scriptArrayResolution, IScriptContext context, object value) {
        scriptArrayResolution.Evaluate(context);

        object[] indexParameters = (object[])context.Result;
        object[] setterParameters = new object[indexParameters.Length + 1];
        indexParameters.CopyTo(setterParameters, 0);
        setterParameters[indexParameters.Length] = value;

        IBinding setter = RuntimeHost.Binder.BindToIndex(obj, setterParameters, true);
        if (setter != null) {
            setter.Invoke(context, null);
            return;
        }

        throw MethodNotFoundException("setter", indexParameters);
    }
 public ScriptNewArrStmt(AstNodeArgs args)
   : base(args)
 {
   _constrExpr = ChildNodes[1] as ScriptTypeExpr;
   _arrRank = ChildNodes[2] as ScriptArrayResolution;
 }
Exemple #6
0
 public ScriptNewArrStmt(AstNodeArgs args)
     : base(args)
 {
     _constrExpr = ChildNodes[1] as ScriptTypeExpr;
     _arrRank    = ChildNodes[2] as ScriptArrayResolution;
 }