mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into navbar_root
This commit is contained in:
+13
-5
@@ -1880,12 +1880,20 @@ namespace ts {
|
||||
}
|
||||
|
||||
function bindThisPropertyAssignment(node: BinaryExpression) {
|
||||
// Declare a 'member' in case it turns out the container was an ES5 class
|
||||
if (container.kind === SyntaxKind.FunctionExpression || container.kind === SyntaxKind.FunctionDeclaration) {
|
||||
container.symbol.members = container.symbol.members || {};
|
||||
// It's acceptable for multiple 'this' assignments of the same identifier to occur
|
||||
declareSymbol(container.symbol.members, container.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
|
||||
// Declare a 'member' in case it turns out the container was an ES5 class or ES6 constructor
|
||||
let assignee: Node;
|
||||
if (container.kind === SyntaxKind.FunctionDeclaration || container.kind === SyntaxKind.FunctionDeclaration) {
|
||||
assignee = container;
|
||||
}
|
||||
else if (container.kind === SyntaxKind.Constructor) {
|
||||
assignee = container.parent;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
assignee.symbol.members = assignee.symbol.members || {};
|
||||
// It's acceptable for multiple 'this' assignments of the same identifier to occur
|
||||
declareSymbol(assignee.symbol.members, assignee.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);
|
||||
}
|
||||
|
||||
function bindPrototypePropertyAssignment(node: BinaryExpression) {
|
||||
|
||||
+28
-18
@@ -5359,17 +5359,17 @@ const _super = (function (geti, seti) {
|
||||
//
|
||||
// TypeScript | Javascript
|
||||
// --------------------------------|------------------------------------
|
||||
// @dec | let C_1;
|
||||
// class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// @dec | let C_1 = class C {
|
||||
// class C { | static x() { return C_1.y; }
|
||||
// static x() { return C.y; } | }
|
||||
// static y = 1; | let C = C_1;
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// --------------------------------|------------------------------------
|
||||
// @dec | let C_1;
|
||||
// export class C { | export let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// @dec | let C_1 = class C {
|
||||
// export class C { | static x() { return C_1.y; }
|
||||
// static x() { return C.y; } | }
|
||||
// static y = 1; | export let C = C_1;
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -5398,10 +5398,10 @@ const _super = (function (geti, seti) {
|
||||
//
|
||||
// TypeScript | Javascript
|
||||
// --------------------------------|------------------------------------
|
||||
// @dec | let C_1;
|
||||
// export default class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// @dec | let C_1 = class C {
|
||||
// export default class C { | static x() { return C_1.y; }
|
||||
// static x() { return C.y; } | };
|
||||
// static y = 1; | let C = C_1;
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// | export default C;
|
||||
@@ -5410,25 +5410,25 @@ const _super = (function (geti, seti) {
|
||||
//
|
||||
|
||||
// NOTE: we reuse the same rewriting logic for cases when targeting ES6 and module kind is System.
|
||||
// Because of hoisting top level class declaration need to be emitted as class expressions.
|
||||
// Because of hoisting top level class declaration need to be emitted as class expressions.
|
||||
// Double bind case is only required if node is decorated.
|
||||
if (isDecorated && resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithBodyScopedClassBinding) {
|
||||
decoratedClassAlias = unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default"));
|
||||
decoratedClassAliases[getNodeId(node)] = decoratedClassAlias;
|
||||
write(`let ${decoratedClassAlias};`);
|
||||
writeLine();
|
||||
}
|
||||
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) {
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default) && decoratedClassAlias === undefined) {
|
||||
write("export ");
|
||||
}
|
||||
|
||||
if (!isHoistedDeclarationInSystemModule) {
|
||||
write("let ");
|
||||
}
|
||||
emitDeclarationName(node);
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write(` = ${decoratedClassAlias}`);
|
||||
write(`${decoratedClassAlias}`);
|
||||
}
|
||||
else {
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
|
||||
write(" = ");
|
||||
@@ -5490,6 +5490,16 @@ const _super = (function (geti, seti) {
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
|
||||
if (rewriteAsClassExpression) {
|
||||
if (decoratedClassAlias !== undefined) {
|
||||
write(";");
|
||||
writeLine();
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) {
|
||||
write("export ");
|
||||
}
|
||||
write("let ");
|
||||
emitDeclarationName(node);
|
||||
write(` = ${decoratedClassAlias}`);
|
||||
}
|
||||
decoratedClassAliases[getNodeId(node)] = undefined;
|
||||
write(";");
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ namespace ts.NavigationBar {
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
childNodes.push(node);
|
||||
break;
|
||||
}
|
||||
@@ -330,6 +331,8 @@ namespace ts.NavigationBar {
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return createItem(node, getTextOfNode((<InterfaceDeclaration>node).name), ts.ScriptElementKind.interfaceElement);
|
||||
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
return createItem(node, getTextOfNode((<TypeAliasDeclaration>node).name), ts.ScriptElementKind.typeElement);
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
return createItem(node, "()", ts.ScriptElementKind.callSignatureElement);
|
||||
|
||||
Reference in New Issue
Block a user