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