Add initial typechecker for AST #2
@ -227,7 +227,9 @@ testStatementConstructorCallWithArgs = TestCase $
|
|||||||
assertEqual "expect constructor call" [StatementExpressionStatement (ConstructorCall "Foo" [Reference "b"])] $
|
assertEqual "expect constructor call" [StatementExpressionStatement (ConstructorCall "Foo" [Reference "b"])] $
|
||||||
parseStatement [NEW,IDENTIFIER "Foo",LBRACE,IDENTIFIER "b",RBRACE,SEMICOLON]
|
parseStatement [NEW,IDENTIFIER "Foo",LBRACE,IDENTIFIER "b",RBRACE,SEMICOLON]
|
||||||
|
|
||||||
|
testStatementPreIncrement = TestCase $
|
||||||
|
assertEqual "expect increment" [StatementExpressionStatement $ PostIncrement $ Reference "a"] $
|
||||||
|
parseStatement [IDENTIFIER "a",INCREMENT,SEMICOLON]
|
||||||
|
|
||||||
|
|
||||||
tests = TestList [
|
tests = TestList [
|
||||||
@ -296,5 +298,6 @@ tests = TestList [
|
|||||||
testStatementAssign,
|
testStatementAssign,
|
||||||
testStatementMethodCallNoParams,
|
testStatementMethodCallNoParams,
|
||||||
testStatementConstructorCall,
|
testStatementConstructorCall,
|
||||||
testStatementConstructorCallWithArgs
|
testStatementConstructorCallWithArgs,
|
||||||
|
testStatementIncrement
|
||||||
]
|
]
|
@ -249,10 +249,10 @@ assignment : lefthandside assignmentoperator assignmentexpression {
|
|||||||
|
|
||||||
|
|
||||||
statementexpression : assignment { $1 }
|
statementexpression : assignment { $1 }
|
||||||
-- | preincrementexpression { }
|
| preincrementexpression { $1 }
|
||||||
-- | predecrementexpression { }
|
| predecrementexpression { $1 }
|
||||||
-- | postincrementexpression { }
|
| postincrementexpression { $1 }
|
||||||
-- | postdecrementexpression { }
|
| postdecrementexpression { $1 }
|
||||||
| methodinvocation { $1 }
|
| methodinvocation { $1 }
|
||||||
| classinstancecreationexpression { $1 }
|
| classinstancecreationexpression { $1 }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user