Skip to content

Commit e1011aa

Browse files
Rename syntax properties to match Roslyn/Fidelity naming.
1 parent 13f319b commit e1011aa

7 files changed

Lines changed: 88 additions & 88 deletions

File tree

src/compiler/checker.ts

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4328,7 +4328,7 @@ module ts {
43284328
case SyntaxKind.ArrayLiteral:
43294329
case SyntaxKind.ObjectLiteral:
43304330
case SyntaxKind.PropertyAccess:
4331-
case SyntaxKind.IndexedAccess:
4331+
case SyntaxKind.ElementAccessExpression:
43324332
case SyntaxKind.CallExpression:
43334333
case SyntaxKind.NewExpression:
43344334
case SyntaxKind.TypeAssertion:
@@ -4625,7 +4625,7 @@ module ts {
46254625
}
46264626

46274627
function checkSuperExpression(node: Node): Type {
4628-
var isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (<CallExpression>node.parent).func === node;
4628+
var isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (<CallExpression>node.parent).expression === node;
46294629
var enclosingClass = <ClassDeclaration>getAncestor(node, SyntaxKind.ClassDeclaration);
46304630
var baseClass: Type;
46314631
if (enclosingClass && enclosingClass.baseType) {
@@ -5208,15 +5208,15 @@ module ts {
52085208
return true;
52095209
}
52105210

5211-
function checkIndexedAccess(node: IndexedAccess): Type {
5211+
function checkIndexedAccess(node: ElementAccessExpression): Type {
52125212
// Obtain base constraint such that we can bail out if the constraint is an unknown type
5213-
var objectType = getApparentType(checkExpression(node.object));
5214-
var indexType = checkExpression(node.index);
5213+
var objectType = getApparentType(checkExpression(node.expression));
5214+
var indexType = checkExpression(node.argumentExpression);
52155215

52165216
if (objectType === unknownType) return unknownType;
52175217

5218-
if (isConstEnumObjectType(objectType) && node.index.kind !== SyntaxKind.StringLiteral) {
5219-
error(node.index, Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string);
5218+
if (isConstEnumObjectType(objectType) && node.argumentExpression.kind !== SyntaxKind.StringLiteral) {
5219+
error(node.argumentExpression, Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string);
52205220
}
52215221

52225222
// TypeScript 1.0 spec (April 2014): 4.10 Property Access
@@ -5229,8 +5229,8 @@ module ts {
52295229
// - Otherwise, if IndexExpr is of type Any, the String or Number primitive type, or an enum type, the property access is of type Any.
52305230

52315231
// See if we can index as a property.
5232-
if (node.index.kind === SyntaxKind.StringLiteral || node.index.kind === SyntaxKind.NumericLiteral) {
5233-
var name = (<LiteralExpression>node.index).text;
5232+
if (node.argumentExpression.kind === SyntaxKind.StringLiteral || node.argumentExpression.kind === SyntaxKind.NumericLiteral) {
5233+
var name = (<LiteralExpression>node.argumentExpression).text;
52345234
var prop = getPropertyOfType(objectType, name);
52355235
if (prop) {
52365236
getNodeLinks(node).resolvedSymbol = prop;
@@ -5629,7 +5629,7 @@ module ts {
56295629
Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly,
56305630
typeToString(failedTypeParameter));
56315631

5632-
reportNoCommonSupertypeError(inferenceCandidates, (<CallExpression>node).func || (<TaggedTemplateExpression>node).tag, diagnosticChainHead);
5632+
reportNoCommonSupertypeError(inferenceCandidates, (<CallExpression>node).expression || (<TaggedTemplateExpression>node).tag, diagnosticChainHead);
56335633
}
56345634
}
56355635
else {
@@ -5759,15 +5759,15 @@ module ts {
57595759
}
57605760

57615761
function resolveCallExpression(node: CallExpression, candidatesOutArray: Signature[]): Signature {
5762-
if (node.func.kind === SyntaxKind.SuperKeyword) {
5763-
var superType = checkSuperExpression(node.func);
5762+
if (node.expression.kind === SyntaxKind.SuperKeyword) {
5763+
var superType = checkSuperExpression(node.expression);
57645764
if (superType !== unknownType) {
57655765
return resolveCall(node, getSignaturesOfType(superType, SignatureKind.Construct), candidatesOutArray);
57665766
}
57675767
return resolveUntypedCall(node);
57685768
}
57695769

5770-
var funcType = checkExpression(node.func);
5770+
var funcType = checkExpression(node.expression);
57715771
var apparentType = getApparentType(funcType);
57725772

57735773
if (apparentType === unknownType) {
@@ -5811,7 +5811,7 @@ module ts {
58115811
}
58125812

58135813
function resolveNewExpression(node: NewExpression, candidatesOutArray: Signature[]): Signature {
5814-
var expressionType = checkExpression(node.func);
5814+
var expressionType = checkExpression(node.expression);
58155815
// TS 1.0 spec: 4.11
58165816
// If ConstructExpr is of type Any, Args can be any argument
58175817
// list and the result of the operation is of type Any.
@@ -5911,7 +5911,7 @@ module ts {
59115911

59125912
function checkCallExpression(node: CallExpression): Type {
59135913
var signature = getResolvedSignature(node);
5914-
if (node.func.kind === SyntaxKind.SuperKeyword) {
5914+
if (node.expression.kind === SyntaxKind.SuperKeyword) {
59155915
return voidType;
59165916
}
59175917
if (node.kind === SyntaxKind.NewExpression) {
@@ -5936,7 +5936,7 @@ module ts {
59365936
}
59375937

59385938
function checkTypeAssertion(node: TypeAssertion): Type {
5939-
var exprType = checkExpression(node.operand);
5939+
var exprType = checkExpression(node.expression);
59405940
var targetType = getTypeFromTypeNode(node.type);
59415941
if (fullTypeCheck && targetType !== unknownType) {
59425942
var widenedType = getWidenedType(exprType, /*supressNoImplicitAnyErrors*/ true);
@@ -6171,7 +6171,7 @@ module ts {
61716171
// A property access expression is always classified as a reference.
61726172
// NOTE (not in spec): assignment to enum members should not be allowed
61736173
return !symbol || symbol === unknownSymbol || (symbol.flags & ~SymbolFlags.EnumMember) !== 0;
6174-
case SyntaxKind.IndexedAccess:
6174+
case SyntaxKind.ElementAccessExpression:
61756175
// old compiler doesn't check indexed assess
61766176
return true;
61776177
case SyntaxKind.ParenExpression:
@@ -6187,9 +6187,9 @@ module ts {
61876187
case SyntaxKind.PropertyAccess:
61886188
var symbol = findSymbol(n);
61896189
return symbol && (symbol.flags & SymbolFlags.Variable) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & NodeFlags.Const) !== 0;
6190-
case SyntaxKind.IndexedAccess:
6191-
var index = (<IndexedAccess>n).index;
6192-
var symbol = findSymbol((<IndexedAccess>n).object);
6190+
case SyntaxKind.ElementAccessExpression:
6191+
var index = (<ElementAccessExpression>n).argumentExpression;
6192+
var symbol = findSymbol((<ElementAccessExpression>n).expression);
61936193
if (symbol && index.kind === SyntaxKind.StringLiteral) {
61946194
var name = (<LiteralExpression>index).text;
61956195
var prop = getPropertyOfType(getTypeOfSymbol(symbol), name);
@@ -6525,7 +6525,7 @@ module ts {
65256525
// - target in rhs of import statement
65266526
var ok =
65276527
(node.parent.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.parent).left === node) ||
6528-
(node.parent.kind === SyntaxKind.IndexedAccess && (<IndexedAccess>node.parent).object === node) ||
6528+
(node.parent.kind === SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>node.parent).expression === node) ||
65296529
((node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName) && isInRightSideOfImportOrExportAssignment(<EntityName>node));
65306530

65316531
if (!ok) {
@@ -6565,8 +6565,8 @@ module ts {
65656565
return checkObjectLiteral(<ObjectLiteral>node, contextualMapper);
65666566
case SyntaxKind.PropertyAccess:
65676567
return checkPropertyAccess(<PropertyAccess>node);
6568-
case SyntaxKind.IndexedAccess:
6569-
return checkIndexedAccess(<IndexedAccess>node);
6568+
case SyntaxKind.ElementAccessExpression:
6569+
return checkIndexedAccess(<ElementAccessExpression>node);
65706570
case SyntaxKind.CallExpression:
65716571
case SyntaxKind.NewExpression:
65726572
return checkCallExpression(<CallExpression>node);
@@ -6763,7 +6763,7 @@ module ts {
67636763
}
67646764

67656765
function isSuperCallExpression(n: Node): boolean {
6766-
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).func.kind === SyntaxKind.SuperKeyword;
6766+
return n.kind === SyntaxKind.CallExpression && (<CallExpression>n).expression.kind === SyntaxKind.SuperKeyword;
67676767
}
67686768

67696769
function containsSuperCall(n: Node): boolean {
@@ -8139,7 +8139,7 @@ module ts {
81398139
case SyntaxKind.ParenExpression:
81408140
return enumIsConst ? evalConstant((<ParenExpression>e).expression) : undefined;
81418141
case SyntaxKind.Identifier:
8142-
case SyntaxKind.IndexedAccess:
8142+
case SyntaxKind.ElementAccessExpression:
81438143
case SyntaxKind.PropertyAccess:
81448144
if (!enumIsConst) {
81458145
return undefined;
@@ -8157,12 +8157,12 @@ module ts {
81578157
propertyName = (<Identifier>e).text;
81588158
}
81598159
else {
8160-
if (e.kind === SyntaxKind.IndexedAccess) {
8161-
if ((<IndexedAccess>e).index.kind !== SyntaxKind.StringLiteral) {
8160+
if (e.kind === SyntaxKind.ElementAccessExpression) {
8161+
if ((<ElementAccessExpression>e).argumentExpression.kind !== SyntaxKind.StringLiteral) {
81628162
return undefined;
81638163
}
8164-
var enumType = getTypeOfNode((<IndexedAccess>e).object);
8165-
propertyName = (<LiteralExpression>(<IndexedAccess>e).index).text;
8164+
var enumType = getTypeOfNode((<ElementAccessExpression>e).expression);
8165+
propertyName = (<LiteralExpression>(<ElementAccessExpression>e).argumentExpression).text;
81668166
}
81678167
else {
81688168
var enumType = getTypeOfNode((<PropertyAccess>e).left);
@@ -8491,7 +8491,7 @@ module ts {
84918491
case SyntaxKind.ObjectLiteral:
84928492
case SyntaxKind.PropertyAssignment:
84938493
case SyntaxKind.PropertyAccess:
8494-
case SyntaxKind.IndexedAccess:
8494+
case SyntaxKind.ElementAccessExpression:
84958495
case SyntaxKind.CallExpression:
84968496
case SyntaxKind.NewExpression:
84978497
case SyntaxKind.TaggedTemplateExpression:
@@ -8907,8 +8907,8 @@ module ts {
89078907
// Intentional fall-through
89088908
case SyntaxKind.NumericLiteral:
89098909
// index access
8910-
if (node.parent.kind == SyntaxKind.IndexedAccess && (<IndexedAccess>node.parent).index === node) {
8911-
var objectType = checkExpression((<IndexedAccess>node.parent).object);
8910+
if (node.parent.kind == SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>node.parent).argumentExpression === node) {
8911+
var objectType = checkExpression((<ElementAccessExpression>node.parent).expression);
89128912
if (objectType === unknownType) return undefined;
89138913
var apparentType = getApparentType(objectType);
89148914
if (apparentType === unknownType) return undefined;
@@ -9160,7 +9160,7 @@ module ts {
91609160
return getNodeLinks(node).enumMemberValue;
91619161
}
91629162

9163-
function getConstantValue(node: PropertyAccess | IndexedAccess): number {
9163+
function getConstantValue(node: PropertyAccess | ElementAccessExpression): number {
91649164
var symbol = getNodeLinks(node).resolvedSymbol;
91659165
if (symbol && (symbol.flags & SymbolFlags.EnumMember)) {
91669166
var declaration = symbol.valueDeclaration;

src/compiler/emitter.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ module ts {
20272027
switch (parent.kind) {
20282028
case SyntaxKind.CallExpression:
20292029
case SyntaxKind.NewExpression:
2030-
return (<CallExpression>parent).func === template;
2030+
return (<CallExpression>parent).expression === template;
20312031
case SyntaxKind.ParenExpression:
20322032
return false;
20332033
case SyntaxKind.TaggedTemplateExpression:
@@ -2249,10 +2249,10 @@ module ts {
22492249
}
22502250
}
22512251

2252-
function tryEmitConstantValue(node: PropertyAccess | IndexedAccess): boolean {
2252+
function tryEmitConstantValue(node: PropertyAccess | ElementAccessExpression): boolean {
22532253
var constantValue = resolver.getConstantValue(node);
22542254
if (constantValue !== undefined) {
2255-
var propertyName = node.kind === SyntaxKind.PropertyAccess ? declarationNameToString((<PropertyAccess>node).right) : getTextOfNode((<IndexedAccess>node).index);
2255+
var propertyName = node.kind === SyntaxKind.PropertyAccess ? declarationNameToString((<PropertyAccess>node).right) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
22562256
write(constantValue.toString() + " /* " + propertyName + " */");
22572257
return true;
22582258
}
@@ -2268,29 +2268,29 @@ module ts {
22682268
emit(node.right);
22692269
}
22702270

2271-
function emitIndexedAccess(node: IndexedAccess) {
2271+
function emitIndexedAccess(node: ElementAccessExpression) {
22722272
if (tryEmitConstantValue(node)) {
22732273
return;
22742274
}
2275-
emit(node.object);
2275+
emit(node.expression);
22762276
write("[");
2277-
emit(node.index);
2277+
emit(node.argumentExpression);
22782278
write("]");
22792279
}
22802280

22812281
function emitCallExpression(node: CallExpression) {
22822282
var superCall = false;
2283-
if (node.func.kind === SyntaxKind.SuperKeyword) {
2283+
if (node.expression.kind === SyntaxKind.SuperKeyword) {
22842284
write("_super");
22852285
superCall = true;
22862286
}
22872287
else {
2288-
emit(node.func);
2289-
superCall = node.func.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.func).left.kind === SyntaxKind.SuperKeyword;
2288+
emit(node.expression);
2289+
superCall = node.expression.kind === SyntaxKind.PropertyAccess && (<PropertyAccess>node.expression).left.kind === SyntaxKind.SuperKeyword;
22902290
}
22912291
if (superCall) {
22922292
write(".call(");
2293-
emitThis(node.func);
2293+
emitThis(node.expression);
22942294
if (node.arguments.length) {
22952295
write(", ");
22962296
emitCommaList(node.arguments, /*includeTrailingComma*/ false);
@@ -2306,7 +2306,7 @@ module ts {
23062306

23072307
function emitNewExpression(node: NewExpression) {
23082308
write("new ");
2309-
emit(node.func);
2309+
emit(node.expression);
23102310
if (node.arguments) {
23112311
write("(");
23122312
emitCommaList(node.arguments, /*includeTrailingComma*/ false);
@@ -2323,12 +2323,12 @@ module ts {
23232323

23242324
function emitParenExpression(node: ParenExpression) {
23252325
if (node.expression.kind === SyntaxKind.TypeAssertion) {
2326-
var operand = (<TypeAssertion>node.expression).operand;
2326+
var operand = (<TypeAssertion>node.expression).expression;
23272327

23282328
// Make sure we consider all nested cast expressions, e.g.:
23292329
// (<any><number><any>-A).x;
23302330
while (operand.kind == SyntaxKind.TypeAssertion) {
2331-
operand = (<TypeAssertion>operand).operand;
2331+
operand = (<TypeAssertion>operand).expression;
23322332
}
23332333

23342334
// We have an expression of the form: (<Type>SubExpr)
@@ -2883,7 +2883,7 @@ module ts {
28832883
if (statement && statement.kind === SyntaxKind.ExpressionStatement) {
28842884
var expr = (<ExpressionStatement>statement).expression;
28852885
if (expr && expr.kind === SyntaxKind.CallExpression) {
2886-
var func = (<CallExpression>expr).func;
2886+
var func = (<CallExpression>expr).expression;
28872887
if (func && func.kind === SyntaxKind.SuperKeyword) {
28882888
return <ExpressionStatement>statement;
28892889
}
@@ -3507,16 +3507,16 @@ module ts {
35073507
return emitComputedPropertyName(<ComputedPropertyName>node);
35083508
case SyntaxKind.PropertyAccess:
35093509
return emitPropertyAccess(<PropertyAccess>node);
3510-
case SyntaxKind.IndexedAccess:
3511-
return emitIndexedAccess(<IndexedAccess>node);
3510+
case SyntaxKind.ElementAccessExpression:
3511+
return emitIndexedAccess(<ElementAccessExpression>node);
35123512
case SyntaxKind.CallExpression:
35133513
return emitCallExpression(<CallExpression>node);
35143514
case SyntaxKind.NewExpression:
35153515
return emitNewExpression(<NewExpression>node);
35163516
case SyntaxKind.TaggedTemplateExpression:
35173517
return emitTaggedTemplateExpression(<TaggedTemplateExpression>node);
35183518
case SyntaxKind.TypeAssertion:
3519-
return emit((<TypeAssertion>node).operand);
3519+
return emit((<TypeAssertion>node).expression);
35203520
case SyntaxKind.ParenExpression:
35213521
return emitParenExpression(<ParenExpression>node);
35223522
case SyntaxKind.FunctionDeclaration:

0 commit comments

Comments
 (0)