コード例 #1
0
 private static void addEmptyArrayArgumentTo(CallExpression call, string script, int argumentIndex, int[] range)
 {
     var expression = new ArrayExpression()
     {
         Elements = new Expression[0],
         Location = new Jint.Parser.Location
         {
             Source = script,
             Start = new Jint.Parser.Position { /*TODO*/ },
             End = new Jint.Parser.Position { /*TODO*/ }
         },
         Range = range
     };
     call.Arguments.Insert(argumentIndex, expression);
 }
コード例 #2
0
ファイル: ExpressionIntepreter.cs プロジェクト: skipme/jint
 public JsValue EvaluateArrayExpression(ArrayExpression arrayExpression)
 {
     var a = _engine.Array.Construct(new JsValue[] { arrayExpression.Elements.Count() });
     var n = 0;
     foreach (var expr in arrayExpression.Elements)
     {
         if (expr != null)
         {
             var value = _engine.GetValue(EvaluateExpression(expr));
             a.DefineOwnProperty(n.ToString(),
                 new PropertyDescriptor(value, true, true, true), false);
         }
         n++;
     }
     
     return a;
 }
コード例 #3
0
        private void EmitArrayExpression(ArrayExpression e)
        {
            bool first = true;
            Write("[ ");
            foreach (var item in e.Elements)
            {
                if (first) first = false; else Write(", ");
                Emit(item);

            }
            Write("] ");
        }