File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
src/Language/JavaScript/Parser
test/Test/Language/Javascript Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1262,6 +1262,15 @@ ImportSpecifier : IdentifierName
1262
1262
-- [x] export ExportClause ;
1263
1263
-- [x] export VariableStatement
1264
1264
-- [ ] export Declaration
1265
+ -- [ ] Declaration :
1266
+ -- [ ] HoistableDeclaration
1267
+ -- [ ] ClassDeclaration
1268
+ -- [x] LexicalDeclaration
1269
+ -- [ ] HoistableDeclaration :
1270
+ -- [x] FunctionDeclaration
1271
+ -- [ ] GeneratorDeclaration
1272
+ -- [ ] AsyncFunctionDeclaration
1273
+ -- [ ] AsyncGeneratorDeclaration
1265
1274
-- [ ] export default HoistableDeclaration[Default]
1266
1275
-- [ ] export default ClassDeclaration[Default]
1267
1276
-- [ ] export default [lookahead ∉ { function, class }] AssignmentExpression[In] ;
@@ -1270,6 +1279,8 @@ ExportDeclaration : ExportClause AutoSemi
1270
1279
{ $1 {- ' ExportDeclaration1' -} }
1271
1280
| VariableStatement AutoSemi
1272
1281
{ AST.JSExport $1 $2 {- ' ExportDeclaration2' -} }
1282
+ | FunctionDeclaration AutoSemi
1283
+ { AST.JSExport $1 $2 {- ' ExportDeclaration2' -} }
1273
1284
1274
1285
-- ExportClause :
1275
1286
-- { }
Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ testModuleParser = describe "Parse modules:" $ do
47
47
test " export const a = 1;"
48
48
`shouldBe`
49
49
" Right (JSAstModule [JSModuleExportDeclaration (JSExport (JSConstant (JSVarInitExpression (JSIdentifier 'a') [JSDecimal '1'])))])"
50
+ test " export function f() {};"
51
+ `shouldBe`
52
+ " Right (JSAstModule [JSModuleExportDeclaration (JSExport (JSFunction 'f' () (JSBlock [])))])"
50
53
test " export { a };"
51
54
`shouldBe`
52
55
" Right (JSAstModule [JSModuleExportDeclaration (JSExportLocals ((JSExportLocalSpecifier (JSIdentifier 'a'))))])"
You can’t perform that action at this time.
0 commit comments