Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57fd515

Browse files
committed
Parse asterisk within import statement
1 parentb70fb59 commit57fd515

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

‎src/grammar.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ grammar =
364364
ImportSpecifier: [
365365
o'Identifier'
366366
o'Identifier IMPORT_AS Identifier',->newImportSpecifier $1, $3
367-
o'* IMPORT_AS Identifier',->newImportSpecifier{value:'*'}, $3
367+
o'IMPORT_ALL IMPORT_AS Identifier',->newImportSpecifiernull, $3
368368
]
369369

370370
NamedImports: [

‎src/lexer.coffee

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ exports.Lexer = class Lexer
448448
if valueis';'
449449
@seenFor=@seenImport=@seenExport=no
450450
tag='TERMINATOR'
451+
elseif valueis'*'and (@seenImportor@seenExport)
452+
tag='IMPORT_ALL'
451453
elseif valuein MATHthentag='MATH'
452454
elseif valuein COMPAREthentag='COMPARE'
453455
elseif valuein COMPOUND_ASSIGNthentag='COMPOUND_ASSIGN'

‎src/nodes.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ exports.ImportSpecifier = class ImportSpecifier extends Base
12851285
children: ['original','alias']
12861286

12871287
compileNode: (o)->
1288-
return [@makeCode("#{@original.value} as#{@alias.value}")]
1288+
return [@makeCode("#{if@original?then@original.valueelse'*'} as#{@alias.value}")]
12891289

12901290
#### Assign
12911291

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp