Esempio n. 1
0
 private static AstNode ParseTernaryIfElse(TokenStream stream)
 {
     AstNode expr = ParsePipeline (stream);
     while (stream.Accept (TokenClass.Keyword, "when")) {
         AstNode condition = ParseExpression (stream);
         stream.Expect (TokenClass.Keyword, "else");
         AstNode altValue = ParseTernaryIfElse (stream);
         expr = new TernaryExpression (expr.Location, condition, expr, altValue);
     }
     return expr;
 }
Esempio n. 2
0
		public override void Accept (TernaryExpression ifExpr)
		{
			IodineLabel elseLabel = methodBuilder.CreateLabel ();
			IodineLabel endLabel = methodBuilder.CreateLabel ();
			ifExpr.Condition.Visit (this);
			methodBuilder.EmitInstruction (ifExpr.Expression.Location, Opcode.JumpIfFalse, elseLabel);
			ifExpr.Expression.Visit (this);
			methodBuilder.EmitInstruction (ifExpr.ElseExpression.Location, Opcode.Jump, endLabel);
			methodBuilder.MarkLabelPosition (elseLabel);
			ifExpr.ElseExpression.Visit (this);
			methodBuilder.MarkLabelPosition (endLabel);
		}
Esempio n. 3
0
 public void Accept(TernaryExpression ifExpr)
 {
     ifExpr.Visit (functionCompiler);
 }
Esempio n. 4
0
		public override void Accept (TernaryExpression ifExpr)
		{
			errorLog.AddError (ErrorType.ParserError, ifExpr.Location,
				"Expression can not exist inside pattern!");
		}
Esempio n. 5
0
 public virtual void Accept(TernaryExpression ifExpr)
 {
 }
Esempio n. 6
0
 public void Accept(TernaryExpression ifExpr)
 {
     ifExpr.VisitChildren (this);
 }