Add missing kind specifiers

The prior checkin failed to place kind specifiers on the token AST nodes.
I'm surprised TypeScript let this fly.
This commit is contained in:
joeduffy 2017-01-21 12:08:44 -08:00
parent 4dc082a2df
commit bbdc18652c
11 changed files with 44 additions and 7 deletions

View file

@ -436,7 +436,8 @@ export class Transformer {
let ty: ts.Type = this.checker().getTypeAtLocation(node);
contract.assert(!!ty);
return this.withLocation(node, <ast.TypeToken>{
tok: this.resolveTypeToken(ty),
kind: ast.typeTokenKind,
tok: this.resolveTypeToken(ty),
});
}
@ -618,7 +619,8 @@ export class Transformer {
name: name,
access: symbols.publicAccessibility,
referent: this.withLocation(exportClause.propertyName, <ast.Token>{
tok: this.createModuleMemberToken(sourceModule, propertyName.ident),
kind: ast.tokenKind,
tok: this.createModuleMemberToken(sourceModule, propertyName.ident),
}),
}));
}
@ -631,7 +633,8 @@ export class Transformer {
name: name,
access: symbols.publicAccessibility,
referent: this.withLocation(exportClause.name, <ast.Token>{
tok: this.createModuleMemberToken(sourceModule, name.ident),
kind: ast.tokenKind,
tok: this.createModuleMemberToken(sourceModule, name.ident),
}),
}));
}
@ -656,7 +659,8 @@ export class Transformer {
name: name,
access: symbols.publicAccessibility,
referent: this.withLocation(exportClause, <ast.Token>{
tok: this.createModuleToken(otherModule!),
kind: ast.tokenKind,
tok: this.createModuleToken(otherModule!),
}),
}));
}
@ -680,7 +684,8 @@ export class Transformer {
},
access: symbols.publicAccessibility,
referent: this.withLocation(node, <ast.Token>{
tok: name,
kind: ast.tokenKind,
tok: name,
}),
}));
}
@ -699,7 +704,8 @@ export class Transformer {
let importModule: ModuleReference =
this.resolveModuleReferenceByName((<ts.StringLiteral>node.moduleSpecifier).text);
let importModuleToken: ast.ModuleToken = this.withLocation(node.moduleSpecifier, <ast.ModuleToken>{
tok: this.createModuleToken(importModule),
kind: ast.moduleTokenKind,
tok: this.createModuleToken(importModule),
});
// Figure out what kind of import statement this is (there are many, see below).
@ -1829,7 +1835,8 @@ export class Transformer {
if (node.expression.kind === ts.SyntaxKind.Identifier) {
let ident: ast.Identifier = this.transformIdentifier(<ts.Identifier>node.expression);
ty = this.withLocation(node.expression, <ast.TypeToken>{
tok: ident.ident,
kind: ast.typeTokenKind,
tok: ident.ident,
});
}
else {

View file

@ -92,6 +92,7 @@
},
"access": "public",
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "other.ts",
@ -203,6 +204,7 @@
},
"imports": [
{
"kind": "ModuleToken",
"tok": "other",
"loc": {
"file": "index.ts",
@ -237,6 +239,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other",
"loc": {
"file": "index.ts",
@ -345,6 +348,7 @@
},
"access": "public",
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",

View file

@ -46,6 +46,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",
@ -78,6 +79,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "string",
"loc": {
"file": "index.ts",

View file

@ -46,6 +46,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",
@ -78,6 +79,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "string",
"loc": {
"file": "index.ts",

View file

@ -35,6 +35,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",
@ -67,6 +68,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "string",
"loc": {
"file": "index.ts",

View file

@ -92,6 +92,7 @@
},
"access": "public",
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "other.ts",
@ -222,6 +223,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:C",
"loc": {
"file": "index.ts",
@ -266,6 +268,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:I",
"loc": {
"file": "index.ts",
@ -310,6 +313,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:v",
"loc": {
"file": "index.ts",

View file

@ -92,6 +92,7 @@
},
"access": "public",
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "other.ts",
@ -211,6 +212,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:C",
"loc": {
"file": "index.ts",
@ -244,6 +246,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:I",
"loc": {
"file": "index.ts",
@ -277,6 +280,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:v",
"loc": {
"file": "index.ts",

View file

@ -92,6 +92,7 @@
},
"access": "public",
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "other.ts",
@ -222,6 +223,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:C",
"loc": {
"file": "index.ts",
@ -266,6 +268,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:I",
"loc": {
"file": "index.ts",
@ -310,6 +313,7 @@
},
"access": "public",
"referent": {
"kind": "Token",
"tok": "other:v",
"loc": {
"file": "index.ts",

View file

@ -28,6 +28,7 @@
},
"access": "private",
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",

View file

@ -28,6 +28,7 @@
},
"access": "public",
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",

View file

@ -54,6 +54,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",
@ -86,6 +87,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",
@ -378,6 +380,7 @@
}
},
"type": {
"kind": "TypeToken",
"tok": "Point",
"loc": {
"file": "index.ts",
@ -401,6 +404,7 @@
"expression": {
"kind": "NewExpression",
"type": {
"kind": "TypeToken",
"tok": "Point",
"loc": {
"file": "index.ts",
@ -729,6 +733,7 @@
"readonly": true,
"static": false,
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",
@ -764,6 +769,7 @@
"readonly": true,
"static": false,
"type": {
"kind": "TypeToken",
"tok": "number",
"loc": {
"file": "index.ts",