File tree 5 files changed +10
-4
lines changed
test/Test/Language/Javascript 5 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,8 @@ data JSImportSpecifier
110
110
deriving (Data , Eq , Show , Typeable )
111
111
112
112
data JSExportDeclaration
113
- -- = JSExportAllFrom
114
- = JSExportFrom JSExportClause JSFromClause ! JSSemi -- ^ exports, module, semi
113
+ = JSExportAllFrom ! JSBinOp ! JSFromClause ! JSSemi -- ^ *, module, semi
114
+ | JSExportFrom ! JSExportClause JSFromClause ! JSSemi -- ^ exports, module, semi
115
115
| JSExportLocals JSExportClause ! JSSemi -- ^ exports, autosemi
116
116
| JSExport ! JSStatement ! JSSemi -- ^ body, autosemi
117
117
-- | JSExportDefault
@@ -485,6 +485,7 @@ instance ShowStripped JSImportSpecifier where
485
485
ss (JSImportSpecifierAs x1 _ x2) = " JSImportSpecifierAs (" ++ ss x1 ++ " ," ++ ss x2 ++ " )"
486
486
487
487
instance ShowStripped JSExportDeclaration where
488
+ ss (JSExportAllFrom _ from _) = " JSExportAllFrom (" ++ ss from ++ " )"
488
489
ss (JSExportFrom xs from _) = " JSExportFrom (" ++ ss xs ++ " ," ++ ss from ++ " )"
489
490
ss (JSExportLocals xs _) = " JSExportLocals (" ++ ss xs ++ " )"
490
491
ss (JSExport x1 _) = " JSExport (" ++ ss x1 ++ " )"
Original file line number Diff line number Diff line change @@ -1434,7 +1434,7 @@ ImportSpecifier : IdentifierName
1434
1434
{ AST.JSImportSpecifierAs (identName $1 ) $2 (identName $3 ) }
1435
1435
1436
1436
-- ExportDeclaration : See 15.2.3
1437
- -- [ ] export * FromClause ;
1437
+ -- [x ] export * FromClause ;
1438
1438
-- [x] export ExportClause FromClause ;
1439
1439
-- [x] export ExportClause ;
1440
1440
-- [x] export VariableStatement
@@ -1452,7 +1452,9 @@ ImportSpecifier : IdentifierName
1452
1452
-- [ ] export default ClassDeclaration[Default]
1453
1453
-- [ ] export default [lookahead ∉ { function, class }] AssignmentExpression[In] ;
1454
1454
ExportDeclaration :: { AST.JSExportDeclaration }
1455
- ExportDeclaration : ExportClause FromClause AutoSemi
1455
+ ExportDeclaration : Mul FromClause AutoSemi
1456
+ { AST.JSExportAllFrom $1 $2 $3 {- ' ExportDeclaration0' -} }
1457
+ | ExportClause FromClause AutoSemi
1456
1458
{ AST.JSExportFrom $1 $2 $3 {- ' ExportDeclaration1' -} }
1457
1459
| ExportClause AutoSemi
1458
1460
{ AST.JSExportLocals $1 $2 {- ' ExportDeclaration2' -} }
Original file line number Diff line number Diff line change @@ -332,6 +332,7 @@ instance RenderJS JSExportDeclaration where
332
332
(|>) pacc (JSExport x1 s) = pacc |> x1 |> s
333
333
(|>) pacc (JSExportLocals xs semi) = pacc |> xs |> semi
334
334
(|>) pacc (JSExportFrom xs from semi) = pacc |> xs |> from |> semi
335
+ (|>) pacc (JSExportAllFrom star from semi) = pacc |> star |> from |> semi
335
336
336
337
instance RenderJS JSExportClause where
337
338
(|>) pacc (JSExportClause alb JSLNil arb) = pacc |> alb |> " {" |> arb |> " }"
Original file line number Diff line number Diff line change @@ -326,6 +326,7 @@ instance MinifyJS JSImportSpecifier where
326
326
fix _ (JSImportSpecifierAs x1 _ x2) = JSImportSpecifierAs (fixEmpty x1) spaceAnnot (fixSpace x2)
327
327
328
328
instance MinifyJS JSExportDeclaration where
329
+ fix a (JSExportAllFrom _ from _) = JSExportAllFrom (JSBinOpTimes a) (fix a from) noSemi
329
330
fix a (JSExportFrom x1 from _) = JSExportFrom (fix a x1) (fix a from) noSemi
330
331
fix _ (JSExportLocals x1 _) = JSExportLocals (fix emptyAnnot x1) noSemi
331
332
fix _ (JSExport x1 _) = JSExport (fixStmt spaceAnnot noSemi x1) noSemi
Original file line number Diff line number Diff line change @@ -331,6 +331,7 @@ testMinifyModule = describe "Minify modules:" $ do
331
331
minifyModule " export const a = 1 ; " `shouldBe` " export const a=1"
332
332
minifyModule " export function f () { } ; " `shouldBe` " export function f(){}"
333
333
minifyModule " export function * f () { } ; " `shouldBe` " export function*f(){}"
334
+ minifyModule " export * from \" mod\" ; " `shouldBe` " export*from\" mod\" "
334
335
335
336
-- -----------------------------------------------------------------------------
336
337
-- Minify test helpers.
You can’t perform that action at this time.
0 commit comments