Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix body-less functions and namespaces
1) Move this.scope.exit() for functions from parseFunctionBody to the callers. Otherwise the scope of body-less functions was never closed. Also, it is easier to track scope.exit() if it is near to scope.enter() 2) Register namespace ids for export
- Loading branch information
1 parent
c2428b0
commit 7274ca1
Showing
8 changed files
with
247 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/typescript/scope/export-namespace/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace N {} | ||
|
||
export { N }; |
151 changes: 151 additions & 0 deletions
151
packages/babel-parser/test/fixtures/typescript/scope/export-namespace/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 29, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 13 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 29, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 13 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSModuleDeclaration", | ||
"start": 0, | ||
"end": 14, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 14 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 10, | ||
"end": 11, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 10 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 11 | ||
}, | ||
"identifierName": "N" | ||
}, | ||
"name": "N" | ||
}, | ||
"body": { | ||
"type": "TSModuleBlock", | ||
"start": 12, | ||
"end": 14, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 12 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 14 | ||
} | ||
}, | ||
"body": [] | ||
} | ||
}, | ||
{ | ||
"type": "ExportNamedDeclaration", | ||
"start": 16, | ||
"end": 29, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 13 | ||
} | ||
}, | ||
"specifiers": [ | ||
{ | ||
"type": "ExportSpecifier", | ||
"start": 25, | ||
"end": 26, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 10 | ||
} | ||
}, | ||
"local": { | ||
"type": "Identifier", | ||
"start": 25, | ||
"end": 26, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 10 | ||
}, | ||
"identifierName": "N" | ||
}, | ||
"name": "N" | ||
}, | ||
"exported": { | ||
"type": "Identifier", | ||
"start": 25, | ||
"end": 26, | ||
"loc": { | ||
"start": { | ||
"line": 3, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"column": 10 | ||
}, | ||
"identifierName": "N" | ||
}, | ||
"name": "N" | ||
} | ||
} | ||
], | ||
"source": null, | ||
"declaration": null | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
Oops, something went wrong.