Add initial typechecker for AST #2
@ -197,6 +197,9 @@ testExpressionFieldAccess = TestCase $
|
||||
testExpressionSimpleFieldAccess = TestCase $
|
||||
assertEqual "expect Reference" (Reference "a") $
|
||||
parseExpression [IDENTIFIER "a"]
|
||||
testExpressionFieldSubAccess = TestCase $
|
||||
assertEqual "expect NameResolution without this" (BinaryOperation NameResolution (Reference "a") (Reference "b")) $
|
||||
parseExpression [IDENTIFIER "a",DOT,IDENTIFIER "b"]
|
||||
|
||||
testStatementIfThen = TestCase $
|
||||
assertEqual "expect empty ifthen" [If (Reference "a") (Block [Block []]) Nothing] $
|
||||
@ -275,6 +278,7 @@ tests = TestList [
|
||||
testExpressionThisMethodCallParam,
|
||||
testExpressionFieldAccess,
|
||||
testExpressionSimpleFieldAccess,
|
||||
testExpressionFieldSubAccess,
|
||||
testStatementIfThen,
|
||||
testStatementIfThenElse,
|
||||
testStatementWhile,
|
||||
|
@ -83,11 +83,11 @@ typedeclarations : typedeclaration { [$1] }
|
||||
| typedeclarations typedeclaration { $1 ++ [$2] }
|
||||
|
||||
name : simplename { Reference $1 }
|
||||
-- | qualifiedname { }
|
||||
| qualifiedname { $1 }
|
||||
|
||||
typedeclaration : classdeclaration { $1 }
|
||||
|
||||
qualifiedname : name DOT IDENTIFIER { }
|
||||
qualifiedname : name DOT IDENTIFIER { BinaryOperation NameResolution $1 (Reference $3) }
|
||||
|
||||
simplename : IDENTIFIER { $1 }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user