Inheritance: Jint.Parser.Ast.Statement
Esempio n. 1
0
        public Completion ExecuteIfStatement(IfStatement ifStatement)
        {
            var exprRef = _engine.EvaluateExpression(ifStatement.Test);
            Completion result;

            if (TypeConverter.ToBoolean(_engine.GetValue(exprRef)))
            {
                result = ExecuteStatement(ifStatement.Consequent);
            }
            else if (ifStatement.Alternate != null)
            {
                result = ExecuteStatement(ifStatement.Alternate);
            }
            else
            {
                return new Completion(Completion.Normal, null, null);
            }

            return result;
        }
Esempio n. 2
0
 private void EmitIfStatement(IfStatement s)
 {
     Write("if(");
     Emit(s.Test);
     Write(") ");
     Emit(s.Consequent);
     if (null != s.Alternate)
     {
         Write(" else ");
         Emit(s.Alternate);
     }
     _skipeolonce = true;
 }