fix: allow compiler to continue after super used outside method body

Previously, when `super` was used at the top level or outside any method, the compiler would error but still attempt to read `enclosingClass->methodLength` and `enclosingClass->methodName` from a NULL pointer, leading to undefined behavior. This restructures the error handling in `super_()` to always call `loadThis()` and guard the unnamed super call path with a NULL check on `enclosingClass`, setting an empty method signature when no enclosing class exists. Two additional test cases for `super.foo("bar")` and `super("foo")` are added to verify the compiler continues past the error without crashing.
This commit is contained in:
Kyle Marek-Spartz
2015-01-11 23:43:51 +00:00
parent dd0760a54c
commit 1175d93efa
2 changed files with 28 additions and 18 deletions
+2
View File
@@ -1,2 +1,4 @@
super.foo // expect error
super // expect error
super.foo("bar") // expect error
super("foo") // expect error