Ejemplo n.º 1
0
 public IndexMemberExpression(AbstractMemberExpression indexedMemberExpression, AbstractExpression indexerExpression, bool isStrictMode) : base(isStrictMode)
 {
     this.indexedMemberExpression = indexedMemberExpression;
     this.indexerExpression       = indexerExpression;
 }
Ejemplo n.º 2
0
 public IfStatement(AbstractExpression conditionExpression, Statement trueStatement, bool isStrictMode) : base(isStrictMode)
 {
     hasElse = false;
     this.conditionExpression = conditionExpression;
     this.trueStatement       = trueStatement;
 }
Ejemplo n.º 3
0
 public ForInLetConstIterationStatement(ForDeclaration forDeclaration, AbstractExpression forInExpression, Statement doStatement, bool isStrictMode) : base(isStrictMode)
 {
     this.forDeclaration  = forDeclaration;
     this.forInExpression = forInExpression;
     this.doStatement     = doStatement;
 }
Ejemplo n.º 4
0
 public SuperIndexMemberExpression(AbstractExpression superIndexerExpression, bool isStrictMode) : base(isStrictMode)
 {
     this.superIndexerExpression = superIndexerExpression;
 }
Ejemplo n.º 5
0
 public ForInLHSIterationStatement(AbstractLeftHandSideExpression leftHandSideExpression, AbstractExpression inExpression, Statement doStatement, bool isStrictMode) : base(isStrictMode)
 {
     this.leftHandSideExpression = leftHandSideExpression;
     this.inExpression           = inExpression;
     this.doStatement            = doStatement;
 }
Ejemplo n.º 6
0
 public ForInVarIterationStatement(ForBinding forVar, AbstractExpression forInExpression, Statement doStatement, bool isStrictMode) : base(isStrictMode)
 {
     this.forVar          = forVar;
     this.forInExpression = forInExpression;
     this.doStatement     = doStatement;
 }
Ejemplo n.º 7
0
 public WhileIterationStatement(AbstractExpression whileExpression, Statement doStatement, bool isStrictMode) : base(isStrictMode)
 {
     this.doStatement     = doStatement;
     this.whileExpression = whileExpression;
 }
Ejemplo n.º 8
0
 public ForLexicalIterationStatement(LexicalDeclaration lexicalDeclaration, AbstractExpression leftExpression, AbstractExpression rightExpression, Statement doStatement, bool isStrictMode) : base(isStrictMode)
 {
     this.doStatement        = doStatement;
     this.lexicalDeclaration = lexicalDeclaration;
     this.leftExpression     = leftExpression;
     this.rightExpression    = rightExpression;
 }
Ejemplo n.º 9
0
        protected static CompletionOr <IteratorRecord?> ForInOfHeadEvaluation(IEnumerable <string> TDZNames, AbstractExpression expr, IterationKind iterationKind)
        {
            var oldEnv = Interpreter.Instance().RunningExecutionContext().LexicalEnvironment;

            if (TDZNames.Any())
            {
                if (TDZNames.Distinct().Count() < TDZNames.Count())
                {
                    throw new InvalidOperationException("Spec 13.7.5.12 step 2a");
                }
                var TDZ       = oldEnv.NewDeclarativeEnvironment();
                var TDZEnvRec = TDZ.EnvironmentRecord;
                foreach (var name in TDZNames)
                {
                    TDZEnvRec.CreateMutableBinding(name, false);
                }
                Interpreter.Instance().RunningExecutionContext().LexicalEnvironment = TDZ;
            }
            var exprRef = expr.Evaluate(Interpreter.Instance());

            Interpreter.Instance().RunningExecutionContext().LexicalEnvironment = oldEnv;
            var exprValue = exprRef.GetValue();

            if (exprValue.IsAbrupt())
            {
                return(exprValue.WithEmpty <IteratorRecord?>());
            }
            if (iterationKind == IterationKind.Enumerate)
            {
                if (exprValue.value == UndefinedValue.Instance || exprValue.value == NullValue.Instance)
                {
                    return(new Completion(CompletionType.Break, null, null).WithEmpty <IteratorRecord?>());
                }
                var obj = exprValue.value !.ToObject().value as Object;
                return(obj !.EnumerateObjectProperties());
            }
            else
            {
                return((exprValue.value !.ToObject().value as Object) !.GetIterator());
            }
        }
Ejemplo n.º 10
0
 public CaseClause(AbstractExpression matchExpression, StatementList statementList)
 {
     this.matchExpression = matchExpression;
     this.statementList   = statementList;
 }
Ejemplo n.º 11
0
 public SwitchStatement(AbstractExpression switchExpression, CaseBlock caseBlock, bool isStrictMode) : base(isStrictMode)
 {
     this.switchExpression = switchExpression;
     this.caseBlock        = caseBlock;
 }
Ejemplo n.º 12
0
 public ExpressionStatement(AbstractExpression expression, bool isStrictMode) : base(isStrictMode)
 {
     this.expression = expression;
 }
Ejemplo n.º 13
0
 public ParenthesizedExpression(AbstractExpression expression, bool isStrictMode) : base(isStrictMode)
 {
     this.expression = expression;
 }