Skip to content

Commit ba2bdc4

Browse files
Add missing brands to the syntax interfaces.
1 parent a9a2fe5 commit ba2bdc4

File tree

6 files changed

+15
-55
lines changed

6 files changed

+15
-55
lines changed

src/services/syntax/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ module TypeScript.Parser {
11341134
return isPropertyName(peekToken(modifierCount + 1), inErrorRecovery);
11351135
}
11361136

1137-
function parseAccessor(checkForStrictMode: boolean): ISyntaxNode {
1137+
function parseAccessor(checkForStrictMode: boolean): IPropertyAssignmentSyntax {
11381138
var modifiers = parseModifiers();
11391139
var _currenToken = currentToken();
11401140
var tokenKind = _currenToken.kind;

src/services/syntax/prettyPrinter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module TypeScript.PrettyPrinter {
3535
return 1;
3636
}
3737

38-
private newLineCountBetweenStatements(element1: IClassElementSyntax, element2: IClassElementSyntax): number {
38+
private newLineCountBetweenStatements(element1: IStatementSyntax, element2: IStatementSyntax): number {
3939
if (!element1 || !element2) {
4040
return 0;
4141
}

src/services/syntax/scanner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ module TypeScript.Scanner {
219219
}
220220

221221
class FixedWidthTokenWithNoTrivia implements ISyntaxToken {
222-
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
222+
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _nameBrand: any; public _syntaxNodeOrTokenBrand: any;
223223
public parent: ISyntaxElement;
224224
public childCount: number;
225225

@@ -254,7 +254,7 @@ module TypeScript.Scanner {
254254
FixedWidthTokenWithNoTrivia.prototype.childCount = 0;
255255

256256
class LargeScannerToken implements ISyntaxToken {
257-
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
257+
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _nameBrand: any; public _syntaxNodeOrTokenBrand: any;
258258
public parent: ISyntaxElement;
259259
public childCount: number;
260260

src/services/syntax/syntaxElement.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,22 +431,27 @@ module TypeScript {
431431
}
432432

433433
export interface IModuleElementSyntax extends ISyntaxNode {
434+
_moduleElementBrand: any;
434435
}
435436

436437
export interface IStatementSyntax extends IModuleElementSyntax {
437438
_statementBrand: any;
438439
}
439440

440441
export interface ITypeMemberSyntax extends ISyntaxNode {
442+
_typeMemberBrand: any;
441443
}
442444

443445
export interface IClassElementSyntax extends ISyntaxNode {
446+
_classElementBrand: any;
444447
}
445448

446449
export interface IMemberDeclarationSyntax extends IClassElementSyntax {
450+
_memberDeclarationBrand: any;
447451
}
448452

449453
export interface IPropertyAssignmentSyntax extends IClassElementSyntax {
454+
_propertyAssignmentBrand: any;
450455
}
451456

452457
export interface ISwitchClauseSyntax extends ISyntaxNode {
@@ -488,5 +493,6 @@ module TypeScript {
488493
}
489494

490495
export interface INameSyntax extends ITypeSyntax {
496+
_nameBrand: any;
491497
}
492498
}

src/services/syntax/syntaxGenerator.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,54 +1055,6 @@ function getSafeName(child: IMemberDefinition) {
10551055
return child.name;
10561056
}
10571057

1058-
function generateBrands(definition: ITypeDefinition, accessibility: boolean): string {
1059-
var properties = "";
1060-
1061-
var types: string[] = [];
1062-
if (definition.interfaces) {
1063-
var ifaces = definition.interfaces.slice(0);
1064-
var i: number;
1065-
for (i = 0; i < ifaces.length; i++) {
1066-
var current = ifaces[i];
1067-
1068-
while (current !== undefined) {
1069-
if (!TypeScript.ArrayUtilities.contains(ifaces, current)) {
1070-
ifaces.push(current);
1071-
}
1072-
1073-
current = interfaces[current];
1074-
}
1075-
}
1076-
1077-
for (i = 0; i < ifaces.length; i++) {
1078-
var type = ifaces[i];
1079-
type = getStringWithoutSuffix(type);
1080-
if (isInterface(type)) {
1081-
type = "_" + type.substr(1, 1).toLowerCase() + type.substr(2) + "Brand";
1082-
}
1083-
1084-
types.push(type);
1085-
}
1086-
}
1087-
1088-
types.push("_syntaxNodeOrTokenBrand");
1089-
if (types.length > 0) {
1090-
properties += " ";
1091-
1092-
for (var i = 0; i < types.length; i++) {
1093-
if (accessibility) {
1094-
properties += " public ";
1095-
}
1096-
1097-
properties += types[i] + ": any;";
1098-
}
1099-
1100-
properties += "\r\n";
1101-
}
1102-
1103-
return properties;
1104-
}
1105-
11061058
function generateConstructorFunction(definition: ITypeDefinition) {
11071059
var result = " export var " + definition.name + ": " + getNameWithoutSuffix(definition) + "Constructor = <any>function(data: number";
11081060

src/services/syntax/syntaxToken.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ module TypeScript.Syntax {
304304
}
305305

306306
class EmptyToken implements ISyntaxToken {
307-
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
307+
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _nameBrand: any; public _syntaxNodeOrTokenBrand: any;
308308
public parent: ISyntaxElement;
309309
public childCount: number;
310310

@@ -418,13 +418,14 @@ module TypeScript.Syntax {
418418
EmptyToken.prototype.childCount = 0;
419419

420420
class RealizedToken implements ISyntaxToken {
421+
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _nameBrand: any; public _syntaxNodeOrTokenBrand: any;
422+
421423
private _fullStart: number;
422424
private _isKeywordConvertedToIdentifier: boolean;
423425
private _leadingTrivia: ISyntaxTriviaList;
424426
private _text: string;
425427
private _trailingTrivia: ISyntaxTriviaList;
426428

427-
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
428429
public parent: ISyntaxElement;
429430
public childCount: number;
430431

@@ -490,7 +491,8 @@ module TypeScript.Syntax {
490491
RealizedToken.prototype.childCount = 0;
491492

492493
class ConvertedKeywordToken implements ISyntaxToken {
493-
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
494+
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _nameBrand: any; public _syntaxNodeOrTokenBrand: any;
495+
494496
public parent: ISyntaxElement;
495497
public kind: SyntaxKind;
496498
public childCount: number;

0 commit comments

Comments
 (0)