mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-14 17:27:59 -05:00
Allow imported module members to be named default
This commit is contained in:
@@ -372,6 +372,8 @@ grammar =
|
||||
ImportSpecifier: [
|
||||
o 'Identifier', -> new ImportSpecifier $1
|
||||
o 'Identifier AS Identifier', -> new ImportSpecifier $1, $3
|
||||
o 'DEFAULT', -> new ImportSpecifier new Literal $1
|
||||
o 'DEFAULT AS Identifier', -> new ImportSpecifier new Literal($1), $3
|
||||
]
|
||||
|
||||
ImportDefaultSpecifier: [
|
||||
@@ -409,6 +411,7 @@ grammar =
|
||||
o 'Identifier', -> new ExportSpecifier $1
|
||||
o 'Identifier AS Identifier', -> new ExportSpecifier $1, $3
|
||||
o 'Identifier AS DEFAULT', -> new ExportSpecifier $1, new Literal $3
|
||||
o 'DEFAULT', -> new ExportSpecifier new Literal $1
|
||||
]
|
||||
|
||||
# Ordinary function invocation, or a chained series of calls.
|
||||
|
||||
@@ -121,7 +121,7 @@ exports.Lexer = class Lexer
|
||||
@tokens[@tokens.length - 1][0] = 'IMPORT_ALL'
|
||||
else if @value() in COFFEE_KEYWORDS
|
||||
@tokens[@tokens.length - 1][0] = 'IDENTIFIER'
|
||||
if @tag() in ['IMPORT_ALL', 'IDENTIFIER']
|
||||
if @tag() in ['DEFAULT', 'IMPORT_ALL', 'IDENTIFIER']
|
||||
@token 'AS', id
|
||||
return id.length
|
||||
if id is 'as' and @seenExport and @tag() is 'IDENTIFIER'
|
||||
|
||||
Reference in New Issue
Block a user