-
-
Notifications
You must be signed in to change notification settings - Fork 215
Closed
Description
// espree 3.4.3
require('espree').parse('/* foo */ bar /* baz */', { range: true })
Output
{
"type": "Program",
"start": 0,
"end": 23,
"range": [
10,
13
],
"body": [
{
"type": "ExpressionStatement",
"start": 10,
"end": 13,
"range": [
10,
13
],
"expression": {
"type": "Identifier",
"start": 10,
"end": 13,
"range": [
10,
13
],
"name": "bar"
}
}
],
"sourceType": "script"
}
The Program
node has start: 0
and end: 23
, but its range
is [10, 13]
.
This happens because espree transforms the range
property to match Esprima's behavior. The transformation is correct, but we should also update the start
and end
properties, since they're equivalent in all other cases.