コード例 #1
0
 public override bool Visit(AstStatementsBlock node)
 {
     ErrorIfIsNull(node.Statements);
     return true;
 }
コード例 #2
0
ファイル: nodes.cs プロジェクト: nikita-vanyasin/compiler
 public AstClassMethod(
     AstVisibilityModifier visibility,
     AstStaticModifier staticMod,
     AstIdExpression typeDef,
     AstIdExpression name,
     AstArgumentsDefList argumentsDefinition,
     AstStatementsBlock statementsBlock
 )
 {
     Visibility = visibility;
     Static = staticMod;
     TypeDef = typeDef;
     Name = name;
     ArgumentsDefinition = argumentsDefinition;
     StatementsBlock = statementsBlock;
 }
コード例 #3
0
 public override bool Visit(AstStatementsBlock node)
 {
     return true;
 }
コード例 #4
0
ファイル: nodes.cs プロジェクト: nikita-vanyasin/compiler
 public AstIfStatement(AstExpression cond, AstStatementsBlock thenBlock, AstStatementsBlock elseBlock)
 {
     Condition = cond;
     ThenBlock = thenBlock;
     ElseBlock = elseBlock;
 }
コード例 #5
0
ファイル: nodes.cs プロジェクト: nikita-vanyasin/compiler
 public AstWhileStatement(AstExpression cond, AstStatementsBlock block)
 {
     Condition = cond;
     Statements = block;
 }
コード例 #6
0
        // #STATEMENTS_BLOCK #STATEMENTS
        private void ConstructStatementsBlock()
        {
            var astStatementsList = nodes.Pop() as AstStatementsList;

            var block = new AstStatementsBlock(astStatementsList);
            PushNode(block);
        }
コード例 #7
0
 // #STATEMENTS_BLOCK PASS LINE_END
 private void ConstructPassStatementsBlock()
 {
     var statementsList = new List<AstStatement>();
     var astStatementsList = new AstStatementsList(statementsList);
     var block = new AstStatementsBlock(astStatementsList);
     PushNode(block);
 }
コード例 #8
0
        // #IF_THEN_STATEMENT IF LEFT_PAREN #OR_TEST RIGHT_PAREN BLOCK_START #STATEMENTS_BLOCK BLOCK_END
        private void ConstructIfThenStatement()
        {
            var thenBlock = nodes.Pop() as AstStatementsBlock;
            var orTest = nodes.Pop() as AstExpression;

            var elseBlock = new AstStatementsBlock(new AstStatementsList(new List<AstStatement>()));
            var ifThenStmt = new AstIfStatement(orTest, thenBlock, elseBlock);
            PushNode(ifThenStmt);
        }
コード例 #9
0
 public override bool Visit(AstStatementsBlock node)
 {
     var stmts = node.Statements.Statements;
     for (var i = 0; i < stmts.Count; ++i)
     {
         var stmt = stmts[i];
         if (stmt is AstReturnStatement && i < stmts.Count - 1)
         {
             DispatchError(stmts[i + 1].TextPosition, "Unreachable code detected");
             return false;
         }
     }
     return true;
 }
コード例 #10
0
 public abstract bool Visit(AstStatementsBlock node);