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; }
public void Accept(IfStatement ifStmt) { ifStmt.Visit (functionCompiler); }
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); }
public override void Accept (IfStatement ifStmt) { errorLog.AddError (ErrorType.ParserError, ifStmt.Location, "statement can not exist inside pattern!"); }
public virtual void Accept(IfStatement ifStmt) { }
public void Accept(IfStatement ifStmt) { ifStmt.VisitChildren (this); }
public void Accept(IfStatement ifStmt) { errorLog.AddError (ErrorType.ParserError, ifStmt.Location, "Statement not allowed outside function body!"); }
public void Accept(IfStatement ifStmt) { }