mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Updating syntax kind names.
This commit is contained in:
@@ -279,7 +279,7 @@ module ts {
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
@@ -436,7 +436,7 @@ module ts {
|
||||
case SyntaxKind.TypeLiteral:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.TypeLiteral, "__type", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
bindAnonymousDeclaration(node, SymbolFlags.ObjectLiteral, "__object", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.FunctionExpression:
|
||||
|
||||
+57
-57
@@ -3223,11 +3223,11 @@ module ts {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return !(<FunctionExpression>node).typeParameters && !forEach((<FunctionExpression>node).parameters, p => p.type);
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
return forEach((<ObjectLiteral>node).properties, p =>
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return forEach((<ObjectLiteralExpression>node).properties, p =>
|
||||
p.kind === SyntaxKind.PropertyAssignment && isContextSensitiveExpression((<PropertyDeclaration>p).initializer));
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return forEach((<ArrayLiteral>node).elements, e => isContextSensitiveExpression(e));
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return forEach((<ArrayLiteralExpression>node).elements, e => isContextSensitiveExpression(e));
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return isContextSensitiveExpression((<ConditionalExpression>node).whenTrue) ||
|
||||
isContextSensitiveExpression((<ConditionalExpression>node).whenFalse);
|
||||
@@ -4302,8 +4302,8 @@ module ts {
|
||||
function isAssignedInBinaryExpression(node: BinaryExpression) {
|
||||
if (node.operator >= SyntaxKind.FirstAssignment && node.operator <= SyntaxKind.LastAssignment) {
|
||||
var n = node.left;
|
||||
while (n.kind === SyntaxKind.ParenExpression) {
|
||||
n = (<ParenExpression>n).expression;
|
||||
while (n.kind === SyntaxKind.ParenthesizedExpression) {
|
||||
n = (<ParenthesizedExpression>n).expression;
|
||||
}
|
||||
if (n.kind === SyntaxKind.Identifier && getResolvedSymbol(<Identifier>n) === symbol) {
|
||||
return true;
|
||||
@@ -4325,19 +4325,19 @@ module ts {
|
||||
return isAssignedInBinaryExpression(<BinaryExpression>node);
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return isAssignedInVariableDeclaration(<VariableDeclaration>node);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.VariableStatement:
|
||||
@@ -4496,8 +4496,8 @@ module ts {
|
||||
// Narrow the given type based on the given expression having the assumed boolean value
|
||||
function narrowType(type: Type, expr: Expression, assumeTrue: boolean): Type {
|
||||
switch (expr.kind) {
|
||||
case SyntaxKind.ParenExpression:
|
||||
return narrowType(type, (<ParenExpression>expr).expression, assumeTrue);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return narrowType(type, (<ParenthesizedExpression>expr).expression, assumeTrue);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
var operator = (<BinaryExpression>expr).operator;
|
||||
if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) {
|
||||
@@ -4864,7 +4864,7 @@ module ts {
|
||||
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
|
||||
function getContextualTypeForPropertyExpression(node: Expression): Type {
|
||||
var declaration = <PropertyDeclaration>node.parent;
|
||||
var objectLiteral = <ObjectLiteral>declaration.parent;
|
||||
var objectLiteral = <ObjectLiteralExpression>declaration.parent;
|
||||
var type = getContextualType(objectLiteral);
|
||||
// TODO(jfreeman): Handle this case for computed names and symbols
|
||||
var name = (<Identifier>declaration.name).text;
|
||||
@@ -4880,7 +4880,7 @@ module ts {
|
||||
// the type of the property with the numeric name N in T, if one exists. Otherwise, it is the type of the numeric
|
||||
// index signature in T, if one exists.
|
||||
function getContextualTypeForElementExpression(node: Expression): Type {
|
||||
var arrayLiteral = <ArrayLiteral>node.parent;
|
||||
var arrayLiteral = <ArrayLiteralExpression>node.parent;
|
||||
var type = getContextualType(arrayLiteral);
|
||||
if (type) {
|
||||
var index = indexOf(arrayLiteral.elements, node);
|
||||
@@ -4917,13 +4917,13 @@ module ts {
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
return getContextualTypeForArgument(node);
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return getTypeFromTypeNode((<TypeAssertion>parent).type);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return getContextualTypeForBinaryOperand(node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return getContextualTypeForPropertyExpression(node);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return getContextualTypeForElementExpression(node);
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
return getContextualTypeForConditionalOperand(node);
|
||||
@@ -5000,7 +5000,7 @@ module ts {
|
||||
return mapper && mapper !== identityMapper;
|
||||
}
|
||||
|
||||
function checkArrayLiteral(node: ArrayLiteral, contextualMapper?: TypeMapper): Type {
|
||||
function checkArrayLiteral(node: ArrayLiteralExpression, contextualMapper?: TypeMapper): Type {
|
||||
var elements = node.elements;
|
||||
if (!elements.length) {
|
||||
return createArrayType(undefinedType);
|
||||
@@ -5038,7 +5038,7 @@ module ts {
|
||||
return (+name).toString() === name;
|
||||
}
|
||||
|
||||
function checkObjectLiteral(node: ObjectLiteral, contextualMapper?: TypeMapper): Type {
|
||||
function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type {
|
||||
var members = node.symbol.members;
|
||||
var properties: SymbolTable = {};
|
||||
var contextualType = getContextualType(node);
|
||||
@@ -5115,7 +5115,7 @@ module ts {
|
||||
return s.valueDeclaration ? s.valueDeclaration.flags : s.flags & SymbolFlags.Prototype ? NodeFlags.Public | NodeFlags.Static : 0;
|
||||
}
|
||||
|
||||
function checkClassPropertyAccess(node: PropertyAccess, type: Type, prop: Symbol) {
|
||||
function checkClassPropertyAccess(node: PropertyAccessExpression, type: Type, prop: Symbol) {
|
||||
var flags = getDeclarationFlagsFromSymbol(prop);
|
||||
// Public properties are always accessible
|
||||
if (!(flags & (NodeFlags.Private | NodeFlags.Protected))) {
|
||||
@@ -5153,7 +5153,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkPropertyAccess(node: PropertyAccess) {
|
||||
function checkPropertyAccess(node: PropertyAccessExpression) {
|
||||
var type = checkExpression(node.left);
|
||||
if (type === unknownType) return type;
|
||||
if (type !== anyType) {
|
||||
@@ -5190,7 +5190,7 @@ module ts {
|
||||
return anyType;
|
||||
}
|
||||
|
||||
function isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean {
|
||||
function isValidPropertyAccess(node: PropertyAccessExpression, propertyName: string): boolean {
|
||||
var type = checkExpression(node.left);
|
||||
if (type !== unknownType && type !== anyType) {
|
||||
var prop = getPropertyOfType(getWidenedType(type), propertyName);
|
||||
@@ -6165,7 +6165,7 @@ module ts {
|
||||
// An identifier expression that references a variable or parameter is classified as a reference.
|
||||
// An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment).
|
||||
return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & SymbolFlags.Variable) !== 0;
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
var symbol = findSymbol(n);
|
||||
// TypeScript 1.0 spec (April 2014): 4.10
|
||||
// A property access expression is always classified as a reference.
|
||||
@@ -6174,8 +6174,8 @@ module ts {
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
// old compiler doesn't check indexed assess
|
||||
return true;
|
||||
case SyntaxKind.ParenExpression:
|
||||
return isReferenceOrErrorExpression((<ParenExpression>n).expression);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return isReferenceOrErrorExpression((<ParenthesizedExpression>n).expression);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -6184,7 +6184,7 @@ module ts {
|
||||
function isConstVariableReference(n: Node): boolean {
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
var symbol = findSymbol(n);
|
||||
return symbol && (symbol.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & NodeFlags.Const) !== 0;
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
@@ -6196,8 +6196,8 @@ module ts {
|
||||
return prop && (prop.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(prop) & NodeFlags.Const) !== 0;
|
||||
}
|
||||
return false;
|
||||
case SyntaxKind.ParenExpression:
|
||||
return isConstVariableReference((<ParenExpression>n).expression);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return isConstVariableReference((<ParenthesizedExpression>n).expression);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -6524,7 +6524,7 @@ module ts {
|
||||
// - 'object' in indexed access
|
||||
// - target in rhs of import statement
|
||||
var ok =
|
||||
(node.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.parent).left === node) ||
|
||||
(node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).left === node) ||
|
||||
(node.parent.kind === SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>node.parent).expression === node) ||
|
||||
((node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName) && isInRightSideOfImportOrExportAssignment(<EntityName>node));
|
||||
|
||||
@@ -6559,12 +6559,12 @@ module ts {
|
||||
return globalRegExpType;
|
||||
case SyntaxKind.QualifiedName:
|
||||
return checkPropertyAccess(<QualifiedName>node);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return checkArrayLiteral(<ArrayLiteral>node, contextualMapper);
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
return checkObjectLiteral(<ObjectLiteral>node, contextualMapper);
|
||||
case SyntaxKind.PropertyAccess:
|
||||
return checkPropertyAccess(<PropertyAccess>node);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return checkArrayLiteral(<ArrayLiteralExpression>node, contextualMapper);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return checkObjectLiteral(<ObjectLiteralExpression>node, contextualMapper);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return checkPropertyAccess(<PropertyAccessExpression>node);
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return checkIndexedAccess(<ElementAccessExpression>node);
|
||||
case SyntaxKind.CallExpression:
|
||||
@@ -6572,10 +6572,10 @@ module ts {
|
||||
return checkCallExpression(<CallExpression>node);
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
return checkTaggedTemplateExpression(<TaggedTemplateExpression>node);
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return checkTypeAssertion(<TypeAssertion>node);
|
||||
case SyntaxKind.ParenExpression:
|
||||
return checkExpression((<ParenExpression>node).expression);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return checkExpression((<ParenthesizedExpression>node).expression);
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return checkFunctionExpression(<FunctionExpression>node, contextualMapper);
|
||||
@@ -6587,7 +6587,7 @@ module ts {
|
||||
return checkVoidExpression(<VoidExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
return checkPrefixExpression(<UnaryExpression>node);
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
return checkPostfixExpression(<UnaryExpression>node);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return checkBinaryExpression(<BinaryExpression>node, contextualMapper);
|
||||
@@ -6774,7 +6774,7 @@ module ts {
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.ObjectLiteral: return false;
|
||||
case SyntaxKind.ObjectLiteralExpression: return false;
|
||||
default: return forEachChild(n, containsSuperCall);
|
||||
}
|
||||
}
|
||||
@@ -8136,11 +8136,11 @@ module ts {
|
||||
return undefined;
|
||||
case SyntaxKind.NumericLiteral:
|
||||
return +(<LiteralExpression>e).text;
|
||||
case SyntaxKind.ParenExpression:
|
||||
return enumIsConst ? evalConstant((<ParenExpression>e).expression) : undefined;
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return enumIsConst ? evalConstant((<ParenthesizedExpression>e).expression) : undefined;
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
if (!enumIsConst) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -8165,8 +8165,8 @@ module ts {
|
||||
propertyName = (<LiteralExpression>(<ElementAccessExpression>e).argumentExpression).text;
|
||||
}
|
||||
else {
|
||||
var enumType = getTypeOfNode((<PropertyAccess>e).left);
|
||||
propertyName = (<PropertyAccess>e).right.text;
|
||||
var enumType = getTypeOfNode((<PropertyAccessExpression>e).left);
|
||||
propertyName = (<PropertyAccessExpression>e).right.text;
|
||||
}
|
||||
if (enumType !== currentType) {
|
||||
return undefined;
|
||||
@@ -8487,21 +8487,21 @@ module ts {
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.Property:
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.Block:
|
||||
@@ -8776,7 +8776,7 @@ module ts {
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
return node === (<SignatureDeclaration>parent).type;
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return node === (<TypeAssertion>parent).type;
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
@@ -8806,7 +8806,7 @@ module ts {
|
||||
}
|
||||
|
||||
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) {
|
||||
return (node.parent.kind === SyntaxKind.QualifiedName || node.parent.kind === SyntaxKind.PropertyAccess) &&
|
||||
return (node.parent.kind === SyntaxKind.QualifiedName || node.parent.kind === SyntaxKind.PropertyAccessExpression) &&
|
||||
(<QualifiedName>node.parent).right === node;
|
||||
}
|
||||
|
||||
@@ -8836,7 +8836,7 @@ module ts {
|
||||
var meaning: SymbolFlags = SymbolFlags.Value | SymbolFlags.Import;
|
||||
return resolveEntityName(entityName, entityName, meaning);
|
||||
}
|
||||
else if (entityName.kind === SyntaxKind.QualifiedName || entityName.kind === SyntaxKind.PropertyAccess) {
|
||||
else if (entityName.kind === SyntaxKind.QualifiedName || entityName.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
var symbol = getNodeLinks(entityName).resolvedSymbol;
|
||||
if (!symbol) {
|
||||
checkPropertyAccess(<QualifiedName>entityName);
|
||||
@@ -8879,7 +8879,7 @@ module ts {
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
return getSymbolOfEntityName(<Identifier>node);
|
||||
|
||||
@@ -9160,7 +9160,7 @@ module ts {
|
||||
return getNodeLinks(node).enumMemberValue;
|
||||
}
|
||||
|
||||
function getConstantValue(node: PropertyAccess | ElementAccessExpression): number {
|
||||
function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number {
|
||||
var symbol = getNodeLinks(node).resolvedSymbol;
|
||||
if (symbol && (symbol.flags & SymbolFlags.EnumMember)) {
|
||||
var declaration = symbol.valueDeclaration;
|
||||
|
||||
+23
-23
@@ -1996,7 +1996,7 @@ module ts {
|
||||
// ("abc" + 1) << (2 + "")
|
||||
// rather than
|
||||
// "abc" + (1 << 2) + ""
|
||||
var needsParens = templateSpan.expression.kind !== SyntaxKind.ParenExpression
|
||||
var needsParens = templateSpan.expression.kind !== SyntaxKind.ParenthesizedExpression
|
||||
&& comparePrecedenceToBinaryPlus(templateSpan.expression) !== Comparison.GreaterThan;
|
||||
|
||||
write(" + ");
|
||||
@@ -2028,7 +2028,7 @@ module ts {
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
return (<CallExpression>parent).expression === template;
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return false;
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
Debug.fail("Path should be unreachable; tagged templates not supported pre-ES6.");
|
||||
@@ -2170,7 +2170,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitArrayLiteral(node: ArrayLiteral) {
|
||||
function emitArrayLiteral(node: ArrayLiteralExpression) {
|
||||
if (node.flags & NodeFlags.MultiLine) {
|
||||
write("[");
|
||||
increaseIndent();
|
||||
@@ -2186,7 +2186,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitObjectLiteral(node: ObjectLiteral) {
|
||||
function emitObjectLiteral(node: ObjectLiteralExpression) {
|
||||
if (!node.properties.length) {
|
||||
write("{}");
|
||||
}
|
||||
@@ -2249,17 +2249,17 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function tryEmitConstantValue(node: PropertyAccess | ElementAccessExpression): boolean {
|
||||
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
|
||||
var constantValue = resolver.getConstantValue(node);
|
||||
if (constantValue !== undefined) {
|
||||
var propertyName = node.kind === SyntaxKind.PropertyAccess ? declarationNameToString((<PropertyAccess>node).right) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
|
||||
var propertyName = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).right) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
|
||||
write(constantValue.toString() + " /* " + propertyName + " */");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitPropertyAccess(node: PropertyAccess) {
|
||||
function emitPropertyAccess(node: PropertyAccessExpression) {
|
||||
if (tryEmitConstantValue(node)) {
|
||||
return;
|
||||
}
|
||||
@@ -2286,7 +2286,7 @@ module ts {
|
||||
}
|
||||
else {
|
||||
emit(node.expression);
|
||||
superCall = node.expression.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.expression).left.kind === SyntaxKind.SuperKeyword;
|
||||
superCall = node.expression.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.expression).left.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
if (superCall) {
|
||||
write(".call(");
|
||||
@@ -2321,13 +2321,13 @@ module ts {
|
||||
emit(node.template);
|
||||
}
|
||||
|
||||
function emitParenExpression(node: ParenExpression) {
|
||||
if (node.expression.kind === SyntaxKind.TypeAssertion) {
|
||||
function emitParenExpression(node: ParenthesizedExpression) {
|
||||
if (node.expression.kind === SyntaxKind.TypeAssertionExpression) {
|
||||
var operand = (<TypeAssertion>node.expression).expression;
|
||||
|
||||
// Make sure we consider all nested cast expressions, e.g.:
|
||||
// (<any><number><any>-A).x;
|
||||
while (operand.kind == SyntaxKind.TypeAssertion) {
|
||||
while (operand.kind == SyntaxKind.TypeAssertionExpression) {
|
||||
operand = (<TypeAssertion>operand).expression;
|
||||
}
|
||||
|
||||
@@ -2343,7 +2343,7 @@ module ts {
|
||||
operand.kind !== SyntaxKind.VoidExpression &&
|
||||
operand.kind !== SyntaxKind.TypeOfExpression &&
|
||||
operand.kind !== SyntaxKind.DeleteExpression &&
|
||||
operand.kind !== SyntaxKind.PostfixOperator &&
|
||||
operand.kind !== SyntaxKind.PostfixUnaryExpression &&
|
||||
operand.kind !== SyntaxKind.NewExpression &&
|
||||
!(operand.kind === SyntaxKind.CallExpression && node.parent.kind === SyntaxKind.NewExpression) &&
|
||||
!(operand.kind === SyntaxKind.FunctionExpression && node.parent.kind === SyntaxKind.CallExpression)) {
|
||||
@@ -2403,7 +2403,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
emit(node.operand);
|
||||
if (node.kind === SyntaxKind.PostfixOperator) {
|
||||
if (node.kind === SyntaxKind.PostfixUnaryExpression) {
|
||||
write(tokenToString(node.operator));
|
||||
}
|
||||
}
|
||||
@@ -3495,18 +3495,18 @@ module ts {
|
||||
return emitTemplateSpan(<TemplateSpan>node);
|
||||
case SyntaxKind.QualifiedName:
|
||||
return emitPropertyAccess(<QualifiedName>node);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return emitArrayLiteral(<ArrayLiteral>node);
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
return emitObjectLiteral(<ObjectLiteral>node);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return emitArrayLiteral(<ArrayLiteralExpression>node);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return emitObjectLiteral(<ObjectLiteralExpression>node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
return emitPropertyAssignment(<PropertyDeclaration>node);
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return emitShortHandPropertyAssignment(<ShortHandPropertyDeclaration>node);
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return emitComputedPropertyName(<ComputedPropertyName>node);
|
||||
case SyntaxKind.PropertyAccess:
|
||||
return emitPropertyAccess(<PropertyAccess>node);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return emitPropertyAccess(<PropertyAccessExpression>node);
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return emitIndexedAccess(<ElementAccessExpression>node);
|
||||
case SyntaxKind.CallExpression:
|
||||
@@ -3515,10 +3515,10 @@ module ts {
|
||||
return emitNewExpression(<NewExpression>node);
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
return emitTaggedTemplateExpression(<TaggedTemplateExpression>node);
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return emit((<TypeAssertion>node).expression);
|
||||
case SyntaxKind.ParenExpression:
|
||||
return emitParenExpression(<ParenExpression>node);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return emitParenExpression(<ParenthesizedExpression>node);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
@@ -3530,7 +3530,7 @@ module ts {
|
||||
case SyntaxKind.VoidExpression:
|
||||
return emitVoidExpression(<VoidExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
return emitUnaryExpression(<UnaryExpression>node);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return emitBinaryExpression(<BinaryExpression>node);
|
||||
|
||||
+35
-35
@@ -255,13 +255,13 @@ module ts {
|
||||
return children((<UnionTypeNode>node).types);
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return child((<ParenthesizedTypeNode>node).type);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return children((<ArrayLiteral>node).elements);
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
return children((<ObjectLiteral>node).properties);
|
||||
case SyntaxKind.PropertyAccess:
|
||||
return child((<PropertyAccess>node).left) ||
|
||||
child((<PropertyAccess>node).right);
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return children((<ArrayLiteralExpression>node).elements);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return children((<ObjectLiteralExpression>node).properties);
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return child((<PropertyAccessExpression>node).left) ||
|
||||
child((<PropertyAccessExpression>node).right);
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return child((<ElementAccessExpression>node).expression) ||
|
||||
child((<ElementAccessExpression>node).argumentExpression);
|
||||
@@ -273,11 +273,11 @@ module ts {
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
return child((<TaggedTemplateExpression>node).tag) ||
|
||||
child((<TaggedTemplateExpression>node).template);
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return child((<TypeAssertion>node).type) ||
|
||||
child((<TypeAssertion>node).expression);
|
||||
case SyntaxKind.ParenExpression:
|
||||
return child((<ParenExpression>node).expression);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return child((<ParenthesizedExpression>node).expression);
|
||||
case SyntaxKind.DeleteExpression:
|
||||
return child((<DeleteExpression>node).expression);
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
@@ -285,7 +285,7 @@ module ts {
|
||||
case SyntaxKind.VoidExpression:
|
||||
return child((<VoidExpression>node).expression);
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
return child((<UnaryExpression>node).operand);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return child((<BinaryExpression>node).left) ||
|
||||
@@ -513,22 +513,22 @@ module ts {
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
case SyntaxKind.TypeOfExpression:
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
case SyntaxKind.PostfixOperator:
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
case SyntaxKind.BinaryExpression:
|
||||
case SyntaxKind.ConditionalExpression:
|
||||
case SyntaxKind.TemplateExpression:
|
||||
@@ -571,7 +571,7 @@ module ts {
|
||||
case SyntaxKind.ForInStatement:
|
||||
return (<ForInStatement>parent).variable === node ||
|
||||
(<ForInStatement>parent).expression === node;
|
||||
case SyntaxKind.TypeAssertion:
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return node === (<TypeAssertion>parent).expression;
|
||||
case SyntaxKind.TemplateSpan:
|
||||
return node === (<TemplateSpan>parent).expression;
|
||||
@@ -2676,7 +2676,7 @@ module ts {
|
||||
if ((token === SyntaxKind.PlusPlusToken || token === SyntaxKind.MinusMinusToken) && !scanner.hasPrecedingLineBreak()) {
|
||||
var operator = token;
|
||||
nextToken();
|
||||
return makeUnaryExpression(SyntaxKind.PostfixOperator, expression.pos, operator, expression);
|
||||
return makeUnaryExpression(SyntaxKind.PostfixUnaryExpression, expression.pos, operator, expression);
|
||||
}
|
||||
|
||||
return expression;
|
||||
@@ -2786,7 +2786,7 @@ module ts {
|
||||
|
||||
// If we have seen "super" it must be followed by '(' or '.'.
|
||||
// If it wasn't then just try to parse out a '.' and report an error.
|
||||
var node = <PropertyAccess>createNode(SyntaxKind.PropertyAccess, expression.pos);
|
||||
var node = <PropertyAccessExpression>createNode(SyntaxKind.PropertyAccessExpression, expression.pos);
|
||||
node.left = expression;
|
||||
parseExpected(SyntaxKind.DotToken, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
|
||||
node.right = parseIdentifierName();
|
||||
@@ -2794,7 +2794,7 @@ module ts {
|
||||
}
|
||||
|
||||
function parseTypeAssertion(): TypeAssertion {
|
||||
var node = <TypeAssertion>createNode(SyntaxKind.TypeAssertion);
|
||||
var node = <TypeAssertion>createNode(SyntaxKind.TypeAssertionExpression);
|
||||
parseExpected(SyntaxKind.LessThanToken);
|
||||
node.type = parseType();
|
||||
parseExpected(SyntaxKind.GreaterThanToken);
|
||||
@@ -2813,7 +2813,7 @@ module ts {
|
||||
while (true) {
|
||||
var dotOrBracketStart = scanner.getTokenPos();
|
||||
if (parseOptional(SyntaxKind.DotToken)) {
|
||||
var propertyAccess = <PropertyAccess>createNode(SyntaxKind.PropertyAccess, expression.pos);
|
||||
var propertyAccess = <PropertyAccessExpression>createNode(SyntaxKind.PropertyAccessExpression, expression.pos);
|
||||
// Technically a keyword is valid here as all keywords are identifier names.
|
||||
// However, often we'll encounter this in error situations when the keyword
|
||||
// is actually starting another valid construct.
|
||||
@@ -2990,8 +2990,8 @@ module ts {
|
||||
return <Expression>createMissingNode();
|
||||
}
|
||||
|
||||
function parseParenExpression(): ParenExpression {
|
||||
var node = <ParenExpression>createNode(SyntaxKind.ParenExpression);
|
||||
function parseParenExpression(): ParenthesizedExpression {
|
||||
var node = <ParenthesizedExpression>createNode(SyntaxKind.ParenthesizedExpression);
|
||||
parseExpected(SyntaxKind.OpenParenToken);
|
||||
node.expression = allowInAnd(parseExpression);
|
||||
parseExpected(SyntaxKind.CloseParenToken);
|
||||
@@ -3012,8 +3012,8 @@ module ts {
|
||||
return allowInAnd(parseAssignmentExpressionOrOmittedExpression);
|
||||
}
|
||||
|
||||
function parseArrayLiteral(): ArrayLiteral {
|
||||
var node = <ArrayLiteral>createNode(SyntaxKind.ArrayLiteral);
|
||||
function parseArrayLiteral(): ArrayLiteralExpression {
|
||||
var node = <ArrayLiteralExpression>createNode(SyntaxKind.ArrayLiteralExpression);
|
||||
parseExpected(SyntaxKind.OpenBracketToken);
|
||||
if (scanner.hasPrecedingLineBreak()) node.flags |= NodeFlags.MultiLine;
|
||||
node.elements = parseDelimitedList(ParsingContext.ArrayLiteralMembers, parseArrayLiteralElement);
|
||||
@@ -3077,8 +3077,8 @@ module ts {
|
||||
return parsePropertyAssignment();
|
||||
}
|
||||
|
||||
function parseObjectLiteral(): ObjectLiteral {
|
||||
var node = <ObjectLiteral>createNode(SyntaxKind.ObjectLiteral);
|
||||
function parseObjectLiteral(): ObjectLiteralExpression {
|
||||
var node = <ObjectLiteralExpression>createNode(SyntaxKind.ObjectLiteralExpression);
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
if (scanner.hasPrecedingLineBreak()) {
|
||||
node.flags |= NodeFlags.MultiLine;
|
||||
@@ -4119,14 +4119,14 @@ module ts {
|
||||
function isLeftHandSideExpression(expr: Expression): boolean {
|
||||
if (expr) {
|
||||
switch (expr.kind) {
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.TaggedTemplateExpression:
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.Missing:
|
||||
@@ -4242,10 +4242,10 @@ module ts {
|
||||
case SyntaxKind.LabeledStatement: return checkLabeledStatement(<LabeledStatement>node);
|
||||
case SyntaxKind.Method: return checkMethod(<MethodDeclaration>node);
|
||||
case SyntaxKind.ModuleDeclaration: return checkModuleDeclaration(<ModuleDeclaration>node);
|
||||
case SyntaxKind.ObjectLiteral: return checkObjectLiteral(<ObjectLiteral>node);
|
||||
case SyntaxKind.ObjectLiteralExpression: return checkObjectLiteral(<ObjectLiteralExpression>node);
|
||||
case SyntaxKind.NumericLiteral: return checkNumericLiteral(<LiteralExpression>node);
|
||||
case SyntaxKind.Parameter: return checkParameter(<ParameterDeclaration>node);
|
||||
case SyntaxKind.PostfixOperator: return checkPostfixOperator(<UnaryExpression>node);
|
||||
case SyntaxKind.PostfixUnaryExpression: return checkPostfixOperator(<UnaryExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression: return checkPrefixOperator(<UnaryExpression>node);
|
||||
case SyntaxKind.Property: return checkProperty(<PropertyDeclaration>node);
|
||||
case SyntaxKind.PropertyAssignment: return checkPropertyAssignment(<PropertyDeclaration>node);
|
||||
@@ -4763,7 +4763,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkObjectLiteral(node: ObjectLiteral): boolean {
|
||||
function checkObjectLiteral(node: ObjectLiteralExpression): boolean {
|
||||
var seen: Map<SymbolFlags> = {};
|
||||
var Property = 1;
|
||||
var GetAccessor = 2;
|
||||
|
||||
+17
-15
@@ -165,30 +165,29 @@ module ts {
|
||||
UnionType,
|
||||
ParenthesizedType,
|
||||
// Expression
|
||||
ArrayLiteral,
|
||||
ObjectLiteral,
|
||||
PropertyAssignment,
|
||||
ShorthandPropertyAssignment,
|
||||
PropertyAccess,
|
||||
ArrayLiteralExpression,
|
||||
ObjectLiteralExpression,
|
||||
PropertyAccessExpression,
|
||||
ElementAccessExpression,
|
||||
CallExpression,
|
||||
NewExpression,
|
||||
TaggedTemplateExpression,
|
||||
TypeAssertion,
|
||||
ParenExpression,
|
||||
TypeAssertionExpression,
|
||||
ParenthesizedExpression,
|
||||
FunctionExpression,
|
||||
ArrowFunction,
|
||||
DeleteExpression,
|
||||
TypeOfExpression,
|
||||
VoidExpression,
|
||||
PrefixUnaryExpression,
|
||||
PostfixOperator,
|
||||
PostfixUnaryExpression,
|
||||
BinaryExpression,
|
||||
ConditionalExpression,
|
||||
TemplateExpression,
|
||||
TemplateSpan,
|
||||
YieldExpression,
|
||||
OmittedExpression,
|
||||
// Misc
|
||||
TemplateSpan,
|
||||
// Element
|
||||
Block,
|
||||
VariableStatement,
|
||||
@@ -224,6 +223,9 @@ module ts {
|
||||
ModuleBlock,
|
||||
ImportDeclaration,
|
||||
ExportAssignment,
|
||||
// Property assignments
|
||||
PropertyAssignment,
|
||||
ShorthandPropertyAssignment,
|
||||
// Enum
|
||||
EnumMember,
|
||||
// Top-level nodes
|
||||
@@ -495,19 +497,19 @@ module ts {
|
||||
literal: LiteralExpression;
|
||||
}
|
||||
|
||||
export interface ParenExpression extends Expression {
|
||||
export interface ParenthesizedExpression extends Expression {
|
||||
expression: Expression;
|
||||
}
|
||||
|
||||
export interface ArrayLiteral extends Expression {
|
||||
export interface ArrayLiteralExpression extends Expression {
|
||||
elements: NodeArray<Expression>;
|
||||
}
|
||||
|
||||
export interface ObjectLiteral extends Expression {
|
||||
export interface ObjectLiteralExpression extends Expression {
|
||||
properties: NodeArray<Node>;
|
||||
}
|
||||
|
||||
export interface PropertyAccess extends Expression {
|
||||
export interface PropertyAccessExpression extends Expression {
|
||||
left: Expression;
|
||||
right: Identifier;
|
||||
}
|
||||
@@ -799,7 +801,7 @@ module ts {
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
// Returns the constant value of this enum member, or 'undefined' if the enum member has a computed value.
|
||||
getEnumMemberValue(node: EnumMember): number;
|
||||
isValidPropertyAccess(node: PropertyAccess, propertyName: string): boolean;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
}
|
||||
|
||||
@@ -890,7 +892,7 @@ module ts {
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
getConstantValue(node: PropertyAccess | ElementAccessExpression): number;
|
||||
getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,21 +29,21 @@ class TypeWriterWalker {
|
||||
// old typeWriter baselines, suppress tokens
|
||||
case ts.SyntaxKind.ThisKeyword:
|
||||
case ts.SyntaxKind.SuperKeyword:
|
||||
case ts.SyntaxKind.ArrayLiteral:
|
||||
case ts.SyntaxKind.ObjectLiteral:
|
||||
case ts.SyntaxKind.PropertyAccess:
|
||||
case ts.SyntaxKind.ArrayLiteralExpression:
|
||||
case ts.SyntaxKind.ObjectLiteralExpression:
|
||||
case ts.SyntaxKind.PropertyAccessExpression:
|
||||
case ts.SyntaxKind.ElementAccessExpression:
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
case ts.SyntaxKind.NewExpression:
|
||||
case ts.SyntaxKind.TypeAssertion:
|
||||
case ts.SyntaxKind.ParenExpression:
|
||||
case ts.SyntaxKind.TypeAssertionExpression:
|
||||
case ts.SyntaxKind.ParenthesizedExpression:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
case ts.SyntaxKind.ArrowFunction:
|
||||
case ts.SyntaxKind.TypeOfExpression:
|
||||
case ts.SyntaxKind.VoidExpression:
|
||||
case ts.SyntaxKind.DeleteExpression:
|
||||
case ts.SyntaxKind.PrefixUnaryExpression:
|
||||
case ts.SyntaxKind.PostfixOperator:
|
||||
case ts.SyntaxKind.PostfixUnaryExpression:
|
||||
case ts.SyntaxKind.BinaryExpression:
|
||||
case ts.SyntaxKind.ConditionalExpression:
|
||||
this.log(node, this.getTypeOfNode(node));
|
||||
|
||||
@@ -242,7 +242,7 @@ module ts.BreakpointResolver {
|
||||
}
|
||||
|
||||
// Breakpoint in type assertion goes to its operand
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertion && (<TypeAssertion>node.parent).type === node) {
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertionExpression && (<TypeAssertion>node.parent).type === node) {
|
||||
return spanInNode((<TypeAssertion>node.parent).expression);
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ module ts.BreakpointResolver {
|
||||
}
|
||||
|
||||
function spanInGreaterThanOrLessThanToken(node: Node): TextSpan {
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertion) {
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertionExpression) {
|
||||
return spanInNode((<TypeAssertion>node.parent).expression);
|
||||
}
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ module ts.formatting {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
@@ -613,7 +613,7 @@ module ts.formatting {
|
||||
}
|
||||
|
||||
static IsObjectContext(context: FormattingContext): boolean {
|
||||
return context.contextNode.kind === SyntaxKind.ObjectLiteral;
|
||||
return context.contextNode.kind === SyntaxKind.ObjectLiteralExpression;
|
||||
}
|
||||
|
||||
static IsFunctionCallContext(context: FormattingContext): boolean {
|
||||
|
||||
@@ -109,13 +109,13 @@ module ts {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
var openBrace = findChildOfKind(n, SyntaxKind.OpenBraceToken, sourceFile);
|
||||
var closeBrace = findChildOfKind(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n));
|
||||
break;
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
var openBracket = findChildOfKind(n, SyntaxKind.OpenBracketToken, sourceFile);
|
||||
var closeBracket = findChildOfKind(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n));
|
||||
|
||||
+15
-15
@@ -1927,7 +1927,7 @@ module ts {
|
||||
}
|
||||
|
||||
function isRightSideOfPropertyAccess(node: Node) {
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.parent).right === node;
|
||||
return node && node.parent && node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).right === node;
|
||||
}
|
||||
|
||||
function isCallExpressionTarget(node: Node): boolean {
|
||||
@@ -2374,8 +2374,8 @@ module ts {
|
||||
var node: Node;
|
||||
var isRightOfDot: boolean;
|
||||
if (previousToken && previousToken.kind === SyntaxKind.DotToken &&
|
||||
(previousToken.parent.kind === SyntaxKind.PropertyAccess || previousToken.parent.kind === SyntaxKind.QualifiedName)) {
|
||||
node = (<PropertyAccess>previousToken.parent).left;
|
||||
(previousToken.parent.kind === SyntaxKind.PropertyAccessExpression || previousToken.parent.kind === SyntaxKind.QualifiedName)) {
|
||||
node = (<PropertyAccessExpression>previousToken.parent).left;
|
||||
isRightOfDot = true;
|
||||
}
|
||||
else {
|
||||
@@ -2401,7 +2401,7 @@ module ts {
|
||||
var symbols: Symbol[] = [];
|
||||
isMemberCompletion = true;
|
||||
|
||||
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccess) {
|
||||
if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
var symbol = typeInfoResolver.getSymbolInfo(node);
|
||||
|
||||
// This is an alias, follow what it aliases
|
||||
@@ -2412,7 +2412,7 @@ module ts {
|
||||
if (symbol && symbol.flags & SymbolFlags.HasExports) {
|
||||
// Extract module or enum members
|
||||
forEachValue(symbol.exports, symbol => {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccess>(node.parent), symbol.name)) {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
|
||||
symbols.push(symbol);
|
||||
}
|
||||
});
|
||||
@@ -2423,7 +2423,7 @@ module ts {
|
||||
if (type) {
|
||||
// Filter private properties
|
||||
forEach(type.getApparentProperties(), symbol => {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccess>(node.parent), symbol.name)) {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
|
||||
symbols.push(symbol);
|
||||
}
|
||||
});
|
||||
@@ -2542,7 +2542,7 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getContainingObjectLiteralApplicableForCompletion(previousToken: Node): ObjectLiteral {
|
||||
function getContainingObjectLiteralApplicableForCompletion(previousToken: Node): ObjectLiteralExpression {
|
||||
// The locations in an object literal expression that are applicable for completion are property name definition locations.
|
||||
|
||||
if (previousToken) {
|
||||
@@ -2551,8 +2551,8 @@ module ts {
|
||||
switch (previousToken.kind) {
|
||||
case SyntaxKind.OpenBraceToken: // var x = { |
|
||||
case SyntaxKind.CommaToken: // var x = { a: 0, |
|
||||
if (parent && parent.kind === SyntaxKind.ObjectLiteral) {
|
||||
return <ObjectLiteral>parent;
|
||||
if (parent && parent.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
return <ObjectLiteralExpression>parent;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2878,8 +2878,8 @@ module ts {
|
||||
|
||||
var type = typeResolver.getNarrowedTypeOfSymbol(symbol, location);
|
||||
if (type) {
|
||||
if (location.parent && location.parent.kind === SyntaxKind.PropertyAccess) {
|
||||
var right = (<PropertyAccess>location.parent).right;
|
||||
if (location.parent && location.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
var right = (<PropertyAccessExpression>location.parent).right;
|
||||
// Either the location is on the right of a property access, or on the left and the right is missing
|
||||
if (right === location || (right && right.kind === SyntaxKind.Missing)){
|
||||
location = location.parent;
|
||||
@@ -3201,7 +3201,7 @@ module ts {
|
||||
// Try getting just type at this position and show
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
@@ -4574,7 +4574,7 @@ module ts {
|
||||
|
||||
var parent = node.parent;
|
||||
if (parent) {
|
||||
if (parent.kind === SyntaxKind.PostfixOperator || parent.kind === SyntaxKind.PrefixUnaryExpression) {
|
||||
if (parent.kind === SyntaxKind.PostfixUnaryExpression || parent.kind === SyntaxKind.PrefixUnaryExpression) {
|
||||
return true;
|
||||
}
|
||||
else if (parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).left === node) {
|
||||
@@ -4879,7 +4879,7 @@ module ts {
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyAccess:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
@@ -5064,7 +5064,7 @@ module ts {
|
||||
if (token.parent.kind === SyntaxKind.BinaryExpression ||
|
||||
token.parent.kind === SyntaxKind.VariableDeclaration ||
|
||||
token.parent.kind === SyntaxKind.PrefixUnaryExpression ||
|
||||
token.parent.kind === SyntaxKind.PostfixOperator ||
|
||||
token.parent.kind === SyntaxKind.PostfixUnaryExpression ||
|
||||
token.parent.kind === SyntaxKind.ConditionalExpression) {
|
||||
return ClassificationTypeNames.operator;
|
||||
}
|
||||
|
||||
@@ -227,10 +227,10 @@ module ts.formatting {
|
||||
return (<TypeReferenceNode>node.parent).typeArguments;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
return (<ObjectLiteral>node.parent).properties;
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
return (<ArrayLiteral>node.parent).elements;
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return (<ObjectLiteralExpression>node.parent).properties;
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return (<ArrayLiteralExpression>node.parent).elements;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
@@ -323,19 +323,19 @@ module ts.formatting {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.FunctionBlock:
|
||||
case SyntaxKind.TryBlock:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
case SyntaxKind.DefaultClause:
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.VariableStatement:
|
||||
@@ -397,7 +397,7 @@ module ts.formatting {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ObjectLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.Block:
|
||||
case SyntaxKind.CatchBlock:
|
||||
case SyntaxKind.FinallyBlock:
|
||||
@@ -405,7 +405,7 @@ module ts.formatting {
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.SwitchStatement:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile);
|
||||
case SyntaxKind.ParenExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
@@ -424,7 +424,7 @@ module ts.formatting {
|
||||
return isCompletedNode((<IfStatement>n).thenStatement, sourceFile);
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
return isCompletedNode((<ExpressionStatement>n).expression, sourceFile);
|
||||
case SyntaxKind.ArrayLiteral:
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
return nodeEndsWith(n, SyntaxKind.CloseBracketToken, sourceFile);
|
||||
case SyntaxKind.Missing:
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user