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:
@@ -1,2 +1,4 @@
|
||||
super.foo // expect error
|
||||
super // expect error
|
||||
super.foo("bar") // expect error
|
||||
super("foo") // expect error
|
||||
|
||||
Reference in New Issue
Block a user