mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge fixup
This commit is contained in:
@@ -1178,8 +1178,8 @@ namespace ts {
|
||||
case SyntaxKind.Identifier:
|
||||
return checkStrictModeIdentifier(<Identifier>node);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
if (isJavaScriptFile) {
|
||||
let specialKind = getSpecialPropertyAssignmentKind(node);
|
||||
if (isInJavaScriptFile(node)) {
|
||||
const specialKind = getSpecialPropertyAssignmentKind(node);
|
||||
switch (specialKind) {
|
||||
case SpecialPropertyAssignmentKind.ExportsProperty:
|
||||
bindExportsPropertyAssignment(<BinaryExpression>node);
|
||||
@@ -1378,11 +1378,11 @@ namespace ts {
|
||||
// This does two things: turns 'x' into a constructor function, and
|
||||
// adds a member 'y' to the result of that constructor function
|
||||
// Get 'x', the class
|
||||
let classId = <Identifier>(<PropertyAccessExpression>(<PropertyAccessExpression>node.left).expression).expression;
|
||||
const classId = <Identifier>(<PropertyAccessExpression>(<PropertyAccessExpression>node.left).expression).expression;
|
||||
|
||||
// Look up the function in the local scope, since prototype assignments should immediately
|
||||
// follow the function declaration
|
||||
let funcSymbol = container.locals[classId.text];
|
||||
const funcSymbol = container.locals[classId.text];
|
||||
if (!funcSymbol) {
|
||||
return;
|
||||
}
|
||||
@@ -1397,7 +1397,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Get the exports of the class so we can add the method to it
|
||||
let funcExports = declareSymbol(funcSymbol.exports, funcSymbol, <PropertyAccessExpression>(<PropertyAccessExpression>node.left).expression, SymbolFlags.ObjectLiteral | SymbolFlags.Property, SymbolFlags.None);
|
||||
const funcExports = declareSymbol(funcSymbol.exports, funcSymbol, <PropertyAccessExpression>(<PropertyAccessExpression>node.left).expression, SymbolFlags.ObjectLiteral | SymbolFlags.Property, SymbolFlags.None);
|
||||
|
||||
// Declare the method
|
||||
declareSymbol(funcExports.members, funcExports, <PropertyAccessExpression>node.left, SymbolFlags.Method, SymbolFlags.None);
|
||||
|
||||
+14
-7
@@ -123,8 +123,8 @@ namespace ts {
|
||||
|
||||
const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
|
||||
const anySignature = createSignature(undefined, undefined, emptyArray, undefined, anyType, undefined, 0, false, false);
|
||||
const unknownSignature = createSignature(undefined, undefined, emptyArray, undefined, unknownType, undefined, 0, false, false);
|
||||
const anySignature = createSignature(undefined, undefined, emptyArray, undefined, anyType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
|
||||
const unknownSignature = createSignature(undefined, undefined, emptyArray, undefined, unknownType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
|
||||
|
||||
const globals: SymbolTable = {};
|
||||
|
||||
@@ -2661,7 +2661,7 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
// Declaration for className.prototype in inferred JS class
|
||||
let type = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
const type = createAnonymousType(symbol, symbol.members, emptyArray, emptyArray, undefined, undefined);
|
||||
return links.type = type;
|
||||
}
|
||||
}
|
||||
@@ -3930,9 +3930,9 @@ namespace ts {
|
||||
default:
|
||||
if (declaration.symbol.inferredConstructor) {
|
||||
kind = SignatureKind.Construct;
|
||||
let members = createSymbolTable(emptyArray);
|
||||
const members = createSymbolTable(emptyArray);
|
||||
// Collect methods declared with className.protoype.methodName = ...
|
||||
let proto = declaration.symbol.exports["prototype"];
|
||||
const proto = declaration.symbol.exports["prototype"];
|
||||
if (proto) {
|
||||
mergeSymbolTable(members, proto.members);
|
||||
}
|
||||
@@ -3954,7 +3954,7 @@ namespace ts {
|
||||
|
||||
function getSignaturesOfSymbol(symbol: Symbol): Signature[] {
|
||||
if (!symbol) return emptyArray;
|
||||
const result: Signature[] = [];
|
||||
let result: Signature[] = [];
|
||||
for (let i = 0, len = symbol.declarations.length; i < len; i++) {
|
||||
const node = symbol.declarations[i];
|
||||
switch (node.kind) {
|
||||
@@ -6841,7 +6841,14 @@ namespace ts {
|
||||
let container: Node;
|
||||
if (symbol.flags & SymbolFlags.Class) {
|
||||
// get parent of class declaration
|
||||
container = getClassLikeDeclarationOfSymbol(symbol).parent;
|
||||
const classDeclaration = getClassLikeDeclarationOfSymbol(symbol);
|
||||
if (classDeclaration) {
|
||||
container = classDeclaration.parent;
|
||||
}
|
||||
else {
|
||||
// JS-inferred class; do nothing
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// nesting structure:
|
||||
|
||||
@@ -1090,7 +1090,7 @@ namespace ts {
|
||||
}
|
||||
else if (lhs.expression.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
// chained dot, e.g. x.y.z = expr; this var is the 'x.y' part
|
||||
let innerPropertyAccess = <PropertyAccessExpression>lhs.expression;
|
||||
const innerPropertyAccess = <PropertyAccessExpression>lhs.expression;
|
||||
if (innerPropertyAccess.expression.kind === SyntaxKind.Identifier && innerPropertyAccess.name.text === "prototype") {
|
||||
return SpecialPropertyAssignmentKind.PrototypeProperty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user