public Expression CompileControlStatement(ControllStatement stmnt) { switch (stmnt.Token) { case TokenType.RETURN: return(Expression.Return(ReturnLabel, stmnt.Value != null ? CompileExpression(stmnt.Value, ValueTypes.BOXED) : Expression.Constant(W_Type.NULL))); default: throw new Exception(String.Format("controll statement {0} not supported", stmnt.Token)); } }
private ControllStatement ParseControlStatement() { ControllStatement ret = NewNode <ControllStatement>(); NextToken(); if (Token != TokenType.SEMICOLON) { ret.Value = ParseExpression(0); } ExpectToken(TokenType.SEMICOLON); NextToken(); return(ret); }