Commit fefba6f
committed
Forbid implicit global functions and classes by default
Declaring functions and classes in 'this'/root considered harmful.
In future we want to make function and class declarations local, but
since this is a breaking change, first let's forbid implicit global
functions and classes in compiler and when all projects are proved
to be working, the change in language can be made.
For now, if old behavior is needed, use #allow-func-decl-sugar and
Old behavior:
function foo() {}
// this is equivalent to
this["foo"] <- function foo() {}
Behavior with this commit:
function foo() {} // compilation error
Future planned behavior:
function foo() {}
// equivalent to
let function foo() {}
// this also mean 'let function name' and 'local function name'
// support may be also removed1 parent c0a0949 commit fefba6f
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
0 commit comments