feat: add compile-time error for 'super' used outside method context
Add isInsideMethod helper that walks the compiler's parent chain to detect if the current compilation scope is within a method. Use it in super_() to emit a compile error when 'super' is used at top level or inside a top-level function, with corresponding test cases for both scenarios.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
super.foo // expect error
|
||||
@@ -0,0 +1,3 @@
|
||||
fn {
|
||||
super.foo // expect error
|
||||
}
|
||||
Reference in New Issue
Block a user