mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 05:41:22 -06:00
Add missing brands to the syntax interfaces.
This commit is contained in:
parent
a9a2fe501a
commit
ba2bdc4124
@ -1134,7 +1134,7 @@ module TypeScript.Parser {
|
||||
return isPropertyName(peekToken(modifierCount + 1), inErrorRecovery);
|
||||
}
|
||||
|
||||
function parseAccessor(checkForStrictMode: boolean): ISyntaxNode {
|
||||
function parseAccessor(checkForStrictMode: boolean): IPropertyAssignmentSyntax {
|
||||
var modifiers = parseModifiers();
|
||||
var _currenToken = currentToken();
|
||||
var tokenKind = _currenToken.kind;
|
||||
|
||||
@ -35,7 +35,7 @@ module TypeScript.PrettyPrinter {
|
||||
return 1;
|
||||
}
|
||||
|
||||
private newLineCountBetweenStatements(element1: IClassElementSyntax, element2: IClassElementSyntax): number {
|
||||
private newLineCountBetweenStatements(element1: IStatementSyntax, element2: IStatementSyntax): number {
|
||||
if (!element1 || !element2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -219,7 +219,7 @@ module TypeScript.Scanner {
|
||||
}
|
||||
|
||||
class FixedWidthTokenWithNoTrivia implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
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;
|
||||
public parent: ISyntaxElement;
|
||||
public childCount: number;
|
||||
|
||||
@ -254,7 +254,7 @@ module TypeScript.Scanner {
|
||||
FixedWidthTokenWithNoTrivia.prototype.childCount = 0;
|
||||
|
||||
class LargeScannerToken implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
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;
|
||||
public parent: ISyntaxElement;
|
||||
public childCount: number;
|
||||
|
||||
|
||||
@ -431,6 +431,7 @@ module TypeScript {
|
||||
}
|
||||
|
||||
export interface IModuleElementSyntax extends ISyntaxNode {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
|
||||
export interface IStatementSyntax extends IModuleElementSyntax {
|
||||
@ -438,15 +439,19 @@ module TypeScript {
|
||||
}
|
||||
|
||||
export interface ITypeMemberSyntax extends ISyntaxNode {
|
||||
_typeMemberBrand: any;
|
||||
}
|
||||
|
||||
export interface IClassElementSyntax extends ISyntaxNode {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
|
||||
export interface IMemberDeclarationSyntax extends IClassElementSyntax {
|
||||
_memberDeclarationBrand: any;
|
||||
}
|
||||
|
||||
export interface IPropertyAssignmentSyntax extends IClassElementSyntax {
|
||||
_propertyAssignmentBrand: any;
|
||||
}
|
||||
|
||||
export interface ISwitchClauseSyntax extends ISyntaxNode {
|
||||
@ -488,5 +493,6 @@ module TypeScript {
|
||||
}
|
||||
|
||||
export interface INameSyntax extends ITypeSyntax {
|
||||
_nameBrand: any;
|
||||
}
|
||||
}
|
||||
@ -1055,54 +1055,6 @@ function getSafeName(child: IMemberDefinition) {
|
||||
return child.name;
|
||||
}
|
||||
|
||||
function generateBrands(definition: ITypeDefinition, accessibility: boolean): string {
|
||||
var properties = "";
|
||||
|
||||
var types: string[] = [];
|
||||
if (definition.interfaces) {
|
||||
var ifaces = definition.interfaces.slice(0);
|
||||
var i: number;
|
||||
for (i = 0; i < ifaces.length; i++) {
|
||||
var current = ifaces[i];
|
||||
|
||||
while (current !== undefined) {
|
||||
if (!TypeScript.ArrayUtilities.contains(ifaces, current)) {
|
||||
ifaces.push(current);
|
||||
}
|
||||
|
||||
current = interfaces[current];
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ifaces.length; i++) {
|
||||
var type = ifaces[i];
|
||||
type = getStringWithoutSuffix(type);
|
||||
if (isInterface(type)) {
|
||||
type = "_" + type.substr(1, 1).toLowerCase() + type.substr(2) + "Brand";
|
||||
}
|
||||
|
||||
types.push(type);
|
||||
}
|
||||
}
|
||||
|
||||
types.push("_syntaxNodeOrTokenBrand");
|
||||
if (types.length > 0) {
|
||||
properties += " ";
|
||||
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (accessibility) {
|
||||
properties += " public ";
|
||||
}
|
||||
|
||||
properties += types[i] + ": any;";
|
||||
}
|
||||
|
||||
properties += "\r\n";
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
function generateConstructorFunction(definition: ITypeDefinition) {
|
||||
var result = " export var " + definition.name + ": " + getNameWithoutSuffix(definition) + "Constructor = <any>function(data: number";
|
||||
|
||||
|
||||
@ -304,7 +304,7 @@ module TypeScript.Syntax {
|
||||
}
|
||||
|
||||
class EmptyToken implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
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;
|
||||
public parent: ISyntaxElement;
|
||||
public childCount: number;
|
||||
|
||||
@ -418,13 +418,14 @@ module TypeScript.Syntax {
|
||||
EmptyToken.prototype.childCount = 0;
|
||||
|
||||
class RealizedToken implements ISyntaxToken {
|
||||
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;
|
||||
|
||||
private _fullStart: number;
|
||||
private _isKeywordConvertedToIdentifier: boolean;
|
||||
private _leadingTrivia: ISyntaxTriviaList;
|
||||
private _text: string;
|
||||
private _trailingTrivia: ISyntaxTriviaList;
|
||||
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
public parent: ISyntaxElement;
|
||||
public childCount: number;
|
||||
|
||||
@ -490,7 +491,8 @@ module TypeScript.Syntax {
|
||||
RealizedToken.prototype.childCount = 0;
|
||||
|
||||
class ConvertedKeywordToken implements ISyntaxToken {
|
||||
public _primaryExpressionBrand: any; public _memberExpressionBrand: any; public _leftHandSideExpressionBrand: any; public _postfixExpressionBrand: any; public _unaryExpressionBrand: any; public _expressionBrand: any; public _typeBrand: any; public _syntaxNodeOrTokenBrand: any;
|
||||
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;
|
||||
|
||||
public parent: ISyntaxElement;
|
||||
public kind: SyntaxKind;
|
||||
public childCount: number;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user