Attach filename property to node.loc when provided.

This commit is contained in:
Dale Bustad
2016-02-29 11:19:33 -08:00
parent aca8010438
commit bb4919500c
7 changed files with 123 additions and 3 deletions

View File

@@ -0,0 +1 @@
var node = "shouldHaveFilenameLocProp";

View File

@@ -0,0 +1,109 @@
{
"type": "File",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
},
"filename": "path/to/input-file.js"
},
"program": {
"type": "Program",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
},
"filename": "path/to/input-file.js"
},
"sourceType": "script",
"body": [
{
"type": "VariableDeclaration",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 39
},
"filename": "path/to/input-file.js"
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 4,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 38
},
"filename": "path/to/input-file.js"
},
"id": {
"type": "Identifier",
"start": 4,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 8
},
"filename": "path/to/input-file.js"
},
"name": "node"
},
"init": {
"type": "StringLiteral",
"start": 11,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 38
},
"filename": "path/to/input-file.js"
},
"extra": {
"rawValue": "shouldHaveFilenameLocProp",
"raw": "\"shouldHaveFilenameLocProp\""
},
"value": "shouldHaveFilenameLocProp"
}
}
],
"kind": "var"
}
],
"directives": []
}
}

View File

@@ -0,0 +1,3 @@
{
"sourceFilename": "path/to/input-file.js"
}