Skip to content

Commit

Permalink
Merge pull request #28 from crossoverJie/27-fix-int-a
Browse files Browse the repository at this point in the history
  • Loading branch information
crossoverJie authored Nov 8, 2022
2 parents 0b893f2 + 0e32d80 commit db5c25f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,13 @@ println(dumpAST(code));
`
NewCompiler().Compiler(script)
}
func TestInit(t *testing.T) {
script := `
int a;
println(a);
`
NewCompiler().Compiler(script)
}

func TestNativeReturn(t *testing.T) {
s := testReturn()
Expand Down
3 changes: 3 additions & 0 deletions resolver/ref_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ func (s *RefResolver) ExitBlockStms(ctx *parser.BlockStmsContext) {
if !ok {
continue
}
if variableDeclaratorContext.VariableInitializer() == nil {
continue
}
initializerContext := variableDeclaratorContext.VariableInitializer().(*parser.VariableInitializerContext)
exprContext, ok := initializerContext.Expr().(*parser.ExprContext)
if !ok {
Expand Down

0 comments on commit db5c25f

Please sign in to comment.