mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #1635 from Microsoft/recoverFromForcePush
Recover from force push
This commit is contained in:
+12
-6
@@ -1575,7 +1575,6 @@ module ts {
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.Parameter:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
case SyntaxKind.TypeParameter:
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
@@ -1585,7 +1584,9 @@ module ts {
|
||||
case SyntaxKind.UnionType:
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return isDeclarationVisible(<Declaration>node.parent);
|
||||
|
||||
|
||||
// Type parameters are always visible
|
||||
case SyntaxKind.TypeParameter:
|
||||
// Source file is always visible
|
||||
case SyntaxKind.SourceFile:
|
||||
return true;
|
||||
@@ -3651,9 +3652,7 @@ module ts {
|
||||
var maybeCache = maybeStack[depth];
|
||||
// If result is definitely true, copy assumptions to global cache, else copy to next level up
|
||||
var destinationCache = result === Ternary.True || depth === 0 ? relation : maybeStack[depth - 1];
|
||||
for (var p in maybeCache) {
|
||||
destinationCache[p] = maybeCache[p];
|
||||
}
|
||||
copyMap(/*source*/maybeCache, /*target*/destinationCache);
|
||||
}
|
||||
else {
|
||||
// A false result goes straight into global cache (when something is false under assumptions it
|
||||
@@ -9000,7 +8999,12 @@ module ts {
|
||||
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
|
||||
checkExportsOnMergedDeclarations(node);
|
||||
var symbol = getSymbolOfNode(node);
|
||||
if (symbol.flags & SymbolFlags.ValueModule && symbol.declarations.length > 1 && !isInAmbientContext(node)) {
|
||||
|
||||
// The following checks only apply on a non-ambient instantiated module declaration.
|
||||
if (symbol.flags & SymbolFlags.ValueModule
|
||||
&& symbol.declarations.length > 1
|
||||
&& !isInAmbientContext(node)
|
||||
&& isInstantiatedModule(node, compilerOptions.preserveConstEnums)) {
|
||||
var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
|
||||
if (classOrFunc) {
|
||||
if (getSourceFileOfNode(node) !== getSourceFileOfNode(classOrFunc)) {
|
||||
@@ -9011,6 +9015,8 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checks for ambient external modules.
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
if (!isGlobalSourceFile(node.parent)) {
|
||||
error(node.name, Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules);
|
||||
|
||||
@@ -208,6 +208,12 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
export function copyMap<T>(source: Map<T>, target: Map<T>): void {
|
||||
for (var p in source) {
|
||||
target[p] = source[p];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a map from the elements of an array.
|
||||
*
|
||||
|
||||
+42
-18
@@ -1461,18 +1461,7 @@ module ts {
|
||||
referencePathsOutput,
|
||||
}
|
||||
}
|
||||
|
||||
export interface EmitHost extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
|
||||
getCommonSourceDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
|
||||
writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
|
||||
|
||||
export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] {
|
||||
var diagnostics: Diagnostic[] = [];
|
||||
var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js");
|
||||
@@ -2068,9 +2057,15 @@ module ts {
|
||||
write("(");
|
||||
}
|
||||
|
||||
emitLiteral(node.head);
|
||||
var headEmitted = false;
|
||||
if (shouldEmitTemplateHead()) {
|
||||
emitLiteral(node.head);
|
||||
headEmitted = true;
|
||||
}
|
||||
|
||||
for (var i = 0; i < node.templateSpans.length; i++) {
|
||||
var templateSpan = node.templateSpans[i];
|
||||
|
||||
forEach(node.templateSpans, templateSpan => {
|
||||
// Check if the expression has operands and binds its operands less closely than binary '+'.
|
||||
// If it does, we need to wrap the expression in parentheses. Otherwise, something like
|
||||
// `abc${ 1 << 2 }`
|
||||
@@ -2082,7 +2077,14 @@ module ts {
|
||||
// "abc" + (1 << 2) + ""
|
||||
var needsParens = templateSpan.expression.kind !== SyntaxKind.ParenthesizedExpression
|
||||
&& comparePrecedenceToBinaryPlus(templateSpan.expression) !== Comparison.GreaterThan;
|
||||
write(" + ");
|
||||
|
||||
if (i > 0 || headEmitted) {
|
||||
// If this is the first span and the head was not emitted, then this templateSpan's
|
||||
// expression will be the first to be emitted. Don't emit the preceding ' + ' in that
|
||||
// case.
|
||||
write(" + ");
|
||||
}
|
||||
|
||||
emitParenthesized(templateSpan.expression, needsParens);
|
||||
// Only emit if the literal is non-empty.
|
||||
// The binary '+' operator is left-associative, so the first string concatenation
|
||||
@@ -2092,12 +2094,34 @@ module ts {
|
||||
write(" + ")
|
||||
emitLiteral(templateSpan.literal);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (emitOuterParens) {
|
||||
write(")");
|
||||
}
|
||||
|
||||
function shouldEmitTemplateHead() {
|
||||
// If this expression has an empty head literal and the first template span has a non-empty
|
||||
// literal, then emitting the empty head literal is not necessary.
|
||||
// `${ foo } and ${ bar }`
|
||||
// can be emitted as
|
||||
// foo + " and " + bar
|
||||
// This is because it is only required that one of the first two operands in the emit
|
||||
// output must be a string literal, so that the other operand and all following operands
|
||||
// are forced into strings.
|
||||
//
|
||||
// If the first template span has an empty literal, then the head must still be emitted.
|
||||
// `${ foo }${ bar }`
|
||||
// must still be emitted as
|
||||
// "" + foo + bar
|
||||
|
||||
// There is always atleast one templateSpan in this code path, since
|
||||
// NoSubstitutionTemplateLiterals are directly emitted via emitLiteral()
|
||||
Debug.assert(node.templateSpans.length !== 0);
|
||||
|
||||
return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0;
|
||||
}
|
||||
|
||||
function templateNeedsParens(template: TemplateExpression, parent: Expression) {
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.CallExpression:
|
||||
@@ -3686,8 +3710,8 @@ module ts {
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
var shouldEmit = getModuleInstanceState(node) === ModuleInstanceState.Instantiated ||
|
||||
(getModuleInstanceState(node) === ModuleInstanceState.ConstEnumOnly && compilerOptions.preserveConstEnums);
|
||||
// Emit only if this module is non-ambient.
|
||||
var shouldEmit = isInstantiatedModule(node, compilerOptions.preserveConstEnums);
|
||||
|
||||
if (!shouldEmit) {
|
||||
return emitPinnedOrTripleSlashComments(node);
|
||||
|
||||
@@ -23,6 +23,17 @@ module ts {
|
||||
string(): string;
|
||||
}
|
||||
|
||||
export interface EmitHost extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
|
||||
getCommonSourceDirectory(): string;
|
||||
getCanonicalFileName(fileName: string): string;
|
||||
getNewLine(): string;
|
||||
|
||||
writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
|
||||
}
|
||||
|
||||
// Pool writers to avoid needing to allocate them for every symbol we write.
|
||||
var stringWriters: StringSymbolWriter[] = [];
|
||||
export function getSingleLineStringWriter(): StringSymbolWriter {
|
||||
@@ -525,6 +536,12 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) {
|
||||
var moduleState = getModuleInstanceState(node)
|
||||
return moduleState === ModuleInstanceState.Instantiated ||
|
||||
(preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly);
|
||||
}
|
||||
|
||||
export function isExternalModuleImportDeclaration(node: Node) {
|
||||
return node.kind === SyntaxKind.ImportDeclaration && (<ImportDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts(2,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
|
||||
|
||||
|
||||
==== tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts (1 errors) ====
|
||||
// Non-ambient & instantiated module.
|
||||
module Moclodule {
|
||||
~~~~~~~~~
|
||||
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
|
||||
export interface Someinterface {
|
||||
foo(): void;
|
||||
}
|
||||
var x = 10;
|
||||
}
|
||||
|
||||
class Moclodule {
|
||||
}
|
||||
|
||||
// Instantiated module.
|
||||
module Moclodule {
|
||||
export class Manager {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//// [cloduleWithPriorInstantiatedModule.ts]
|
||||
// Non-ambient & instantiated module.
|
||||
module Moclodule {
|
||||
export interface Someinterface {
|
||||
foo(): void;
|
||||
}
|
||||
var x = 10;
|
||||
}
|
||||
|
||||
class Moclodule {
|
||||
}
|
||||
|
||||
// Instantiated module.
|
||||
module Moclodule {
|
||||
export class Manager {
|
||||
}
|
||||
}
|
||||
|
||||
//// [cloduleWithPriorInstantiatedModule.js]
|
||||
// Non-ambient & instantiated module.
|
||||
var Moclodule;
|
||||
(function (Moclodule) {
|
||||
var x = 10;
|
||||
})(Moclodule || (Moclodule = {}));
|
||||
var Moclodule = (function () {
|
||||
function Moclodule() {
|
||||
}
|
||||
return Moclodule;
|
||||
})();
|
||||
// Instantiated module.
|
||||
var Moclodule;
|
||||
(function (Moclodule) {
|
||||
var Manager = (function () {
|
||||
function Manager() {
|
||||
}
|
||||
return Manager;
|
||||
})();
|
||||
Moclodule.Manager = Manager;
|
||||
})(Moclodule || (Moclodule = {}));
|
||||
@@ -0,0 +1,33 @@
|
||||
//// [cloduleWithPriorUninstantiatedModule.ts]
|
||||
// Non-ambient & uninstantiated module.
|
||||
module Moclodule {
|
||||
export interface Someinterface {
|
||||
foo(): void;
|
||||
}
|
||||
}
|
||||
|
||||
class Moclodule {
|
||||
}
|
||||
|
||||
// Instantiated module.
|
||||
module Moclodule {
|
||||
export class Manager {
|
||||
}
|
||||
}
|
||||
|
||||
//// [cloduleWithPriorUninstantiatedModule.js]
|
||||
var Moclodule = (function () {
|
||||
function Moclodule() {
|
||||
}
|
||||
return Moclodule;
|
||||
})();
|
||||
// Instantiated module.
|
||||
var Moclodule;
|
||||
(function (Moclodule) {
|
||||
var Manager = (function () {
|
||||
function Manager() {
|
||||
}
|
||||
return Manager;
|
||||
})();
|
||||
Moclodule.Manager = Manager;
|
||||
})(Moclodule || (Moclodule = {}));
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/compiler/cloduleWithPriorUninstantiatedModule.ts ===
|
||||
// Non-ambient & uninstantiated module.
|
||||
module Moclodule {
|
||||
>Moclodule : typeof Moclodule
|
||||
|
||||
export interface Someinterface {
|
||||
>Someinterface : Someinterface
|
||||
|
||||
foo(): void;
|
||||
>foo : () => void
|
||||
}
|
||||
}
|
||||
|
||||
class Moclodule {
|
||||
>Moclodule : Moclodule
|
||||
}
|
||||
|
||||
// Instantiated module.
|
||||
module Moclodule {
|
||||
>Moclodule : typeof Moclodule
|
||||
|
||||
export class Manager {
|
||||
>Manager : Manager
|
||||
}
|
||||
}
|
||||
@@ -55,49 +55,49 @@ var l4 = 1 + `2${ 3 & 4 }5` + 6;
|
||||
//// [templateStringBinaryOperations.js]
|
||||
var a = 1 + ("" + 3);
|
||||
var b = 1 + ("2" + 3);
|
||||
var c = 1 + ("" + 3 + "4");
|
||||
var c = 1 + (3 + "4");
|
||||
var d = 1 + ("2" + 3 + "4");
|
||||
var e = ("" + 3) + 5;
|
||||
var f = ("2" + 3) + 5;
|
||||
var g = ("" + 3 + "4") + 5;
|
||||
var g = (3 + "4") + 5;
|
||||
var h = ("2" + 3 + "4") + 5;
|
||||
var i = 1 + ("" + 3) + 5;
|
||||
var j = 1 + ("2" + 3) + 5;
|
||||
var k = 1 + ("" + 3 + "4") + 5;
|
||||
var k = 1 + (3 + "4") + 5;
|
||||
var l = 1 + ("2" + 3 + "4") + 5;
|
||||
var a2 = 1 + ("" + (3 - 4));
|
||||
var b2 = 1 + ("2" + (3 - 4));
|
||||
var c2 = 1 + ("" + (3 - 4) + "5");
|
||||
var c2 = 1 + ((3 - 4) + "5");
|
||||
var d2 = 1 + ("2" + (3 - 4) + "5");
|
||||
var e2 = ("" + (3 - 4)) + 6;
|
||||
var f2 = ("2" + (3 - 4)) + 6;
|
||||
var g2 = ("" + (3 - 4) + "5") + 6;
|
||||
var g2 = ((3 - 4) + "5") + 6;
|
||||
var h2 = ("2" + (3 - 4) + "5") + 6;
|
||||
var i2 = 1 + ("" + (3 - 4)) + 6;
|
||||
var j2 = 1 + ("2" + (3 - 4)) + 6;
|
||||
var k2 = 1 + ("" + (3 - 4) + "5") + 6;
|
||||
var k2 = 1 + ((3 - 4) + "5") + 6;
|
||||
var l2 = 1 + ("2" + (3 - 4) + "5") + 6;
|
||||
var a3 = 1 + ("" + 3 * 4);
|
||||
var b3 = 1 + ("2" + 3 * 4);
|
||||
var c3 = 1 + ("" + 3 * 4 + "5");
|
||||
var c3 = 1 + (3 * 4 + "5");
|
||||
var d3 = 1 + ("2" + 3 * 4 + "5");
|
||||
var e3 = ("" + 3 * 4) + 6;
|
||||
var f3 = ("2" + 3 * 4) + 6;
|
||||
var g3 = ("" + 3 * 4 + "5") + 6;
|
||||
var g3 = (3 * 4 + "5") + 6;
|
||||
var h3 = ("2" + 3 * 4 + "5") + 6;
|
||||
var i3 = 1 + ("" + 3 * 4) + 6;
|
||||
var j3 = 1 + ("2" + 3 * 4) + 6;
|
||||
var k3 = 1 + ("" + 3 * 4 + "5") + 6;
|
||||
var k3 = 1 + (3 * 4 + "5") + 6;
|
||||
var l3 = 1 + ("2" + 3 * 4 + "5") + 6;
|
||||
var a4 = 1 + ("" + (3 & 4));
|
||||
var b4 = 1 + ("2" + (3 & 4));
|
||||
var c4 = 1 + ("" + (3 & 4) + "5");
|
||||
var c4 = 1 + ((3 & 4) + "5");
|
||||
var d4 = 1 + ("2" + (3 & 4) + "5");
|
||||
var e4 = ("" + (3 & 4)) + 6;
|
||||
var f4 = ("2" + (3 & 4)) + 6;
|
||||
var g4 = ("" + (3 & 4) + "5") + 6;
|
||||
var g4 = ((3 & 4) + "5") + 6;
|
||||
var h4 = ("2" + (3 & 4) + "5") + 6;
|
||||
var i4 = 1 + ("" + (3 & 4)) + 6;
|
||||
var j4 = 1 + ("2" + (3 & 4)) + 6;
|
||||
var k4 = 1 + ("" + (3 & 4) + "5") + 6;
|
||||
var k4 = 1 + ((3 & 4) + "5") + 6;
|
||||
var l4 = 1 + ("2" + (3 & 4) + "5") + 6;
|
||||
|
||||
@@ -111,97 +111,97 @@ var hc = `2${ 3 & 4 }5` & 6;
|
||||
//// [templateStringBinaryOperationsInvalid.js]
|
||||
var a = 1 - ("" + 3);
|
||||
var b = 1 - ("2" + 3);
|
||||
var c = 1 - ("" + 3 + "4");
|
||||
var c = 1 - (3 + "4");
|
||||
var d = 1 - ("2" + 3 + "4");
|
||||
var e = ("" + 3) - 5;
|
||||
var f = ("2" + 3) - 5;
|
||||
var g = ("" + 3 + "4") - 5;
|
||||
var g = (3 + "4") - 5;
|
||||
var h = ("2" + 3 + "4") - 5;
|
||||
var a2 = 1 * ("" + 3);
|
||||
var b2 = 1 * ("2" + 3);
|
||||
var c2 = 1 * ("" + 3 + "4");
|
||||
var c2 = 1 * (3 + "4");
|
||||
var d2 = 1 * ("2" + 3 + "4");
|
||||
var e2 = ("" + 3) * 5;
|
||||
var f2 = ("2" + 3) * 5;
|
||||
var g2 = ("" + 3 + "4") * 5;
|
||||
var g2 = (3 + "4") * 5;
|
||||
var h2 = ("2" + 3 + "4") * 5;
|
||||
var a3 = 1 & "" + 3;
|
||||
var b3 = 1 & "2" + 3;
|
||||
var c3 = 1 & "" + 3 + "4";
|
||||
var c3 = 1 & 3 + "4";
|
||||
var d3 = 1 & "2" + 3 + "4";
|
||||
var e3 = "" + 3 & 5;
|
||||
var f3 = "2" + 3 & 5;
|
||||
var g3 = "" + 3 + "4" & 5;
|
||||
var g3 = 3 + "4" & 5;
|
||||
var h3 = "2" + 3 + "4" & 5;
|
||||
var a4 = 1 - ("" + (3 - 4));
|
||||
var b4 = 1 - ("2" + (3 - 4));
|
||||
var c4 = 1 - ("" + (3 - 4) + "5");
|
||||
var c4 = 1 - ((3 - 4) + "5");
|
||||
var d4 = 1 - ("2" + (3 - 4) + "5");
|
||||
var e4 = ("" + (3 - 4)) - 6;
|
||||
var f4 = ("2" + (3 - 4)) - 6;
|
||||
var g4 = ("" + (3 - 4) + "5") - 6;
|
||||
var g4 = ((3 - 4) + "5") - 6;
|
||||
var h4 = ("2" + (3 - 4) + "5") - 6;
|
||||
var a5 = 1 - ("" + 3 * 4);
|
||||
var b5 = 1 - ("2" + 3 * 4);
|
||||
var c5 = 1 - ("" + 3 * 4 + "5");
|
||||
var c5 = 1 - (3 * 4 + "5");
|
||||
var d5 = 1 - ("2" + 3 * 4 + "5");
|
||||
var e5 = ("" + 3 * 4) - 6;
|
||||
var f5 = ("2" + 3 * 4) - 6;
|
||||
var g5 = ("" + 3 * 4 + "5") - 6;
|
||||
var g5 = (3 * 4 + "5") - 6;
|
||||
var h5 = ("2" + 3 * 4 + "5") - 6;
|
||||
var a6 = 1 - ("" + (3 & 4));
|
||||
var b6 = 1 - ("2" + (3 & 4));
|
||||
var c6 = 1 - ("" + (3 & 4) + "5");
|
||||
var c6 = 1 - ((3 & 4) + "5");
|
||||
var d6 = 1 - ("2" + (3 & 4) + "5");
|
||||
var e6 = ("" + (3 & 4)) - 6;
|
||||
var f6 = ("2" + (3 & 4)) - 6;
|
||||
var g6 = ("" + (3 & 4) + "5") - 6;
|
||||
var g6 = ((3 & 4) + "5") - 6;
|
||||
var h6 = ("2" + (3 & 4) + "5") - 6;
|
||||
var a7 = 1 * ("" + (3 - 4));
|
||||
var b7 = 1 * ("2" + (3 - 4));
|
||||
var c7 = 1 * ("" + (3 - 4) + "5");
|
||||
var c7 = 1 * ((3 - 4) + "5");
|
||||
var d7 = 1 * ("2" + (3 - 4) + "5");
|
||||
var e7 = ("" + (3 - 4)) * 6;
|
||||
var f7 = ("2" + (3 - 4)) * 6;
|
||||
var g7 = ("" + (3 - 4) + "5") * 6;
|
||||
var g7 = ((3 - 4) + "5") * 6;
|
||||
var h7 = ("2" + (3 - 4) + "5") * 6;
|
||||
var a8 = 1 * ("" + 3 * 4);
|
||||
var b8 = 1 * ("2" + 3 * 4);
|
||||
var c8 = 1 * ("" + 3 * 4 + "5");
|
||||
var c8 = 1 * (3 * 4 + "5");
|
||||
var d8 = 1 * ("2" + 3 * 4 + "5");
|
||||
var e8 = ("" + 3 * 4) * 6;
|
||||
var f8 = ("2" + 3 * 4) * 6;
|
||||
var g8 = ("" + 3 * 4 + "5") * 6;
|
||||
var g8 = (3 * 4 + "5") * 6;
|
||||
var h8 = ("2" + 3 * 4 + "5") * 6;
|
||||
var a9 = 1 * ("" + (3 & 4));
|
||||
var b9 = 1 * ("2" + (3 & 4));
|
||||
var c9 = 1 * ("" + (3 & 4) + "5");
|
||||
var c9 = 1 * ((3 & 4) + "5");
|
||||
var d9 = 1 * ("2" + (3 & 4) + "5");
|
||||
var e9 = ("" + (3 & 4)) * 6;
|
||||
var f9 = ("2" + (3 & 4)) * 6;
|
||||
var g9 = ("" + (3 & 4) + "5") * 6;
|
||||
var g9 = ((3 & 4) + "5") * 6;
|
||||
var h9 = ("2" + (3 & 4) + "5") * 6;
|
||||
var aa = 1 & "" + (3 - 4);
|
||||
var ba = 1 & "2" + (3 - 4);
|
||||
var ca = 1 & "" + (3 - 4) + "5";
|
||||
var ca = 1 & (3 - 4) + "5";
|
||||
var da = 1 & "2" + (3 - 4) + "5";
|
||||
var ea = "" + (3 - 4) & 6;
|
||||
var fa = "2" + (3 - 4) & 6;
|
||||
var ga = "" + (3 - 4) + "5" & 6;
|
||||
var ga = (3 - 4) + "5" & 6;
|
||||
var ha = "2" + (3 - 4) + "5" & 6;
|
||||
var ab = 1 & "" + 3 * 4;
|
||||
var bb = 1 & "2" + 3 * 4;
|
||||
var cb = 1 & "" + 3 * 4 + "5";
|
||||
var cb = 1 & 3 * 4 + "5";
|
||||
var db = 1 & "2" + 3 * 4 + "5";
|
||||
var eb = "" + 3 * 4 & 6;
|
||||
var fb = "2" + 3 * 4 & 6;
|
||||
var gb = "" + 3 * 4 + "5" & 6;
|
||||
var gb = 3 * 4 + "5" & 6;
|
||||
var hb = "2" + 3 * 4 + "5" & 6;
|
||||
var ac = 1 & "" + (3 & 4);
|
||||
var bc = 1 & "2" + (3 & 4);
|
||||
var cc = 1 & "" + (3 & 4) + "5";
|
||||
var cc = 1 & (3 & 4) + "5";
|
||||
var dc = 1 & "2" + (3 & 4) + "5";
|
||||
var ec = "" + (3 & 4) & 6;
|
||||
var fc = "2" + (3 & 4) & 6;
|
||||
var gc = "" + (3 & 4) + "5" & 6;
|
||||
var gc = (3 & 4) + "5" & 6;
|
||||
var hc = "2" + (3 & 4) + "5" & 6;
|
||||
|
||||
@@ -21,18 +21,22 @@ var j = `${ 0 }${ 0 }3`;
|
||||
|
||||
var k = `1${ 0 }${ 0 }3`;
|
||||
|
||||
var l = `1${ 0 }2${ 0 }3`;
|
||||
var l = `${ 0 }2${ 0 }3`;
|
||||
|
||||
var m = `1${ 0 }2${ 0 }3`;
|
||||
|
||||
|
||||
//// [templateStringWithEmptyLiteralPortions.js]
|
||||
var a = "";
|
||||
var b = "" + 0;
|
||||
var c = "1" + 0;
|
||||
var d = "" + 0 + "2";
|
||||
var d = 0 + "2";
|
||||
var e = "1" + 0 + "2";
|
||||
var f = "" + 0 + 0;
|
||||
var g = "1" + 0 + 0;
|
||||
var h = "" + 0 + "2" + 0;
|
||||
var h = 0 + "2" + 0;
|
||||
var i = "1" + 0 + "2" + 0;
|
||||
var j = "" + 0 + 0 + "3";
|
||||
var k = "1" + 0 + 0 + "3";
|
||||
var l = "1" + 0 + "2" + 0 + "3";
|
||||
var l = 0 + "2" + 0 + "3";
|
||||
var m = "1" + 0 + "2" + 0 + "3";
|
||||
|
||||
@@ -32,6 +32,9 @@ var j = `${ 0 }${ 0 }3`;
|
||||
var k = `1${ 0 }${ 0 }3`;
|
||||
>k : string
|
||||
|
||||
var l = `1${ 0 }2${ 0 }3`;
|
||||
var l = `${ 0 }2${ 0 }3`;
|
||||
>l : string
|
||||
|
||||
var m = `1${ 0 }2${ 0 }3`;
|
||||
>m : string
|
||||
|
||||
|
||||
@@ -21,7 +21,10 @@ var j = `${ 0 }${ 0 }3`;
|
||||
|
||||
var k = `1${ 0 }${ 0 }3`;
|
||||
|
||||
var l = `1${ 0 }2${ 0 }3`;
|
||||
var l = `${ 0 }2${ 0 }3`;
|
||||
|
||||
var m = `1${ 0 }2${ 0 }3`;
|
||||
|
||||
|
||||
//// [templateStringWithEmptyLiteralPortionsES6.js]
|
||||
var a = ``;
|
||||
@@ -35,4 +38,5 @@ var h = `${0}2${0}`;
|
||||
var i = `1${0}2${0}`;
|
||||
var j = `${0}${0}3`;
|
||||
var k = `1${0}${0}3`;
|
||||
var l = `1${0}2${0}3`;
|
||||
var l = `${0}2${0}3`;
|
||||
var m = `1${0}2${0}3`;
|
||||
|
||||
@@ -32,6 +32,9 @@ var j = `${ 0 }${ 0 }3`;
|
||||
var k = `1${ 0 }${ 0 }3`;
|
||||
>k : string
|
||||
|
||||
var l = `1${ 0 }2${ 0 }3`;
|
||||
var l = `${ 0 }2${ 0 }3`;
|
||||
>l : string
|
||||
|
||||
var m = `1${ 0 }2${ 0 }3`;
|
||||
>m : string
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [visibilityOfTypeParameters.ts]
|
||||
|
||||
export class MyClass {
|
||||
protected myMethod<T>(val: T): T {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
//// [visibilityOfTypeParameters.js]
|
||||
var MyClass = (function () {
|
||||
function MyClass() {
|
||||
}
|
||||
MyClass.prototype.myMethod = function (val) {
|
||||
return val;
|
||||
};
|
||||
return MyClass;
|
||||
})();
|
||||
exports.MyClass = MyClass;
|
||||
|
||||
|
||||
//// [visibilityOfTypeParameters.d.ts]
|
||||
export declare class MyClass {
|
||||
protected myMethod<T>(val: T): T;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
=== tests/cases/compiler/visibilityOfTypeParameters.ts ===
|
||||
|
||||
export class MyClass {
|
||||
>MyClass : MyClass
|
||||
|
||||
protected myMethod<T>(val: T): T {
|
||||
>myMethod : <T>(val: T) => T
|
||||
>T : T
|
||||
>val : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
return val;
|
||||
>val : T
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Non-ambient & instantiated module.
|
||||
module Moclodule {
|
||||
export interface Someinterface {
|
||||
foo(): void;
|
||||
}
|
||||
var x = 10;
|
||||
}
|
||||
|
||||
class Moclodule {
|
||||
}
|
||||
|
||||
// Instantiated module.
|
||||
module Moclodule {
|
||||
export class Manager {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Non-ambient & uninstantiated module.
|
||||
module Moclodule {
|
||||
export interface Someinterface {
|
||||
foo(): void;
|
||||
}
|
||||
}
|
||||
|
||||
class Moclodule {
|
||||
}
|
||||
|
||||
// Instantiated module.
|
||||
module Moclodule {
|
||||
export class Manager {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// @module:commonjs
|
||||
//@declaration: true
|
||||
|
||||
export class MyClass {
|
||||
protected myMethod<T>(val: T): T {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
@@ -20,4 +20,6 @@ var j = `${ 0 }${ 0 }3`;
|
||||
|
||||
var k = `1${ 0 }${ 0 }3`;
|
||||
|
||||
var l = `1${ 0 }2${ 0 }3`;
|
||||
var l = `${ 0 }2${ 0 }3`;
|
||||
|
||||
var m = `1${ 0 }2${ 0 }3`;
|
||||
|
||||
@@ -21,4 +21,6 @@ var j = `${ 0 }${ 0 }3`;
|
||||
|
||||
var k = `1${ 0 }${ 0 }3`;
|
||||
|
||||
var l = `1${ 0 }2${ 0 }3`;
|
||||
var l = `${ 0 }2${ 0 }3`;
|
||||
|
||||
var m = `1${ 0 }2${ 0 }3`;
|
||||
|
||||
Reference in New Issue
Block a user