Skip to content

Commit 6b27e23

Browse files
committed
from doesn’t need to be a reserved word; when not part of an import or export statement, it can still be assigned
1 parent b211a51 commit 6b27e23

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/lexer.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ JS_KEYWORDS = [
796796
'return', 'throw', 'break', 'continue', 'debugger', 'yield'
797797
'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally'
798798
'class', 'extends', 'super'
799-
'export', 'import', 'from', 'default'
799+
'import', 'export', 'default'
800800
]
801801

802802
# CoffeeScript-only keywords.

test/modules.coffee

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,14 @@ test "export as aliases members imported from another module", ->
275275
baz as qux
276276
} from 'lib';"""
277277
eq toJS(input), output
278+
279+
280+
# Edge cases
281+
282+
test "`from` not part of an import or export statement can still be assigned", ->
283+
input = "from = yes"
284+
output = """
285+
var from;
286+
287+
from = true;"""
288+
eq toJS(input), output

0 commit comments

Comments
 (0)