Skip to content

Commit

Permalink
[Breaking Change] Change ExportSpecifier interface
Browse files Browse the repository at this point in the history
To follow the estree spec, id / name are replaced with local / exported.
  • Loading branch information
Constellation committed Mar 8, 2015
1 parent 24a4693 commit c232b46
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion estraverse.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
ExportBatchSpecifier: [],
ExportDeclaration: ['declaration', 'specifiers', 'source'],
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
ExportSpecifier: ['id', 'name'],
ExportSpecifier: ['exported', 'local'],
ExpressionStatement: ['expression'],
ForStatement: ['init', 'test', 'update', 'body'],
ForInStatement: ['left', 'right', 'body'],
Expand Down
34 changes: 34 additions & 0 deletions test/es6.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,38 @@ describe 'export', ->
leave - ExportNamedDeclaration
"""

it 'named declaration #1', ->
tree =
type: 'ExportNamedDeclaration'
declaration: null
specifiers: [{
type: 'ExportSpecifier',
exported: {
type: 'Identifier',
name: 'foo'
}
local: {
type: 'Identifier',
name: 'bar'
}

}]
source: {
type: 'Literal',
value: 'hello'
}

expect(Dumper.dump(tree)).to.be.equal """
enter - ExportNamedDeclaration
enter - ExportSpecifier
enter - Identifier
leave - Identifier
enter - Identifier
leave - Identifier
leave - ExportSpecifier
enter - Literal
leave - Literal
leave - ExportNamedDeclaration
"""

# vim: set sw=4 ts=4 et tw=80 :

0 comments on commit c232b46

Please sign in to comment.