Esempio n. 1
0
 private static AstNode ParseIf(TokenStream stream)
 {
     IfStatement ifStmt = new IfStatement (stream.Location);
     stream.Expect (TokenClass.Keyword, "if");
     stream.Expect (TokenClass.OpenParan);
     ifStmt.Add (ParseExpression (stream));
     stream.Expect (TokenClass.CloseParan);
     ifStmt.Add (ParseStatement (stream));
     if (stream.Accept (TokenClass.Keyword, "else")) {
         ifStmt.Add (ParseStatement (stream));
     } else {
         ifStmt.Add (new CodeBlock (stream.Location));
     }
     return ifStmt;
 }
Esempio n. 2
0
 public void Accept(IfStatement ifStmt)
 {
     ifStmt.Visit (functionCompiler);
 }
Esempio n. 3
0
		public override void Accept (IfStatement ifStmt)
		{
			IodineLabel elseLabel = methodBuilder.CreateLabel ();
			IodineLabel endLabel = methodBuilder.CreateLabel ();
			ifStmt.Condition.Visit (this);
			methodBuilder.EmitInstruction (ifStmt.Body.Location, Opcode.JumpIfFalse, elseLabel);
			ifStmt.Body.Visit (this);
			methodBuilder.EmitInstruction (ifStmt.ElseBody.Location, Opcode.Jump, endLabel);
			methodBuilder.MarkLabelPosition (elseLabel);
			ifStmt.ElseBody.Visit (this);
			methodBuilder.MarkLabelPosition (endLabel);
		}
Esempio n. 4
0
		public override void Accept (IfStatement ifStmt)
		{
			errorLog.AddError (ErrorType.ParserError, ifStmt.Location,
				"statement can not exist inside pattern!");
		}
Esempio n. 5
0
 public virtual void Accept(IfStatement ifStmt)
 {
 }
Esempio n. 6
0
 public void Accept(IfStatement ifStmt)
 {
     ifStmt.VisitChildren (this);
 }
Esempio n. 7
0
 public void Accept(IfStatement ifStmt)
 {
     errorLog.AddError (ErrorType.ParserError, ifStmt.Location,
         "Statement not allowed outside function body!");
 }
Esempio n. 8
0
 public void Accept(IfStatement ifStmt)
 {
 }