Comments (25)
by the way, there is no version of esprima at the moment that follows estree, the harmony branch is old and master is expected to merge https://github.com/eslint/espree changes soon according to comments on Freenode's IRC channel #esprima
from escope.
related: #33
from escope.
and the proper esprima issue might be this one: jquery/esprima#1000
from escope.
Yeah, Espree is the first parser to implement the ESTree representation of ES6 modules.
from escope.
estraverse
, esrecurse
are now upgraded to suppert those types :)
So next is escope
:D
from escope.
Yay!
from escope.
if replaced with espree, lines such as this one https://github.com/estools/escope/blob/master/src/referencer.js#L117 must be updated to use node.local instead of node.id
from escope.
one possible fix to this bug:
diff --git a/package.json b/package.json
index f9ea500..9b45783 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"browserify": "^9.0.3",
"chai": "^2.1.1",
"coffee-script": "^1.9.1",
+ "espree": "^1.11.0",
"esprima": "~1.2.2",
"gulp": "~3.8.10",
"gulp-babel": "^4.0.0",
diff --git a/src/referencer.js b/src/referencer.js
index 7b592ce..a237e43 100644
--- a/src/referencer.js
+++ b/src/referencer.js
@@ -108,20 +108,20 @@ class Importer extends esrecurse.Visitor {
}
ImportNamespaceSpecifier(node) {
- if (node.id) {
- this.visitImport(node.id, node);
+ if (node.local) {
+ this.visitImport(node.local, node);
}
}
ImportDefaultSpecifier(node) {
- this.visitImport(node.id, node);
+ this.visitImport(node.local, node);
}
ImportSpecifier(node) {
if (node.name) {
this.visitImport(node.name, node);
} else {
- this.visitImport(node.id, node);
+ this.visitImport(node.local, node);
}
}
}
diff --git a/test/es6-import.coffee b/test/es6-import.coffee
index 11d8a6b..6e524b3 100644
--- a/test/es6-import.coffee
+++ b/test/es6-import.coffee
@@ -22,7 +22,7 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
expect = require('chai').expect
-harmony = require '../third_party/esprima'
+harmony = require 'espree'
escope = require '..'
describe 'import declaration', ->
from escope.
It would probably be easier to replace node.id
with node.local || node.id
from escope.
true, here is a pull request: #52
from escope.
Other nodes, (exportXXX should be handled).
from escope.
@Constellation do you have a plan to release this fix?
from escope.
What do you think of updating the major number with these ES6 commits?
from escope.
@Constellation it will be more difficult for me personally, because I will be wait for eslint update (this issue is critical for me).
But we must do it, if we change the API. But maybe it is only a fix, because new behaviour was expected from current API?
from escope.
It looks like these changes are backwards compatible, so I don't think a major version bump is necessary.
from escope.
Ah, my concern is that, to align to estree that is actively developed, we will need to change/add/drop many nodes. So I'm worrying about that backporting becomes difficult.
Maybe, this change can be easily ported to 2.0.x. So I'll pick it to 2.0.x now :)
from escope.
Oh yeah, I was just thinking about the changes for this issue, specifically. With all the node changes, it's probably best to do a major version bump.
from escope.
And I'll pick super
support and I'll publish it as 2.0.7
soon! :D
from escope.
Awesome!
from escope.
Released as 2.0.7
:)
from escope.
Thanks!
from escope.
@Constellation I'm not sure what happened, but 2.0.7 seems to have a regression related to AssignmentPattern
. See: eslint/eslint#2001
from escope.
Ah, current escope is locked with estraverse 1.9.x
because there's no exportxxx node support in estree.
We need to implement all ExportXXX node before updating estraverse to 2.0.x
.
from escope.
Maybe, to support ExportXXX, only modifying ExportSpecifier
is sufficient I think.
I'll create a patch and update the estraverse contained in escope
.
from escope.
AssignmentPattern
is done in b713c53.
This is initial support of AssignmentPattern and TDZ scope issue is not fixed yet.
from escope.
Related Issues (20)
- Function Expression
- Error on ImportDeclaration HOT 1
- Update scope manager scopes once it was created HOT 2
- Add support for label scoping
- New escope-demo (not a bug)
- Add node.body check before attempting to vist children HOT 8
- Variables from global scope have empty references array
- Drop `es6-map`. HOT 1
- Function scope arguments variable HOT 1
- Drop using require'd assert in favour of just throwing an error
- Enter the version directly in index.js
- Problem with unused library functions
- let declaration treated as var declaration HOT 1
- Can't locate variable within named function's scope when function assigned to other variable HOT 4
- Function declarations attached to block scope? HOT 1
- Another version of escope HOT 1
- what does 'through' in escope mean? HOT 1
- Maybe i find a bug in escope ?
- Is ES6 parameter scope not supported? HOT 1
- JSDoc unavailable: 404 error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from escope.