Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 51ec64d

Browse files
JamesHenrynzakas
authored andcommittedOct 29, 2016
Fix: Exclude TSNode.flags when deeplyCopy fallback is used (refs #105) (#107)
1 parent 7ebf4d5 commit 51ec64d

9 files changed

+7
-23
lines changed
 

‎lib/ast-converter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ module.exports = function(ast, extra) {
589589
function deeplyCopy() {
590590
result.type = "TS" + SyntaxKind[node.kind];
591591
Object.keys(node).filter(function(key) {
592-
return !(/^(?:kind|parent|pos|end)$/.test(key));
592+
return !(/^(?:kind|parent|pos|end|flags)$/.test(key));
593593
}).forEach(function(key) {
594594
if (key === "type") {
595595
result.typeAnnotation = convertTypeAnnotation(node.type);

‎tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ module.exports = {
140140
"column": 44
141141
}
142142
},
143-
"flags": 0,
144143
"typeName": {
145144
"type": "Identifier",
146145
"range": [
@@ -175,8 +174,7 @@ module.exports = {
175174
"line": 2,
176175
"column": 43
177176
}
178-
},
179-
"flags": 0
177+
}
180178
}
181179
]
182180
}

‎tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ module.exports = {
110110
],
111111
"type": "TypeAnnotation",
112112
"typeAnnotation": {
113-
"flags": 0,
114113
"loc": {
115114
"end": {
116115
"column": 12,

‎tests/fixtures/typescript/basics/declare-function.result.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ module.exports = {
103103
"line": 1,
104104
"column": 41
105105
}
106-
},
107-
"flags": 0
106+
}
108107
}
109108
}
110109
}

‎tests/fixtures/typescript/basics/declare-namespace-with-exported-function.result.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ module.exports = {
3131
"column": 1
3232
}
3333
},
34-
"flags": 65540,
3534
"modifiers": [
3635
{
3736
"type": "TSDeclareKeyword",
@@ -48,8 +47,7 @@ module.exports = {
4847
"line": 1,
4948
"column": 7
5049
}
51-
},
52-
"flags": 0
50+
}
5351
}
5452
],
5553
"name": {
@@ -86,7 +84,6 @@ module.exports = {
8684
"column": 1
8785
}
8886
},
89-
"flags": 0,
9087
"statements": [
9188
{
9289
"type": "TSNamespaceExportDeclaration",
@@ -179,7 +176,6 @@ module.exports = {
179176
"column": 58
180177
}
181178
},
182-
"flags": 0,
183179
"typeName": {
184180
"type": "Identifier",
185181
"range": [
@@ -214,8 +210,7 @@ module.exports = {
214210
"line": 2,
215211
"column": 57
216212
}
217-
},
218-
"flags": 0
213+
}
219214
}
220215
]
221216
}

‎tests/fixtures/typescript/basics/function-with-type-parameters.result.js

-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ module.exports = {
164164
],
165165
"type": "TypeAnnotation",
166166
"typeAnnotation": {
167-
"flags": 0,
168167
"loc": {
169168
"end": {
170169
"column": 22,

‎tests/fixtures/typescript/basics/function-with-types.result.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ module.exports = {
156156
"line": 1,
157157
"column": 36
158158
}
159-
},
160-
"flags": 0
159+
}
161160
}
162161
}
163162
}

‎tests/fixtures/typescript/basics/type-alias-declaration.result.js

-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ module.exports = {
9191
"type": "TypeParameterDeclaration"
9292
},
9393
"init": {
94-
"flags": 0,
9594
"loc": {
9695
"end": {
9796
"column": 37,
@@ -109,7 +108,6 @@ module.exports = {
109108
"type": "TSUnionType",
110109
"types": [
111110
{
112-
"flags": 0,
113111
"loc": {
114112
"end": {
115113
"column": 27,
@@ -127,7 +125,6 @@ module.exports = {
127125
"type": "TSTypeReference",
128126
"typeArguments": [
129127
{
130-
"flags": 0,
131128
"loc": {
132129
"end": {
133130
"column": 26,
@@ -183,7 +180,6 @@ module.exports = {
183180
}
184181
},
185182
{
186-
"flags": 0,
187183
"loc": {
188184
"end": {
189185
"column": 37,

‎tests/fixtures/typescript/basics/var-with-type.result.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ module.exports = {
9696
"line": 1,
9797
"column": 15
9898
}
99-
},
100-
"flags": 0
99+
}
101100
}
102101
}
103102
},

0 commit comments

Comments
 (0)
This repository has been archived.