Merge branch 'master' into fixDeFaultOfFindAllRefsToMaster
This commit is contained in:
commit
eeec05d5a9
|
@ -103,7 +103,7 @@ var serverSources = [
|
||||||
"server.ts"
|
"server.ts"
|
||||||
].map(function (f) {
|
].map(function (f) {
|
||||||
return path.join(serverDirectory, f);
|
return path.join(serverDirectory, f);
|
||||||
});
|
}).concat(servicesSources);
|
||||||
|
|
||||||
var languageServiceLibrarySources = [
|
var languageServiceLibrarySources = [
|
||||||
"editorServices.ts",
|
"editorServices.ts",
|
||||||
|
|
4
bin/lib.core.es6.d.ts
vendored
4
bin/lib.core.es6.d.ts
vendored
|
@ -1880,6 +1880,7 @@ interface Map<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MapConstructor {
|
interface MapConstructor {
|
||||||
|
new (): Map<any, any>;
|
||||||
new <K, V>(): Map<K, V>;
|
new <K, V>(): Map<K, V>;
|
||||||
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
|
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
|
||||||
prototype: Map<any, any>;
|
prototype: Map<any, any>;
|
||||||
|
@ -1896,6 +1897,7 @@ interface WeakMap<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WeakMapConstructor {
|
interface WeakMapConstructor {
|
||||||
|
new (): WeakMap<any, any>;
|
||||||
new <K, V>(): WeakMap<K, V>;
|
new <K, V>(): WeakMap<K, V>;
|
||||||
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
|
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
|
||||||
prototype: WeakMap<any, any>;
|
prototype: WeakMap<any, any>;
|
||||||
|
@ -1917,6 +1919,7 @@ interface Set<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SetConstructor {
|
interface SetConstructor {
|
||||||
|
new (): Set<any>;
|
||||||
new <T>(): Set<T>;
|
new <T>(): Set<T>;
|
||||||
new <T>(iterable: Iterable<T>): Set<T>;
|
new <T>(iterable: Iterable<T>): Set<T>;
|
||||||
prototype: Set<any>;
|
prototype: Set<any>;
|
||||||
|
@ -1932,6 +1935,7 @@ interface WeakSet<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WeakSetConstructor {
|
interface WeakSetConstructor {
|
||||||
|
new (): WeakSet<any>;
|
||||||
new <T>(): WeakSet<T>;
|
new <T>(): WeakSet<T>;
|
||||||
new <T>(iterable: Iterable<T>): WeakSet<T>;
|
new <T>(iterable: Iterable<T>): WeakSet<T>;
|
||||||
prototype: WeakSet<any>;
|
prototype: WeakSet<any>;
|
||||||
|
|
4
bin/lib.es6.d.ts
vendored
4
bin/lib.es6.d.ts
vendored
|
@ -1880,6 +1880,7 @@ interface Map<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MapConstructor {
|
interface MapConstructor {
|
||||||
|
new (): Map<any, any>;
|
||||||
new <K, V>(): Map<K, V>;
|
new <K, V>(): Map<K, V>;
|
||||||
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
|
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
|
||||||
prototype: Map<any, any>;
|
prototype: Map<any, any>;
|
||||||
|
@ -1896,6 +1897,7 @@ interface WeakMap<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WeakMapConstructor {
|
interface WeakMapConstructor {
|
||||||
|
new (): WeakMap<any, any>;
|
||||||
new <K, V>(): WeakMap<K, V>;
|
new <K, V>(): WeakMap<K, V>;
|
||||||
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
|
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
|
||||||
prototype: WeakMap<any, any>;
|
prototype: WeakMap<any, any>;
|
||||||
|
@ -1917,6 +1919,7 @@ interface Set<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SetConstructor {
|
interface SetConstructor {
|
||||||
|
new (): Set<any>;
|
||||||
new <T>(): Set<T>;
|
new <T>(): Set<T>;
|
||||||
new <T>(iterable: Iterable<T>): Set<T>;
|
new <T>(iterable: Iterable<T>): Set<T>;
|
||||||
prototype: Set<any>;
|
prototype: Set<any>;
|
||||||
|
@ -1932,6 +1935,7 @@ interface WeakSet<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WeakSetConstructor {
|
interface WeakSetConstructor {
|
||||||
|
new (): WeakSet<any>;
|
||||||
new <T>(): WeakSet<T>;
|
new <T>(): WeakSet<T>;
|
||||||
new <T>(iterable: Iterable<T>): WeakSet<T>;
|
new <T>(iterable: Iterable<T>): WeakSet<T>;
|
||||||
prototype: WeakSet<any>;
|
prototype: WeakSet<any>;
|
||||||
|
|
538
bin/tsc.js
538
bin/tsc.js
File diff suppressed because it is too large
Load diff
585
bin/tsserver.js
585
bin/tsserver.js
File diff suppressed because it is too large
Load diff
2
bin/typescript.d.ts
vendored
2
bin/typescript.d.ts
vendored
|
@ -600,7 +600,7 @@ declare module "typescript" {
|
||||||
tag: LeftHandSideExpression;
|
tag: LeftHandSideExpression;
|
||||||
template: LiteralExpression | TemplateExpression;
|
template: LiteralExpression | TemplateExpression;
|
||||||
}
|
}
|
||||||
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
|
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
|
||||||
interface TypeAssertion extends UnaryExpression {
|
interface TypeAssertion extends UnaryExpression {
|
||||||
type: TypeNode;
|
type: TypeNode;
|
||||||
expression: UnaryExpression;
|
expression: UnaryExpression;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
2
bin/typescriptServices.d.ts
vendored
2
bin/typescriptServices.d.ts
vendored
|
@ -600,7 +600,7 @@ declare namespace ts {
|
||||||
tag: LeftHandSideExpression;
|
tag: LeftHandSideExpression;
|
||||||
template: LiteralExpression | TemplateExpression;
|
template: LiteralExpression | TemplateExpression;
|
||||||
}
|
}
|
||||||
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
|
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
|
||||||
interface TypeAssertion extends UnaryExpression {
|
interface TypeAssertion extends UnaryExpression {
|
||||||
type: TypeNode;
|
type: TypeNode;
|
||||||
expression: UnaryExpression;
|
expression: UnaryExpression;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -630,7 +630,7 @@ namespace ts {
|
||||||
function getStrictModeIdentifierMessage(node: Node) {
|
function getStrictModeIdentifierMessage(node: Node) {
|
||||||
// Provide specialized messages to help the user understand why we think they're in
|
// Provide specialized messages to help the user understand why we think they're in
|
||||||
// strict mode.
|
// strict mode.
|
||||||
if (getAncestor(node, SyntaxKind.ClassDeclaration) || getAncestor(node, SyntaxKind.ClassExpression)) {
|
if (getContainingClass(node)) {
|
||||||
return Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;
|
return Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ namespace ts {
|
||||||
function getStrictModeEvalOrArgumentsMessage(node: Node) {
|
function getStrictModeEvalOrArgumentsMessage(node: Node) {
|
||||||
// Provide specialized messages to help the user understand why we think they're in
|
// Provide specialized messages to help the user understand why we think they're in
|
||||||
// strict mode.
|
// strict mode.
|
||||||
if (getAncestor(node, SyntaxKind.ClassDeclaration) || getAncestor(node, SyntaxKind.ClassExpression)) {
|
if (getContainingClass(node)) {
|
||||||
return Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;
|
return Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ namespace ts {
|
||||||
// containing class.
|
// containing class.
|
||||||
if (node.flags & NodeFlags.AccessibilityModifier &&
|
if (node.flags & NodeFlags.AccessibilityModifier &&
|
||||||
node.parent.kind === SyntaxKind.Constructor &&
|
node.parent.kind === SyntaxKind.Constructor &&
|
||||||
(node.parent.parent.kind === SyntaxKind.ClassDeclaration || node.parent.parent.kind === SyntaxKind.ClassExpression)) {
|
isClassLike(node.parent.parent)) {
|
||||||
|
|
||||||
let classDeclaration = <ClassLikeDeclaration>node.parent.parent;
|
let classDeclaration = <ClassLikeDeclaration>node.parent.parent;
|
||||||
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -40,7 +40,6 @@ namespace ts {
|
||||||
function emitDeclarations(host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[], jsFilePath: string, root?: SourceFile): DeclarationEmit {
|
function emitDeclarations(host: EmitHost, resolver: EmitResolver, diagnostics: Diagnostic[], jsFilePath: string, root?: SourceFile): DeclarationEmit {
|
||||||
let newLine = host.getNewLine();
|
let newLine = host.getNewLine();
|
||||||
let compilerOptions = host.getCompilerOptions();
|
let compilerOptions = host.getCompilerOptions();
|
||||||
let languageVersion = compilerOptions.target || ScriptTarget.ES3;
|
|
||||||
|
|
||||||
let write: (s: string) => void;
|
let write: (s: string) => void;
|
||||||
let writeLine: () => void;
|
let writeLine: () => void;
|
||||||
|
|
|
@ -191,6 +191,12 @@ namespace ts {
|
||||||
An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: DiagnosticCategory.Error, key: "An export declaration can only be used in a module." },
|
An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: DiagnosticCategory.Error, key: "An export declaration can only be used in a module." },
|
||||||
An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." },
|
An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: DiagnosticCategory.Error, key: "An ambient module declaration is only allowed at the top level in a file." },
|
||||||
A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." },
|
A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: DiagnosticCategory.Error, key: "A namespace declaration is only allowed in a namespace or module." },
|
||||||
|
The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: DiagnosticCategory.Error, key: "The return type of a property decorator function must be either 'void' or 'any'." },
|
||||||
|
The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: DiagnosticCategory.Error, key: "The return type of a parameter decorator function must be either 'void' or 'any'." },
|
||||||
|
Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: DiagnosticCategory.Error, key: "Unable to resolve signature of class decorator when called as an expression." },
|
||||||
|
Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: DiagnosticCategory.Error, key: "Unable to resolve signature of parameter decorator when called as an expression." },
|
||||||
|
Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: DiagnosticCategory.Error, key: "Unable to resolve signature of property decorator when called as an expression." },
|
||||||
|
Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: DiagnosticCategory.Error, key: "Unable to resolve signature of method decorator when called as an expression." },
|
||||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||||
|
@ -567,7 +573,5 @@ namespace ts {
|
||||||
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
|
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
|
||||||
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
|
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
|
||||||
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
|
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
|
||||||
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
|
|
||||||
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
|
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -753,6 +753,31 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"The return type of a property decorator function must be either 'void' or 'any'.": {
|
||||||
|
"category": "Error",
|
||||||
|
"code": 1236
|
||||||
|
},
|
||||||
|
"The return type of a parameter decorator function must be either 'void' or 'any'.": {
|
||||||
|
"category": "Error",
|
||||||
|
"code": 1237
|
||||||
|
},
|
||||||
|
"Unable to resolve signature of class decorator when called as an expression.": {
|
||||||
|
"category": "Error",
|
||||||
|
"code": 1238
|
||||||
|
},
|
||||||
|
"Unable to resolve signature of parameter decorator when called as an expression.": {
|
||||||
|
"category": "Error",
|
||||||
|
"code": 1239
|
||||||
|
},
|
||||||
|
"Unable to resolve signature of property decorator when called as an expression.": {
|
||||||
|
"category": "Error",
|
||||||
|
"code": 1240
|
||||||
|
},
|
||||||
|
"Unable to resolve signature of method decorator when called as an expression.": {
|
||||||
|
"category": "Error",
|
||||||
|
"code": 1241
|
||||||
|
},
|
||||||
|
|
||||||
"Duplicate identifier '{0}'.": {
|
"Duplicate identifier '{0}'.": {
|
||||||
"category": "Error",
|
"category": "Error",
|
||||||
"code": 2300
|
"code": 2300
|
||||||
|
@ -2259,14 +2284,5 @@
|
||||||
"'decorators' can only be used in a .ts file.": {
|
"'decorators' can only be used in a .ts file.": {
|
||||||
"category": "Error",
|
"category": "Error",
|
||||||
"code": 8017
|
"code": 8017
|
||||||
},
|
|
||||||
|
|
||||||
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
|
|
||||||
"category": "Error",
|
|
||||||
"code": 9002
|
|
||||||
},
|
|
||||||
"'class' expressions are not currently supported.": {
|
|
||||||
"category": "Error",
|
|
||||||
"code": 9003
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,6 +264,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||||
return makeUniqueName("default");
|
return makeUniqueName("default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateNameForClassExpression() {
|
||||||
|
return makeUniqueName("class");
|
||||||
|
}
|
||||||
|
|
||||||
function generateNameForNode(node: Node) {
|
function generateNameForNode(node: Node) {
|
||||||
switch (node.kind) {
|
switch (node.kind) {
|
||||||
case SyntaxKind.Identifier:
|
case SyntaxKind.Identifier:
|
||||||
|
@ -276,9 +280,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||||
return generateNameForImportOrExportDeclaration(<ImportDeclaration | ExportDeclaration>node);
|
return generateNameForImportOrExportDeclaration(<ImportDeclaration | ExportDeclaration>node);
|
||||||
case SyntaxKind.FunctionDeclaration:
|
case SyntaxKind.FunctionDeclaration:
|
||||||
case SyntaxKind.ClassDeclaration:
|
case SyntaxKind.ClassDeclaration:
|
||||||
case SyntaxKind.ClassExpression:
|
|
||||||
case SyntaxKind.ExportAssignment:
|
case SyntaxKind.ExportAssignment:
|
||||||
return generateNameForExportDefault();
|
return generateNameForExportDefault();
|
||||||
|
case SyntaxKind.ClassExpression:
|
||||||
|
return generateNameForClassExpression();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1778,7 +1783,21 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||||
|
|
||||||
emit(node.expression);
|
emit(node.expression);
|
||||||
let indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken);
|
let indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken);
|
||||||
write(".");
|
|
||||||
|
// 1 .toString is a valid property access, emit a space after the literal
|
||||||
|
let shouldEmitSpace: boolean;
|
||||||
|
if (!indentedBeforeDot && node.expression.kind === SyntaxKind.NumericLiteral) {
|
||||||
|
let text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression);
|
||||||
|
shouldEmitSpace = text.indexOf(tokenToString(SyntaxKind.DotToken)) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldEmitSpace) {
|
||||||
|
write(" .");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
write(".");
|
||||||
|
}
|
||||||
|
|
||||||
let indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name);
|
let indentedAfterDot = indentIfOnDifferentLines(node, node.dotToken, node.name);
|
||||||
emit(node.name);
|
emit(node.name);
|
||||||
decreaseIndentIf(indentedBeforeDot, indentedAfterDot);
|
decreaseIndentIf(indentedBeforeDot, indentedAfterDot);
|
||||||
|
@ -3135,33 +3154,49 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||||
function emitDefaultValueAssignments(node: FunctionLikeDeclaration) {
|
function emitDefaultValueAssignments(node: FunctionLikeDeclaration) {
|
||||||
if (languageVersion < ScriptTarget.ES6) {
|
if (languageVersion < ScriptTarget.ES6) {
|
||||||
let tempIndex = 0;
|
let tempIndex = 0;
|
||||||
forEach(node.parameters, p => {
|
forEach(node.parameters, parameter => {
|
||||||
// A rest parameter cannot have a binding pattern or an initializer,
|
// A rest parameter cannot have a binding pattern or an initializer,
|
||||||
// so let's just ignore it.
|
// so let's just ignore it.
|
||||||
if (p.dotDotDotToken) {
|
if (parameter.dotDotDotToken) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBindingPattern(p.name)) {
|
let { name: paramName, initializer } = parameter;
|
||||||
writeLine();
|
if (isBindingPattern(paramName)) {
|
||||||
write("var ");
|
// In cases where a binding pattern is simply '[]' or '{}',
|
||||||
emitDestructuring(p, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]);
|
// we usually don't want to emit a var declaration; however, in the presence
|
||||||
write(";");
|
// of an initializer, we must emit that expression to preserve side effects.
|
||||||
tempIndex++;
|
let hasBindingElements = paramName.elements.length > 0;
|
||||||
|
if (hasBindingElements || initializer) {
|
||||||
|
writeLine();
|
||||||
|
write("var ");
|
||||||
|
|
||||||
|
if (hasBindingElements) {
|
||||||
|
emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit(tempParameters[tempIndex]);
|
||||||
|
write(" = ");
|
||||||
|
emit(initializer);
|
||||||
|
}
|
||||||
|
|
||||||
|
write(";");
|
||||||
|
tempIndex++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (p.initializer) {
|
else if (initializer) {
|
||||||
writeLine();
|
writeLine();
|
||||||
emitStart(p);
|
emitStart(parameter);
|
||||||
write("if (");
|
write("if (");
|
||||||
emitNodeWithoutSourceMap(p.name);
|
emitNodeWithoutSourceMap(paramName);
|
||||||
write(" === void 0)");
|
write(" === void 0)");
|
||||||
emitEnd(p);
|
emitEnd(parameter);
|
||||||
write(" { ");
|
write(" { ");
|
||||||
emitStart(p);
|
emitStart(parameter);
|
||||||
emitNodeWithoutSourceMap(p.name);
|
emitNodeWithoutSourceMap(paramName);
|
||||||
write(" = ");
|
write(" = ");
|
||||||
emitNodeWithoutSourceMap(p.initializer);
|
emitNodeWithoutSourceMap(initializer);
|
||||||
emitEnd(p);
|
emitEnd(parameter);
|
||||||
write("; }");
|
write("; }");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5363,7 +5363,6 @@ namespace ts {
|
||||||
let atToken = createNode(SyntaxKind.AtToken, pos - 1);
|
let atToken = createNode(SyntaxKind.AtToken, pos - 1);
|
||||||
atToken.end = pos;
|
atToken.end = pos;
|
||||||
|
|
||||||
let startPos = pos;
|
|
||||||
let tagName = scanIdentifier();
|
let tagName = scanIdentifier();
|
||||||
if (!tagName) {
|
if (!tagName) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -337,7 +337,6 @@ namespace ts {
|
||||||
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
|
function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) {
|
||||||
let start: number;
|
let start: number;
|
||||||
let length: number;
|
let length: number;
|
||||||
let extensions: string;
|
|
||||||
let diagnosticArgument: string[];
|
let diagnosticArgument: string[];
|
||||||
if (refEnd !== undefined && refPos !== undefined) {
|
if (refEnd !== undefined && refPos !== undefined) {
|
||||||
start = refPos;
|
start = refPos;
|
||||||
|
|
|
@ -797,7 +797,7 @@ namespace ts {
|
||||||
template: LiteralExpression | TemplateExpression;
|
template: LiteralExpression | TemplateExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression;
|
export type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator;
|
||||||
|
|
||||||
export interface TypeAssertion extends UnaryExpression {
|
export interface TypeAssertion extends UnaryExpression {
|
||||||
type: TypeNode;
|
type: TypeNode;
|
||||||
|
|
|
@ -542,6 +542,7 @@ namespace ts {
|
||||||
case SyntaxKind.ModuleDeclaration:
|
case SyntaxKind.ModuleDeclaration:
|
||||||
case SyntaxKind.TypeAliasDeclaration:
|
case SyntaxKind.TypeAliasDeclaration:
|
||||||
case SyntaxKind.ClassDeclaration:
|
case SyntaxKind.ClassDeclaration:
|
||||||
|
case SyntaxKind.ClassExpression:
|
||||||
// These are not allowed inside a generator now, but eventually they may be allowed
|
// These are not allowed inside a generator now, but eventually they may be allowed
|
||||||
// as local types. Regardless, any yield statements contained within them should be
|
// as local types. Regardless, any yield statements contained within them should be
|
||||||
// skipped in this traversal.
|
// skipped in this traversal.
|
||||||
|
@ -579,26 +580,15 @@ namespace ts {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isAccessor(node: Node): boolean {
|
export function isAccessor(node: Node): boolean {
|
||||||
if (node) {
|
return node && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor);
|
||||||
switch (node.kind) {
|
|
||||||
case SyntaxKind.GetAccessor:
|
|
||||||
case SyntaxKind.SetAccessor:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isClassLike(node: Node): boolean {
|
export function isClassLike(node: Node): boolean {
|
||||||
if (node) {
|
return node && (node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression);
|
||||||
return node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isFunctionLike(node: Node): boolean {
|
export function isFunctionLike(node: Node): boolean {
|
||||||
|
@ -620,7 +610,6 @@ namespace ts {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,6 +630,15 @@ namespace ts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getContainingClass(node: Node): ClassLikeDeclaration {
|
||||||
|
while (true) {
|
||||||
|
node = node.parent;
|
||||||
|
if (!node || isClassLike(node)) {
|
||||||
|
return <ClassLikeDeclaration>node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getThisContainer(node: Node, includeArrowFunctions: boolean): Node {
|
export function getThisContainer(node: Node, includeArrowFunctions: boolean): Node {
|
||||||
while (true) {
|
while (true) {
|
||||||
node = node.parent;
|
node = node.parent;
|
||||||
|
@ -653,7 +651,7 @@ namespace ts {
|
||||||
// then the computed property is not a 'this' container.
|
// then the computed property is not a 'this' container.
|
||||||
// A computed property name in a class needs to be a this container
|
// A computed property name in a class needs to be a this container
|
||||||
// so that we can error on it.
|
// so that we can error on it.
|
||||||
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
if (isClassLike(node.parent.parent)) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
// If this is a computed property, then the parent should not
|
// If this is a computed property, then the parent should not
|
||||||
|
@ -708,7 +706,7 @@ namespace ts {
|
||||||
// then the computed property is not a 'super' container.
|
// then the computed property is not a 'super' container.
|
||||||
// A computed property name in a class needs to be a super container
|
// A computed property name in a class needs to be a super container
|
||||||
// so that we can error on it.
|
// so that we can error on it.
|
||||||
if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
if (isClassLike(node.parent.parent)) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
// If this is a computed property, then the parent should not
|
// If this is a computed property, then the parent should not
|
||||||
|
@ -754,8 +752,8 @@ namespace ts {
|
||||||
return (<TaggedTemplateExpression>node).tag;
|
return (<TaggedTemplateExpression>node).tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will either be a CallExpression or NewExpression.
|
// Will either be a CallExpression, NewExpression, or Decorator.
|
||||||
return (<CallExpression>node).expression;
|
return (<CallExpression | Decorator>node).expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function nodeCanBeDecorated(node: Node): boolean {
|
export function nodeCanBeDecorated(node: Node): boolean {
|
||||||
|
@ -1067,7 +1065,7 @@ namespace ts {
|
||||||
return SyntaxKind.FirstTemplateToken <= kind && kind <= SyntaxKind.LastTemplateToken;
|
return SyntaxKind.FirstTemplateToken <= kind && kind <= SyntaxKind.LastTemplateToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isBindingPattern(node: Node) {
|
export function isBindingPattern(node: Node): node is BindingPattern {
|
||||||
return !!node && (node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern);
|
return !!node && (node.kind === SyntaxKind.ArrayBindingPattern || node.kind === SyntaxKind.ObjectBindingPattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,6 +1085,7 @@ namespace ts {
|
||||||
case SyntaxKind.ArrowFunction:
|
case SyntaxKind.ArrowFunction:
|
||||||
case SyntaxKind.BindingElement:
|
case SyntaxKind.BindingElement:
|
||||||
case SyntaxKind.ClassDeclaration:
|
case SyntaxKind.ClassDeclaration:
|
||||||
|
case SyntaxKind.ClassExpression:
|
||||||
case SyntaxKind.Constructor:
|
case SyntaxKind.Constructor:
|
||||||
case SyntaxKind.EnumDeclaration:
|
case SyntaxKind.EnumDeclaration:
|
||||||
case SyntaxKind.EnumMember:
|
case SyntaxKind.EnumMember:
|
||||||
|
@ -1235,7 +1234,7 @@ namespace ts {
|
||||||
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
|
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getClassImplementsHeritageClauseElements(node: ClassDeclaration) {
|
export function getClassImplementsHeritageClauseElements(node: ClassLikeDeclaration) {
|
||||||
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
|
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
|
||||||
return heritageClause ? heritageClause.types : undefined;
|
return heritageClause ? heritageClause.types : undefined;
|
||||||
}
|
}
|
||||||
|
@ -1917,7 +1916,7 @@ namespace ts {
|
||||||
export function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean {
|
export function isExpressionWithTypeArgumentsInClassExtendsClause(node: Node): boolean {
|
||||||
return node.kind === SyntaxKind.ExpressionWithTypeArguments &&
|
return node.kind === SyntaxKind.ExpressionWithTypeArguments &&
|
||||||
(<HeritageClause>node.parent).token === SyntaxKind.ExtendsKeyword &&
|
(<HeritageClause>node.parent).token === SyntaxKind.ExtendsKeyword &&
|
||||||
node.parent.parent.kind === SyntaxKind.ClassDeclaration;
|
isClassLike(node.parent.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns false if this heritage clause element's expression contains something unsupported
|
// Returns false if this heritage clause element's expression contains something unsupported
|
||||||
|
@ -1958,7 +1957,6 @@ namespace ts {
|
||||||
function getExpandedCharCodes(input: string): number[] {
|
function getExpandedCharCodes(input: string): number[] {
|
||||||
let output: number[] = [];
|
let output: number[] = [];
|
||||||
let length = input.length;
|
let length = input.length;
|
||||||
let leadSurrogate: number = undefined;
|
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
let charCode = input.charCodeAt(i);
|
let charCode = input.charCodeAt(i);
|
||||||
|
|
|
@ -660,8 +660,7 @@ module FourSlash {
|
||||||
}
|
}
|
||||||
errorMsg += "]\n";
|
errorMsg += "]\n";
|
||||||
|
|
||||||
Harness.IO.log(errorMsg);
|
this.raiseError("Member list is not empty at Caret: " + errorMsg);
|
||||||
this.raiseError("Member list is not empty at Caret");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
src/lib/es6.d.ts
vendored
4
src/lib/es6.d.ts
vendored
|
@ -694,6 +694,7 @@ interface Map<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MapConstructor {
|
interface MapConstructor {
|
||||||
|
new (): Map<any, any>;
|
||||||
new <K, V>(): Map<K, V>;
|
new <K, V>(): Map<K, V>;
|
||||||
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
|
new <K, V>(iterable: Iterable<[K, V]>): Map<K, V>;
|
||||||
prototype: Map<any, any>;
|
prototype: Map<any, any>;
|
||||||
|
@ -710,6 +711,7 @@ interface WeakMap<K, V> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WeakMapConstructor {
|
interface WeakMapConstructor {
|
||||||
|
new (): WeakMap<any, any>;
|
||||||
new <K, V>(): WeakMap<K, V>;
|
new <K, V>(): WeakMap<K, V>;
|
||||||
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
|
new <K, V>(iterable: Iterable<[K, V]>): WeakMap<K, V>;
|
||||||
prototype: WeakMap<any, any>;
|
prototype: WeakMap<any, any>;
|
||||||
|
@ -731,6 +733,7 @@ interface Set<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SetConstructor {
|
interface SetConstructor {
|
||||||
|
new (): Set<any>;
|
||||||
new <T>(): Set<T>;
|
new <T>(): Set<T>;
|
||||||
new <T>(iterable: Iterable<T>): Set<T>;
|
new <T>(iterable: Iterable<T>): Set<T>;
|
||||||
prototype: Set<any>;
|
prototype: Set<any>;
|
||||||
|
@ -746,6 +749,7 @@ interface WeakSet<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WeakSetConstructor {
|
interface WeakSetConstructor {
|
||||||
|
new (): WeakSet<any>;
|
||||||
new <T>(): WeakSet<T>;
|
new <T>(): WeakSet<T>;
|
||||||
new <T>(iterable: Iterable<T>): WeakSet<T>;
|
new <T>(iterable: Iterable<T>): WeakSet<T>;
|
||||||
prototype: WeakSet<any>;
|
prototype: WeakSet<any>;
|
||||||
|
|
|
@ -318,7 +318,7 @@ namespace ts.formatting {
|
||||||
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
|
||||||
|
|
||||||
// Add a space around certain TypeScript keywords
|
// Add a space around certain TypeScript keywords
|
||||||
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||||
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
|
||||||
|
|
||||||
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
|
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace ts.formatting {
|
||||||
precedingToken.kind === SyntaxKind.TemplateHead ||
|
precedingToken.kind === SyntaxKind.TemplateHead ||
|
||||||
precedingToken.kind === SyntaxKind.TemplateMiddle ||
|
precedingToken.kind === SyntaxKind.TemplateMiddle ||
|
||||||
precedingToken.kind === SyntaxKind.TemplateTail;
|
precedingToken.kind === SyntaxKind.TemplateTail;
|
||||||
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
|
if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,10 @@ namespace ts.formatting {
|
||||||
if (actualIndentation !== Value.Unknown) {
|
if (actualIndentation !== Value.Unknown) {
|
||||||
return actualIndentation;
|
return actualIndentation;
|
||||||
}
|
}
|
||||||
|
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
|
||||||
|
if (actualIndentation !== Value.Unknown) {
|
||||||
|
return actualIndentation + options.IndentSize;
|
||||||
|
}
|
||||||
|
|
||||||
previous = current;
|
previous = current;
|
||||||
current = current.parent;
|
current = current.parent;
|
||||||
|
@ -122,6 +126,10 @@ namespace ts.formatting {
|
||||||
if (actualIndentation !== Value.Unknown) {
|
if (actualIndentation !== Value.Unknown) {
|
||||||
return actualIndentation + indentationDelta;
|
return actualIndentation + indentationDelta;
|
||||||
}
|
}
|
||||||
|
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
|
||||||
|
if (actualIndentation !== Value.Unknown) {
|
||||||
|
return actualIndentation + indentationDelta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line
|
// increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line
|
||||||
|
@ -287,6 +295,55 @@ namespace ts.formatting {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLineIndentationWhenExpressionIsInMultiLine(node: Node, sourceFile: SourceFile, options: EditorOptions): number {
|
||||||
|
// actual indentation should not be used when:
|
||||||
|
// - node is close parenthesis - this is the end of the expression
|
||||||
|
if (node.kind === SyntaxKind.CloseParenToken) {
|
||||||
|
return Value.Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.parent && (
|
||||||
|
node.parent.kind === SyntaxKind.CallExpression ||
|
||||||
|
node.parent.kind === SyntaxKind.NewExpression) &&
|
||||||
|
(<CallExpression>node.parent).expression !== node) {
|
||||||
|
|
||||||
|
let fullCallOrNewExpression = (<CallExpression | NewExpression>node.parent).expression;
|
||||||
|
let startingExpression = getStartingExpression(<PropertyAccessExpression | CallExpression | ElementAccessExpression>fullCallOrNewExpression);
|
||||||
|
|
||||||
|
if (fullCallOrNewExpression === startingExpression) {
|
||||||
|
return Value.Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
let fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);
|
||||||
|
let startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);
|
||||||
|
|
||||||
|
if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {
|
||||||
|
return Value.Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Value.Unknown;
|
||||||
|
|
||||||
|
function getStartingExpression(node: PropertyAccessExpression | CallExpression | ElementAccessExpression) {
|
||||||
|
while (true) {
|
||||||
|
switch (node.kind) {
|
||||||
|
case SyntaxKind.CallExpression:
|
||||||
|
case SyntaxKind.NewExpression:
|
||||||
|
case SyntaxKind.PropertyAccessExpression:
|
||||||
|
case SyntaxKind.ElementAccessExpression:
|
||||||
|
|
||||||
|
node = <PropertyAccessExpression | CallExpression | ElementAccessExpression | PropertyAccessExpression>node.expression;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number {
|
function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number {
|
||||||
Debug.assert(index >= 0 && index < list.length);
|
Debug.assert(index >= 0 && index < list.length);
|
||||||
let node = list[index];
|
let node = list[index];
|
||||||
|
|
|
@ -95,7 +95,6 @@ namespace ts {
|
||||||
|
|
||||||
export module ScriptSnapshot {
|
export module ScriptSnapshot {
|
||||||
class StringScriptSnapshot implements IScriptSnapshot {
|
class StringScriptSnapshot implements IScriptSnapshot {
|
||||||
private _lineStartPositions: number[] = undefined;
|
|
||||||
|
|
||||||
constructor(private text: string) {
|
constructor(private text: string) {
|
||||||
}
|
}
|
||||||
|
@ -2910,7 +2909,6 @@ namespace ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
let location = getTouchingPropertyName(sourceFile, position);
|
let location = getTouchingPropertyName(sourceFile, position);
|
||||||
var target = program.getCompilerOptions().target;
|
|
||||||
|
|
||||||
let semanticStart = new Date().getTime();
|
let semanticStart = new Date().getTime();
|
||||||
let isMemberCompletion: boolean;
|
let isMemberCompletion: boolean;
|
||||||
|
@ -2985,21 +2983,32 @@ namespace ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryGetGlobalSymbols(): boolean {
|
function tryGetGlobalSymbols(): boolean {
|
||||||
let containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(contextToken);
|
let objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
|
||||||
if (containingObjectLiteral) {
|
if (objectLikeContainer) {
|
||||||
// Object literal expression, look up possible property names from contextual type
|
// Object literal expression, look up possible property names from contextual type
|
||||||
isMemberCompletion = true;
|
isMemberCompletion = true;
|
||||||
isNewIdentifierLocation = true;
|
isNewIdentifierLocation = true;
|
||||||
|
|
||||||
let contextualType = typeChecker.getContextualType(containingObjectLiteral);
|
let typeForObject: Type;
|
||||||
if (!contextualType) {
|
let existingMembers: Declaration[];
|
||||||
|
|
||||||
|
if (objectLikeContainer.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||||
|
typeForObject = typeChecker.getContextualType(<ObjectLiteralExpression>objectLikeContainer);
|
||||||
|
existingMembers = (<ObjectLiteralExpression>objectLikeContainer).properties;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer);
|
||||||
|
existingMembers = (<BindingPattern>objectLikeContainer).elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!typeForObject) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let contextualTypeMembers = typeChecker.getPropertiesOfType(contextualType);
|
let typeMembers = typeChecker.getPropertiesOfType(typeForObject);
|
||||||
if (contextualTypeMembers && contextualTypeMembers.length > 0) {
|
if (typeMembers && typeMembers.length > 0) {
|
||||||
// Add filtered items to the completion list
|
// Add filtered items to the completion list
|
||||||
symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties);
|
symbols = filterObjectMembersList(typeMembers, existingMembers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (getAncestor(contextToken, SyntaxKind.ImportClause)) {
|
else if (getAncestor(contextToken, SyntaxKind.ImportClause)) {
|
||||||
|
@ -3187,17 +3196,18 @@ namespace ts {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContainingObjectLiteralApplicableForCompletion(previousToken: Node): ObjectLiteralExpression {
|
/**
|
||||||
// The locations in an object literal expression that are applicable for completion are property name definition locations.
|
* Returns the immediate owning object literal or binding pattern of a context token,
|
||||||
|
* on the condition that one exists and that the context implies completion should be given.
|
||||||
if (previousToken) {
|
*/
|
||||||
let parent = previousToken.parent;
|
function tryGetObjectLikeCompletionContainer(contextToken: Node): ObjectLiteralExpression | BindingPattern {
|
||||||
|
if (contextToken) {
|
||||||
switch (previousToken.kind) {
|
switch (contextToken.kind) {
|
||||||
case SyntaxKind.OpenBraceToken: // let x = { |
|
case SyntaxKind.OpenBraceToken: // let x = { |
|
||||||
case SyntaxKind.CommaToken: // let x = { a: 0, |
|
case SyntaxKind.CommaToken: // let x = { a: 0, |
|
||||||
if (parent && parent.kind === SyntaxKind.ObjectLiteralExpression) {
|
let parent = contextToken.parent;
|
||||||
return <ObjectLiteralExpression>parent;
|
if (parent && (parent.kind === SyntaxKind.ObjectLiteralExpression || parent.kind === SyntaxKind.ObjectBindingPattern)) {
|
||||||
|
return <ObjectLiteralExpression | BindingPattern>parent;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3236,8 +3246,7 @@ namespace ts {
|
||||||
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
containingNodeKind === SyntaxKind.ClassDeclaration || // class A<T, |
|
||||||
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
containingNodeKind === SyntaxKind.FunctionDeclaration || // function A<T, |
|
||||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface A<T, |
|
||||||
containingNodeKind === SyntaxKind.ArrayBindingPattern || // var [x, y|
|
containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [x, y|
|
||||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x, y|
|
|
||||||
|
|
||||||
case SyntaxKind.DotToken:
|
case SyntaxKind.DotToken:
|
||||||
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
return containingNodeKind === SyntaxKind.ArrayBindingPattern; // var [.|
|
||||||
|
@ -3255,8 +3264,7 @@ namespace ts {
|
||||||
case SyntaxKind.OpenBraceToken:
|
case SyntaxKind.OpenBraceToken:
|
||||||
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
return containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { |
|
||||||
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
containingNodeKind === SyntaxKind.InterfaceDeclaration || // interface a { |
|
||||||
containingNodeKind === SyntaxKind.TypeLiteral || // let x : { |
|
containingNodeKind === SyntaxKind.TypeLiteral; // let x : { |
|
||||||
containingNodeKind === SyntaxKind.ObjectBindingPattern; // function func({ x|
|
|
||||||
|
|
||||||
case SyntaxKind.SemicolonToken:
|
case SyntaxKind.SemicolonToken:
|
||||||
return containingNodeKind === SyntaxKind.PropertySignature &&
|
return containingNodeKind === SyntaxKind.PropertySignature &&
|
||||||
|
@ -3348,26 +3356,39 @@ namespace ts {
|
||||||
return filter(exports, e => !lookUp(exisingImports, e.name));
|
return filter(exports, e => !lookUp(exisingImports, e.name));
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterContextualMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {
|
function filterObjectMembersList(contextualMemberSymbols: Symbol[], existingMembers: Declaration[]): Symbol[] {
|
||||||
if (!existingMembers || existingMembers.length === 0) {
|
if (!existingMembers || existingMembers.length === 0) {
|
||||||
return contextualMemberSymbols;
|
return contextualMemberSymbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
let existingMemberNames: Map<boolean> = {};
|
let existingMemberNames: Map<boolean> = {};
|
||||||
forEach(existingMembers, m => {
|
for (let m of existingMembers) {
|
||||||
if (m.kind !== SyntaxKind.PropertyAssignment && m.kind !== SyntaxKind.ShorthandPropertyAssignment) {
|
// Ignore omitted expressions for missing members
|
||||||
// Ignore omitted expressions for missing members in the object literal
|
if (m.kind !== SyntaxKind.PropertyAssignment &&
|
||||||
return;
|
m.kind !== SyntaxKind.ShorthandPropertyAssignment &&
|
||||||
|
m.kind !== SyntaxKind.BindingElement) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this is the current item we are editing right now, do not filter it out
|
||||||
if (m.getStart() <= position && position <= m.getEnd()) {
|
if (m.getStart() <= position && position <= m.getEnd()) {
|
||||||
// If this is the current item we are editing right now, do not filter it out
|
continue;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(jfreeman): Account for computed property name
|
let existingName: string;
|
||||||
existingMemberNames[(<Identifier>m.name).text] = true;
|
|
||||||
});
|
if (m.kind === SyntaxKind.BindingElement && (<BindingElement>m).propertyName) {
|
||||||
|
existingName = (<BindingElement>m).propertyName.text;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// TODO(jfreeman): Account for computed property name
|
||||||
|
// NOTE: if one only performs this step when m.name is an identifier,
|
||||||
|
// things like '__proto__' are not filtered out.
|
||||||
|
existingName = (<Identifier>m.name).text;
|
||||||
|
}
|
||||||
|
|
||||||
|
existingMemberNames[existingName] = true;
|
||||||
|
}
|
||||||
|
|
||||||
let filteredMembers: Symbol[] = [];
|
let filteredMembers: Symbol[] = [];
|
||||||
forEach(contextualMemberSymbols, s => {
|
forEach(contextualMemberSymbols, s => {
|
||||||
|
@ -6265,6 +6286,10 @@ namespace ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function classifyToken(token: Node): void {
|
function classifyToken(token: Node): void {
|
||||||
|
if (nodeIsMissing(token)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let tokenStart = classifyLeadingTriviaAndGetTokenStart(token);
|
let tokenStart = classifyLeadingTriviaAndGetTokenStart(token);
|
||||||
|
|
||||||
let tokenWidth = token.end - tokenStart;
|
let tokenWidth = token.end - tokenStart;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
tests/cases/compiler/anonymousClassExpression1.ts(2,19): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/anonymousClassExpression1.ts (1 errors) ====
|
|
||||||
function f() {
|
|
||||||
return typeof class {} === "function";
|
|
||||||
~~~~~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
||||||
}
|
|
|
@ -6,8 +6,8 @@ function f() {
|
||||||
//// [anonymousClassExpression1.js]
|
//// [anonymousClassExpression1.js]
|
||||||
function f() {
|
function f() {
|
||||||
return typeof (function () {
|
return typeof (function () {
|
||||||
function default_1() {
|
function class_1() {
|
||||||
}
|
}
|
||||||
return default_1;
|
return class_1;
|
||||||
})() === "function";
|
})() === "function";
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
=== tests/cases/compiler/anonymousClassExpression1.ts ===
|
||||||
|
function f() {
|
||||||
|
>f : Symbol(f, Decl(anonymousClassExpression1.ts, 0, 0))
|
||||||
|
|
||||||
|
return typeof class {} === "function";
|
||||||
|
}
|
10
tests/baselines/reference/anonymousClassExpression1.types
Normal file
10
tests/baselines/reference/anonymousClassExpression1.types
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
=== tests/cases/compiler/anonymousClassExpression1.ts ===
|
||||||
|
function f() {
|
||||||
|
>f : () => boolean
|
||||||
|
|
||||||
|
return typeof class {} === "function";
|
||||||
|
>typeof class {} === "function" : boolean
|
||||||
|
>typeof class {} : string
|
||||||
|
>class {} : typeof (Anonymous class)
|
||||||
|
>"function" : string
|
||||||
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
tests/cases/conformance/classes/classExpression.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
tests/cases/conformance/classes/classExpression.ts(10,19): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/classes/classExpression.ts (3 errors) ====
|
|
||||||
var x = class C {
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
||||||
}
|
|
||||||
|
|
||||||
var y = {
|
|
||||||
foo: class C2 {
|
|
||||||
~~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module M {
|
|
||||||
var z = class C4 {
|
|
||||||
~~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
||||||
}
|
|
||||||
}
|
|
23
tests/baselines/reference/classExpression.symbols
Normal file
23
tests/baselines/reference/classExpression.symbols
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpression.ts ===
|
||||||
|
var x = class C {
|
||||||
|
>x : Symbol(x, Decl(classExpression.ts, 0, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpression.ts, 0, 7))
|
||||||
|
}
|
||||||
|
|
||||||
|
var y = {
|
||||||
|
>y : Symbol(y, Decl(classExpression.ts, 3, 3))
|
||||||
|
|
||||||
|
foo: class C2 {
|
||||||
|
>foo : Symbol(foo, Decl(classExpression.ts, 3, 9))
|
||||||
|
>C2 : Symbol(C2, Decl(classExpression.ts, 4, 8))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module M {
|
||||||
|
>M : Symbol(M, Decl(classExpression.ts, 6, 1))
|
||||||
|
|
||||||
|
var z = class C4 {
|
||||||
|
>z : Symbol(z, Decl(classExpression.ts, 9, 7))
|
||||||
|
>C4 : Symbol(C4, Decl(classExpression.ts, 9, 11))
|
||||||
|
}
|
||||||
|
}
|
27
tests/baselines/reference/classExpression.types
Normal file
27
tests/baselines/reference/classExpression.types
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpression.ts ===
|
||||||
|
var x = class C {
|
||||||
|
>x : typeof C
|
||||||
|
>class C {} : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
}
|
||||||
|
|
||||||
|
var y = {
|
||||||
|
>y : { foo: typeof C2; }
|
||||||
|
>{ foo: class C2 { }} : { foo: typeof C2; }
|
||||||
|
|
||||||
|
foo: class C2 {
|
||||||
|
>foo : typeof C2
|
||||||
|
>class C2 { } : typeof C2
|
||||||
|
>C2 : typeof C2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module M {
|
||||||
|
>M : typeof M
|
||||||
|
|
||||||
|
var z = class C4 {
|
||||||
|
>z : typeof C4
|
||||||
|
>class C4 { } : typeof C4
|
||||||
|
>C4 : typeof C4
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
tests/cases/conformance/classes/classExpressions/classExpression1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/classes/classExpressions/classExpression1.ts (1 errors) ====
|
|
||||||
var v = class C {};
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
5
tests/baselines/reference/classExpression1.symbols
Normal file
5
tests/baselines/reference/classExpression1.symbols
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression1.ts ===
|
||||||
|
var v = class C {};
|
||||||
|
>v : Symbol(v, Decl(classExpression1.ts, 0, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpression1.ts, 0, 7))
|
||||||
|
|
6
tests/baselines/reference/classExpression1.types
Normal file
6
tests/baselines/reference/classExpression1.types
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression1.ts ===
|
||||||
|
var v = class C {};
|
||||||
|
>v : typeof C
|
||||||
|
>class C {} : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
tests/cases/conformance/classes/classExpressions/classExpression2.ts(2,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/classes/classExpressions/classExpression2.ts (1 errors) ====
|
|
||||||
class D { }
|
|
||||||
var v = class C extends D {};
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
|
@ -3,6 +3,11 @@ class D { }
|
||||||
var v = class C extends D {};
|
var v = class C extends D {};
|
||||||
|
|
||||||
//// [classExpression2.js]
|
//// [classExpression2.js]
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
var D = (function () {
|
var D = (function () {
|
||||||
function D() {
|
function D() {
|
||||||
}
|
}
|
||||||
|
|
9
tests/baselines/reference/classExpression2.symbols
Normal file
9
tests/baselines/reference/classExpression2.symbols
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression2.ts ===
|
||||||
|
class D { }
|
||||||
|
>D : Symbol(D, Decl(classExpression2.ts, 0, 0))
|
||||||
|
|
||||||
|
var v = class C extends D {};
|
||||||
|
>v : Symbol(v, Decl(classExpression2.ts, 1, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpression2.ts, 1, 7))
|
||||||
|
>D : Symbol(D, Decl(classExpression2.ts, 0, 0))
|
||||||
|
|
10
tests/baselines/reference/classExpression2.types
Normal file
10
tests/baselines/reference/classExpression2.types
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression2.ts ===
|
||||||
|
class D { }
|
||||||
|
>D : D
|
||||||
|
|
||||||
|
var v = class C extends D {};
|
||||||
|
>v : typeof C
|
||||||
|
>class C extends D {} : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
>D : D
|
||||||
|
|
38
tests/baselines/reference/classExpression3.js
Normal file
38
tests/baselines/reference/classExpression3.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
//// [classExpression3.ts]
|
||||||
|
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
|
||||||
|
let c = new C();
|
||||||
|
c.a;
|
||||||
|
c.b;
|
||||||
|
c.c;
|
||||||
|
|
||||||
|
|
||||||
|
//// [classExpression3.js]
|
||||||
|
var __extends = (this && this.__extends) || function (d, b) {
|
||||||
|
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||||
|
function __() { this.constructor = d; }
|
||||||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
|
};
|
||||||
|
var C = (function (_super) {
|
||||||
|
__extends(class_1, _super);
|
||||||
|
function class_1() {
|
||||||
|
_super.apply(this, arguments);
|
||||||
|
this.c = 3;
|
||||||
|
}
|
||||||
|
return class_1;
|
||||||
|
})((function (_super) {
|
||||||
|
__extends(class_2, _super);
|
||||||
|
function class_2() {
|
||||||
|
_super.apply(this, arguments);
|
||||||
|
this.b = 2;
|
||||||
|
}
|
||||||
|
return class_2;
|
||||||
|
})((function () {
|
||||||
|
function class_3() {
|
||||||
|
this.a = 1;
|
||||||
|
}
|
||||||
|
return class_3;
|
||||||
|
})()));
|
||||||
|
var c = new C();
|
||||||
|
c.a;
|
||||||
|
c.b;
|
||||||
|
c.c;
|
26
tests/baselines/reference/classExpression3.symbols
Normal file
26
tests/baselines/reference/classExpression3.symbols
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression3.ts ===
|
||||||
|
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
|
||||||
|
>C : Symbol(C, Decl(classExpression3.ts, 0, 3))
|
||||||
|
>a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
|
||||||
|
>b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
|
||||||
|
>c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
|
||||||
|
|
||||||
|
let c = new C();
|
||||||
|
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpression3.ts, 0, 3))
|
||||||
|
|
||||||
|
c.a;
|
||||||
|
>c.a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
|
||||||
|
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
|
||||||
|
>a : Symbol((Anonymous class).a, Decl(classExpression3.ts, 0, 43))
|
||||||
|
|
||||||
|
c.b;
|
||||||
|
>c.b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
|
||||||
|
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
|
||||||
|
>b : Symbol((Anonymous class).b, Decl(classExpression3.ts, 0, 53))
|
||||||
|
|
||||||
|
c.c;
|
||||||
|
>c.c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
|
||||||
|
>c : Symbol(c, Decl(classExpression3.ts, 1, 3))
|
||||||
|
>c : Symbol((Anonymous class).c, Decl(classExpression3.ts, 0, 63))
|
||||||
|
|
33
tests/baselines/reference/classExpression3.types
Normal file
33
tests/baselines/reference/classExpression3.types
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression3.ts ===
|
||||||
|
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
|
||||||
|
>C : typeof (Anonymous class)
|
||||||
|
>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class)
|
||||||
|
>class extends class { a = 1 } { b = 2 } : (Anonymous class)
|
||||||
|
>class { a = 1 } : (Anonymous class)
|
||||||
|
>a : number
|
||||||
|
>1 : number
|
||||||
|
>b : number
|
||||||
|
>2 : number
|
||||||
|
>c : number
|
||||||
|
>3 : number
|
||||||
|
|
||||||
|
let c = new C();
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>new C() : (Anonymous class)
|
||||||
|
>C : typeof (Anonymous class)
|
||||||
|
|
||||||
|
c.a;
|
||||||
|
>c.a : number
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>a : number
|
||||||
|
|
||||||
|
c.b;
|
||||||
|
>c.b : number
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>b : number
|
||||||
|
|
||||||
|
c.c;
|
||||||
|
>c.c : number
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>c : number
|
||||||
|
|
19
tests/baselines/reference/classExpression4.js
Normal file
19
tests/baselines/reference/classExpression4.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
//// [classExpression4.ts]
|
||||||
|
let C = class {
|
||||||
|
foo() {
|
||||||
|
return new C();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let x = (new C).foo();
|
||||||
|
|
||||||
|
|
||||||
|
//// [classExpression4.js]
|
||||||
|
var C = (function () {
|
||||||
|
function class_1() {
|
||||||
|
}
|
||||||
|
class_1.prototype.foo = function () {
|
||||||
|
return new C();
|
||||||
|
};
|
||||||
|
return class_1;
|
||||||
|
})();
|
||||||
|
var x = (new C).foo();
|
17
tests/baselines/reference/classExpression4.symbols
Normal file
17
tests/baselines/reference/classExpression4.symbols
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression4.ts ===
|
||||||
|
let C = class {
|
||||||
|
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
|
||||||
|
|
||||||
|
foo() {
|
||||||
|
>foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
|
||||||
|
|
||||||
|
return new C();
|
||||||
|
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let x = (new C).foo();
|
||||||
|
>x : Symbol(x, Decl(classExpression4.ts, 5, 3))
|
||||||
|
>(new C).foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
|
||||||
|
>C : Symbol(C, Decl(classExpression4.ts, 0, 3))
|
||||||
|
>foo : Symbol((Anonymous class).foo, Decl(classExpression4.ts, 0, 15))
|
||||||
|
|
22
tests/baselines/reference/classExpression4.types
Normal file
22
tests/baselines/reference/classExpression4.types
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
=== tests/cases/conformance/classes/classExpressions/classExpression4.ts ===
|
||||||
|
let C = class {
|
||||||
|
>C : typeof (Anonymous class)
|
||||||
|
>class { foo() { return new C(); }} : typeof (Anonymous class)
|
||||||
|
|
||||||
|
foo() {
|
||||||
|
>foo : () => (Anonymous class)
|
||||||
|
|
||||||
|
return new C();
|
||||||
|
>new C() : (Anonymous class)
|
||||||
|
>C : typeof (Anonymous class)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let x = (new C).foo();
|
||||||
|
>x : (Anonymous class)
|
||||||
|
>(new C).foo() : (Anonymous class)
|
||||||
|
>(new C).foo : () => (Anonymous class)
|
||||||
|
>(new C) : (Anonymous class)
|
||||||
|
>new C : (Anonymous class)
|
||||||
|
>C : typeof (Anonymous class)
|
||||||
|
>foo : () => (Anonymous class)
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
tests/cases/conformance/es6/classExpressions/classExpressionES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts (1 errors) ====
|
|
||||||
var v = class C {};
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
5
tests/baselines/reference/classExpressionES61.symbols
Normal file
5
tests/baselines/reference/classExpressionES61.symbols
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
=== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts ===
|
||||||
|
var v = class C {};
|
||||||
|
>v : Symbol(v, Decl(classExpressionES61.ts, 0, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionES61.ts, 0, 7))
|
||||||
|
|
6
tests/baselines/reference/classExpressionES61.types
Normal file
6
tests/baselines/reference/classExpressionES61.types
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
=== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts ===
|
||||||
|
var v = class C {};
|
||||||
|
>v : typeof C
|
||||||
|
>class C {} : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
tests/cases/conformance/es6/classExpressions/classExpressionES62.ts(2,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts (1 errors) ====
|
|
||||||
class D { }
|
|
||||||
var v = class C extends D {};
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
9
tests/baselines/reference/classExpressionES62.symbols
Normal file
9
tests/baselines/reference/classExpressionES62.symbols
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
=== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts ===
|
||||||
|
class D { }
|
||||||
|
>D : Symbol(D, Decl(classExpressionES62.ts, 0, 0))
|
||||||
|
|
||||||
|
var v = class C extends D {};
|
||||||
|
>v : Symbol(v, Decl(classExpressionES62.ts, 1, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionES62.ts, 1, 7))
|
||||||
|
>D : Symbol(D, Decl(classExpressionES62.ts, 0, 0))
|
||||||
|
|
10
tests/baselines/reference/classExpressionES62.types
Normal file
10
tests/baselines/reference/classExpressionES62.types
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
=== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts ===
|
||||||
|
class D { }
|
||||||
|
>D : D
|
||||||
|
|
||||||
|
var v = class C extends D {};
|
||||||
|
>v : typeof C
|
||||||
|
>class C extends D {} : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
>D : D
|
||||||
|
|
31
tests/baselines/reference/classExpressionES63.js
Normal file
31
tests/baselines/reference/classExpressionES63.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
//// [classExpressionES63.ts]
|
||||||
|
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
|
||||||
|
let c = new C();
|
||||||
|
c.a;
|
||||||
|
c.b;
|
||||||
|
c.c;
|
||||||
|
|
||||||
|
|
||||||
|
//// [classExpressionES63.js]
|
||||||
|
let C = class class_1 extends class class_2 extends class class_3 {
|
||||||
|
constructor() {
|
||||||
|
this.a = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
constructor(...args) {
|
||||||
|
super(...args);
|
||||||
|
this.b = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
constructor(...args) {
|
||||||
|
super(...args);
|
||||||
|
this.c = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
let c = new C();
|
||||||
|
c.a;
|
||||||
|
c.b;
|
||||||
|
c.c;
|
26
tests/baselines/reference/classExpressionES63.symbols
Normal file
26
tests/baselines/reference/classExpressionES63.symbols
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
=== tests/cases/conformance/es6/classExpressions/classExpressionES63.ts ===
|
||||||
|
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
|
||||||
|
>C : Symbol(C, Decl(classExpressionES63.ts, 0, 3))
|
||||||
|
>a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
|
||||||
|
>b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
|
||||||
|
>c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
|
||||||
|
|
||||||
|
let c = new C();
|
||||||
|
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionES63.ts, 0, 3))
|
||||||
|
|
||||||
|
c.a;
|
||||||
|
>c.a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
|
||||||
|
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
|
||||||
|
>a : Symbol((Anonymous class).a, Decl(classExpressionES63.ts, 0, 43))
|
||||||
|
|
||||||
|
c.b;
|
||||||
|
>c.b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
|
||||||
|
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
|
||||||
|
>b : Symbol((Anonymous class).b, Decl(classExpressionES63.ts, 0, 53))
|
||||||
|
|
||||||
|
c.c;
|
||||||
|
>c.c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
|
||||||
|
>c : Symbol(c, Decl(classExpressionES63.ts, 1, 3))
|
||||||
|
>c : Symbol((Anonymous class).c, Decl(classExpressionES63.ts, 0, 63))
|
||||||
|
|
33
tests/baselines/reference/classExpressionES63.types
Normal file
33
tests/baselines/reference/classExpressionES63.types
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
=== tests/cases/conformance/es6/classExpressions/classExpressionES63.ts ===
|
||||||
|
let C = class extends class extends class { a = 1 } { b = 2 } { c = 3 };
|
||||||
|
>C : typeof (Anonymous class)
|
||||||
|
>class extends class extends class { a = 1 } { b = 2 } { c = 3 } : typeof (Anonymous class)
|
||||||
|
>class extends class { a = 1 } { b = 2 } : (Anonymous class)
|
||||||
|
>class { a = 1 } : (Anonymous class)
|
||||||
|
>a : number
|
||||||
|
>1 : number
|
||||||
|
>b : number
|
||||||
|
>2 : number
|
||||||
|
>c : number
|
||||||
|
>3 : number
|
||||||
|
|
||||||
|
let c = new C();
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>new C() : (Anonymous class)
|
||||||
|
>C : typeof (Anonymous class)
|
||||||
|
|
||||||
|
c.a;
|
||||||
|
>c.a : number
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>a : number
|
||||||
|
|
||||||
|
c.b;
|
||||||
|
>c.b : number
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>b : number
|
||||||
|
|
||||||
|
c.c;
|
||||||
|
>c.c : number
|
||||||
|
>c : (Anonymous class)
|
||||||
|
>c : number
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
tests/cases/compiler/classExpressionTest2.ts(2,19): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
tests/cases/compiler/classExpressionTest2.ts(5,20): error TS2304: Cannot find name 'X'.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/classExpressionTest2.ts (2 errors) ====
|
|
||||||
function M() {
|
|
||||||
var m = class C<X> {
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
||||||
f<T>() {
|
|
||||||
var t: T;
|
|
||||||
var x: X;
|
|
||||||
~
|
|
||||||
!!! error TS2304: Cannot find name 'X'.
|
|
||||||
return { t, x };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var v = new m<number>();
|
|
||||||
return v.f<string>();
|
|
||||||
}
|
|
36
tests/baselines/reference/classExpressionTest2.symbols
Normal file
36
tests/baselines/reference/classExpressionTest2.symbols
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
=== tests/cases/compiler/classExpressionTest2.ts ===
|
||||||
|
function M() {
|
||||||
|
>M : Symbol(M, Decl(classExpressionTest2.ts, 0, 0))
|
||||||
|
|
||||||
|
var m = class C<X> {
|
||||||
|
>m : Symbol(m, Decl(classExpressionTest2.ts, 1, 7))
|
||||||
|
>C : Symbol(C, Decl(classExpressionTest2.ts, 1, 11))
|
||||||
|
>X : Symbol(X, Decl(classExpressionTest2.ts, 1, 20))
|
||||||
|
|
||||||
|
f<T>() {
|
||||||
|
>f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
|
||||||
|
>T : Symbol(T, Decl(classExpressionTest2.ts, 2, 10))
|
||||||
|
|
||||||
|
var t: T;
|
||||||
|
>t : Symbol(t, Decl(classExpressionTest2.ts, 3, 15))
|
||||||
|
>T : Symbol(T, Decl(classExpressionTest2.ts, 2, 10))
|
||||||
|
|
||||||
|
var x: X;
|
||||||
|
>x : Symbol(x, Decl(classExpressionTest2.ts, 4, 15))
|
||||||
|
>X : Symbol(X, Decl(classExpressionTest2.ts, 1, 20))
|
||||||
|
|
||||||
|
return { t, x };
|
||||||
|
>t : Symbol(t, Decl(classExpressionTest2.ts, 5, 20))
|
||||||
|
>x : Symbol(x, Decl(classExpressionTest2.ts, 5, 23))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var v = new m<number>();
|
||||||
|
>v : Symbol(v, Decl(classExpressionTest2.ts, 9, 7))
|
||||||
|
>m : Symbol(m, Decl(classExpressionTest2.ts, 1, 7))
|
||||||
|
|
||||||
|
return v.f<string>();
|
||||||
|
>v.f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
|
||||||
|
>v : Symbol(v, Decl(classExpressionTest2.ts, 9, 7))
|
||||||
|
>f : Symbol(C.f, Decl(classExpressionTest2.ts, 1, 24))
|
||||||
|
}
|
40
tests/baselines/reference/classExpressionTest2.types
Normal file
40
tests/baselines/reference/classExpressionTest2.types
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
=== tests/cases/compiler/classExpressionTest2.ts ===
|
||||||
|
function M() {
|
||||||
|
>M : () => { t: string; x: number; }
|
||||||
|
|
||||||
|
var m = class C<X> {
|
||||||
|
>m : typeof C
|
||||||
|
>class C<X> { f<T>() { var t: T; var x: X; return { t, x }; } } : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
>X : X
|
||||||
|
|
||||||
|
f<T>() {
|
||||||
|
>f : <T>() => { t: T; x: X; }
|
||||||
|
>T : T
|
||||||
|
|
||||||
|
var t: T;
|
||||||
|
>t : T
|
||||||
|
>T : T
|
||||||
|
|
||||||
|
var x: X;
|
||||||
|
>x : X
|
||||||
|
>X : X
|
||||||
|
|
||||||
|
return { t, x };
|
||||||
|
>{ t, x } : { t: T; x: X; }
|
||||||
|
>t : T
|
||||||
|
>x : X
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var v = new m<number>();
|
||||||
|
>v : <number>
|
||||||
|
>new m<number>() : <number>
|
||||||
|
>m : typeof C
|
||||||
|
|
||||||
|
return v.f<string>();
|
||||||
|
>v.f<string>() : { t: string; x: number; }
|
||||||
|
>v.f : <T>() => { t: T; x: number; }
|
||||||
|
>v : <number>
|
||||||
|
>f : <T>() => { t: T; x: number; }
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts(6,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts (1 errors) ====
|
|
||||||
namespace C {
|
|
||||||
export interface type {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var x = class C {
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
||||||
prop: C.type;
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts ===
|
||||||
|
namespace C {
|
||||||
|
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 0))
|
||||||
|
|
||||||
|
export interface type {
|
||||||
|
>type : Symbol(type, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 13))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var x = class C {
|
||||||
|
>x : Symbol(x, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 7))
|
||||||
|
|
||||||
|
prop: C.type;
|
||||||
|
>prop : Symbol(C.prop, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 5, 17))
|
||||||
|
>C : Symbol(C, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 0))
|
||||||
|
>type : Symbol(C.type, Decl(classExpressionWithResolutionOfNamespaceOfSameName01.ts, 0, 13))
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithResolutionOfNamespaceOfSameName01.ts ===
|
||||||
|
namespace C {
|
||||||
|
>C : any
|
||||||
|
|
||||||
|
export interface type {
|
||||||
|
>type : type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var x = class C {
|
||||||
|
>x : typeof C
|
||||||
|
>class C { prop: C.type;} : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
|
||||||
|
prop: C.type;
|
||||||
|
>prop : C.type
|
||||||
|
>C : any
|
||||||
|
>type : C.type
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
tests/cases/compiler/classExpressionWithStaticProperties1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/classExpressionWithStaticProperties1.ts (1 errors) ====
|
|
||||||
var v = class C { static a = 1; static b = 2 };
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
|
||||||
|
var v = class C { static a = 1; static b = 2 };
|
||||||
|
>v : Symbol(v, Decl(classExpressionWithStaticProperties1.ts, 0, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionWithStaticProperties1.ts, 0, 7))
|
||||||
|
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties1.ts, 0, 17))
|
||||||
|
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties1.ts, 0, 31))
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticProperties1.ts ===
|
||||||
|
var v = class C { static a = 1; static b = 2 };
|
||||||
|
>v : typeof C
|
||||||
|
>class C { static a = 1; static b = 2 } : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
>a : number
|
||||||
|
>1 : number
|
||||||
|
>b : number
|
||||||
|
>2 : number
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
tests/cases/compiler/classExpressionWithStaticProperties2.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/classExpressionWithStaticProperties2.ts (1 errors) ====
|
|
||||||
var v = class C { static a = 1; static b };
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
|
||||||
|
var v = class C { static a = 1; static b };
|
||||||
|
>v : Symbol(v, Decl(classExpressionWithStaticProperties2.ts, 0, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionWithStaticProperties2.ts, 0, 7))
|
||||||
|
>a : Symbol(C.a, Decl(classExpressionWithStaticProperties2.ts, 0, 17))
|
||||||
|
>b : Symbol(C.b, Decl(classExpressionWithStaticProperties2.ts, 0, 31))
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticProperties2.ts ===
|
||||||
|
var v = class C { static a = 1; static b };
|
||||||
|
>v : typeof C
|
||||||
|
>class C { static a = 1; static b } : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
>a : number
|
||||||
|
>1 : number
|
||||||
|
>b : any
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts (1 errors) ====
|
|
||||||
var v = class C { static a = 1; static b = 2 };
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts ===
|
||||||
|
var v = class C { static a = 1; static b = 2 };
|
||||||
|
>v : Symbol(v, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 7))
|
||||||
|
>a : Symbol(C.a, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 17))
|
||||||
|
>b : Symbol(C.b, Decl(classExpressionWithStaticPropertiesES61.ts, 0, 31))
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticPropertiesES61.ts ===
|
||||||
|
var v = class C { static a = 1; static b = 2 };
|
||||||
|
>v : typeof C
|
||||||
|
>class C { static a = 1; static b = 2 } : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
>a : number
|
||||||
|
>1 : number
|
||||||
|
>b : number
|
||||||
|
>2 : number
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts (1 errors) ====
|
|
||||||
var v = class C { static a = 1; static b };
|
|
||||||
~
|
|
||||||
!!! error TS9003: 'class' expressions are not currently supported.
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts ===
|
||||||
|
var v = class C { static a = 1; static b };
|
||||||
|
>v : Symbol(v, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 3))
|
||||||
|
>C : Symbol(C, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 7))
|
||||||
|
>a : Symbol(C.a, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 17))
|
||||||
|
>b : Symbol(C.b, Decl(classExpressionWithStaticPropertiesES62.ts, 0, 31))
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
=== tests/cases/compiler/classExpressionWithStaticPropertiesES62.ts ===
|
||||||
|
var v = class C { static a = 1; static b };
|
||||||
|
>v : typeof C
|
||||||
|
>class C { static a = 1; static b } : typeof C
|
||||||
|
>C : typeof C
|
||||||
|
>a : number
|
||||||
|
>1 : number
|
||||||
|
>b : any
|
||||||
|
|
|
@ -15,20 +15,16 @@ function baz4({} = { x: 10 }) { }
|
||||||
// For an array binding pattern with empty elements,
|
// For an array binding pattern with empty elements,
|
||||||
// we will not make any modification and will emit
|
// we will not make any modification and will emit
|
||||||
// the similar binding pattern users' have written
|
// the similar binding pattern users' have written
|
||||||
function baz(_a) {
|
function baz(_a) { }
|
||||||
var ;
|
|
||||||
}
|
|
||||||
function baz1(_a) {
|
function baz1(_a) {
|
||||||
var _b = _a === void 0 ? [1, 2, 3] : _a;
|
var _a = [1, 2, 3];
|
||||||
}
|
}
|
||||||
function baz2(_a) {
|
function baz2(_a) {
|
||||||
var _b = (_a === void 0 ? [[1, 2, 3]] : _a)[0];
|
var _b = (_a === void 0 ? [[1, 2, 3]] : _a)[0];
|
||||||
}
|
}
|
||||||
function baz3(_a) {
|
function baz3(_a) { }
|
||||||
var ;
|
|
||||||
}
|
|
||||||
function baz4(_a) {
|
function baz4(_a) {
|
||||||
var _b = _a === void 0 ? { x: 10 } : _a;
|
var _a = { x: 10 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//// [tests/cases/conformance/decorators/class/decoratedClassFromExternalModule.ts] ////
|
//// [tests/cases/conformance/decorators/class/decoratedClassFromExternalModule.ts] ////
|
||||||
|
|
||||||
//// [decorated.ts]
|
//// [decorated.ts]
|
||||||
function decorate() { }
|
function decorate(target: any) { }
|
||||||
|
|
||||||
@decorate
|
@decorate
|
||||||
export default class Decorated { }
|
export default class Decorated { }
|
||||||
|
@ -18,7 +18,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function decorate() { }
|
function decorate(target) { }
|
||||||
let Decorated = class {
|
let Decorated = class {
|
||||||
};
|
};
|
||||||
Decorated = __decorate([
|
Decorated = __decorate([
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
=== tests/cases/conformance/decorators/class/decorated.ts ===
|
=== tests/cases/conformance/decorators/class/decorated.ts ===
|
||||||
function decorate() { }
|
function decorate(target: any) { }
|
||||||
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
|
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
|
||||||
|
>target : Symbol(target, Decl(decorated.ts, 0, 18))
|
||||||
|
|
||||||
@decorate
|
@decorate
|
||||||
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
|
>decorate : Symbol(decorate, Decl(decorated.ts, 0, 0))
|
||||||
|
|
||||||
export default class Decorated { }
|
export default class Decorated { }
|
||||||
>Decorated : Symbol(Decorated, Decl(decorated.ts, 0, 23))
|
>Decorated : Symbol(Decorated, Decl(decorated.ts, 0, 34))
|
||||||
|
|
||||||
=== tests/cases/conformance/decorators/class/undecorated.ts ===
|
=== tests/cases/conformance/decorators/class/undecorated.ts ===
|
||||||
import Decorated from 'decorated';
|
import Decorated from 'decorated';
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
=== tests/cases/conformance/decorators/class/decorated.ts ===
|
=== tests/cases/conformance/decorators/class/decorated.ts ===
|
||||||
function decorate() { }
|
function decorate(target: any) { }
|
||||||
>decorate : () => void
|
>decorate : (target: any) => void
|
||||||
|
>target : any
|
||||||
|
|
||||||
@decorate
|
@decorate
|
||||||
>decorate : () => void
|
>decorate : (target: any) => void
|
||||||
|
|
||||||
export default class Decorated { }
|
export default class Decorated { }
|
||||||
>Decorated : Decorated
|
>Decorated : Decorated
|
||||||
|
|
|
@ -8,7 +8,7 @@ tests/cases/conformance/decorators/class/decoratorChecksFunctionBodies.ts(9,14):
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
@(x => {
|
@((x, p) => {
|
||||||
var a = 3;
|
var a = 3;
|
||||||
func(a);
|
func(a);
|
||||||
~
|
~
|
||||||
|
|
|
@ -5,7 +5,7 @@ function func(s: string): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
@(x => {
|
@((x, p) => {
|
||||||
var a = 3;
|
var a = 3;
|
||||||
func(a);
|
func(a);
|
||||||
return x;
|
return x;
|
||||||
|
@ -34,7 +34,7 @@ var A = (function () {
|
||||||
};
|
};
|
||||||
Object.defineProperty(A.prototype, "m",
|
Object.defineProperty(A.prototype, "m",
|
||||||
__decorate([
|
__decorate([
|
||||||
(function (x) {
|
(function (x, p) {
|
||||||
var a = 3;
|
var a = 3;
|
||||||
func(a);
|
func(a);
|
||||||
return x;
|
return x;
|
||||||
|
|
|
@ -9,7 +9,7 @@ export var test = 'abc';
|
||||||
import { test } from './a';
|
import { test } from './a';
|
||||||
|
|
||||||
function filter(handler: any) {
|
function filter(handler: any) {
|
||||||
return function (target: any) {
|
return function (target: any, propertyKey: string) {
|
||||||
// ...
|
// ...
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||||
};
|
};
|
||||||
var a_1 = require('./a');
|
var a_1 = require('./a');
|
||||||
function filter(handler) {
|
function filter(handler) {
|
||||||
return function (target) {
|
return function (target, propertyKey) {
|
||||||
// ...
|
// ...
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,9 @@ function filter(handler: any) {
|
||||||
>filter : Symbol(filter, Decl(b.ts, 0, 27))
|
>filter : Symbol(filter, Decl(b.ts, 0, 27))
|
||||||
>handler : Symbol(handler, Decl(b.ts, 2, 16))
|
>handler : Symbol(handler, Decl(b.ts, 2, 16))
|
||||||
|
|
||||||
return function (target: any) {
|
return function (target: any, propertyKey: string) {
|
||||||
>target : Symbol(target, Decl(b.ts, 3, 21))
|
>target : Symbol(target, Decl(b.ts, 3, 21))
|
||||||
|
>propertyKey : Symbol(propertyKey, Decl(b.ts, 3, 33))
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,12 +10,13 @@ import { test } from './a';
|
||||||
>test : string
|
>test : string
|
||||||
|
|
||||||
function filter(handler: any) {
|
function filter(handler: any) {
|
||||||
>filter : (handler: any) => (target: any) => void
|
>filter : (handler: any) => (target: any, propertyKey: string) => void
|
||||||
>handler : any
|
>handler : any
|
||||||
|
|
||||||
return function (target: any) {
|
return function (target: any, propertyKey: string) {
|
||||||
>function (target: any) { // ... } : (target: any) => void
|
>function (target: any, propertyKey: string) { // ... } : (target: any, propertyKey: string) => void
|
||||||
>target : any
|
>target : any
|
||||||
|
>propertyKey : string
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
};
|
};
|
||||||
|
@ -25,8 +26,8 @@ class Wat {
|
||||||
>Wat : Wat
|
>Wat : Wat
|
||||||
|
|
||||||
@filter(() => test == 'abc')
|
@filter(() => test == 'abc')
|
||||||
>filter(() => test == 'abc') : (target: any) => void
|
>filter(() => test == 'abc') : (target: any, propertyKey: string) => void
|
||||||
>filter : (handler: any) => (target: any) => void
|
>filter : (handler: any) => (target: any, propertyKey: string) => void
|
||||||
>() => test == 'abc' : () => boolean
|
>() => test == 'abc' : () => boolean
|
||||||
>test == 'abc' : boolean
|
>test == 'abc' : boolean
|
||||||
>test : string
|
>test : string
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
|
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||||
|
Supplied parameters do not match any signature of call target.
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
|
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
|
||||||
|
@ -6,6 +7,7 @@ tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322
|
||||||
|
|
||||||
@dec()
|
@dec()
|
||||||
~~~~~~
|
~~~~~~
|
||||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: typeof C) => void | typeof C'.
|
!!! error TS1238: Unable to resolve signature of class decorator when called as an expression.
|
||||||
|
!!! error TS1238: Supplied parameters do not match any signature of call target.
|
||||||
class C {
|
class C {
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
|
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,6): error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'.
|
||||||
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
Property 'apply' is missing in type 'C'.
|
||||||
Type 'number' is not assignable to type 'string | symbol'.
|
|
||||||
Type 'number' is not assignable to type 'symbol'.
|
|
||||||
|
|
||||||
|
|
||||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
|
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
|
||||||
|
@ -9,9 +7,7 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5)
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
@dec method() {}
|
@dec method() {}
|
||||||
~~~~
|
~~~
|
||||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type '(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<() => void>) => void | TypedPropertyDescriptor<() => void>'.
|
!!! error TS2345: Argument of type 'C' is not assignable to parameter of type 'Function'.
|
||||||
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
!!! error TS2345: Property 'apply' is missing in type 'C'.
|
||||||
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
|
|
||||||
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
|
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
//// [decoratorOnClassMethod13.ts]
|
//// [decoratorOnClassMethod13.ts]
|
||||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
@dec ["1"]() { }
|
@dec ["1"]() { }
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
|
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
|
||||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))
|
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
|
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
|
||||||
>target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 28))
|
>target : Symbol(target, Decl(decoratorOnClassMethod13.ts, 0, 24))
|
||||||
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 40))
|
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod13.ts, 0, 36))
|
||||||
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 61))
|
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod13.ts, 0, 57))
|
||||||
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
|
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
|
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
|
||||||
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
|
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 25))
|
>T : Symbol(T, Decl(decoratorOnClassMethod13.ts, 0, 21))
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
>C : Symbol(C, Decl(decoratorOnClassMethod13.ts, 0, 132))
|
>C : Symbol(C, Decl(decoratorOnClassMethod13.ts, 0, 126))
|
||||||
|
|
||||||
@dec ["1"]() { }
|
@dec ["1"]() { }
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))
|
>dec : Symbol(dec, Decl(decoratorOnClassMethod13.ts, 0, 0))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
|
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod13.ts ===
|
||||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||||
>T : T
|
>T : T
|
||||||
>target : any
|
>target : any
|
||||||
>propertyKey : string
|
>propertyKey : string
|
||||||
|
@ -14,10 +14,10 @@ class C {
|
||||||
>C : C
|
>C : C
|
||||||
|
|
||||||
@dec ["1"]() { }
|
@dec ["1"]() { }
|
||||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||||
>"1" : string
|
>"1" : string
|
||||||
|
|
||||||
@dec ["b"]() { }
|
@dec ["b"]() { }
|
||||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||||
>"b" : string
|
>"b" : string
|
||||||
}
|
}
|
||||||
|
|
13
tests/baselines/reference/decoratorOnClassMethod6.errors.txt
Normal file
13
tests/baselines/reference/decoratorOnClassMethod6.errors.txt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||||
|
Supplied parameters do not match any signature of call target.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts (1 errors) ====
|
||||||
|
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||||
|
|
||||||
|
class C {
|
||||||
|
@dec ["method"]() {}
|
||||||
|
~~~~
|
||||||
|
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||||
|
!!! error TS1241: Supplied parameters do not match any signature of call target.
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
|
|
||||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassMethod6.ts, 0, 0))
|
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
|
|
||||||
>target : Symbol(target, Decl(decoratorOnClassMethod6.ts, 0, 28))
|
|
||||||
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethod6.ts, 0, 40))
|
|
||||||
>descriptor : Symbol(descriptor, Decl(decoratorOnClassMethod6.ts, 0, 61))
|
|
||||||
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
|
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
|
|
||||||
>TypedPropertyDescriptor : Symbol(TypedPropertyDescriptor, Decl(lib.d.ts, 1171, 36))
|
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod6.ts, 0, 25))
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : Symbol(C, Decl(decoratorOnClassMethod6.ts, 0, 132))
|
|
||||||
|
|
||||||
@dec ["method"]() {}
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassMethod6.ts, 0, 0))
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
|
|
||||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
||||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
|
||||||
>T : T
|
|
||||||
>target : any
|
|
||||||
>propertyKey : string
|
|
||||||
>descriptor : TypedPropertyDescriptor<T>
|
|
||||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
|
||||||
>T : T
|
|
||||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
|
||||||
>T : T
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : C
|
|
||||||
|
|
||||||
@dec ["method"]() {}
|
|
||||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
|
||||||
>"method" : string
|
|
||||||
}
|
|
13
tests/baselines/reference/decoratorOnClassMethod8.errors.txt
Normal file
13
tests/baselines/reference/decoratorOnClassMethod8.errors.txt
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts(4,5): error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||||
|
Supplied parameters do not match any signature of call target.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts (1 errors) ====
|
||||||
|
declare function dec<T>(target: T): T;
|
||||||
|
|
||||||
|
class C {
|
||||||
|
@dec method() {}
|
||||||
|
~~~~
|
||||||
|
!!! error TS1241: Unable to resolve signature of method decorator when called as an expression.
|
||||||
|
!!! error TS1241: Supplied parameters do not match any signature of call target.
|
||||||
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
|
|
||||||
declare function dec<T>(target: T): T;
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassMethod8.ts, 0, 0))
|
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
|
|
||||||
>target : Symbol(target, Decl(decoratorOnClassMethod8.ts, 0, 24))
|
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
|
|
||||||
>T : Symbol(T, Decl(decoratorOnClassMethod8.ts, 0, 21))
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : Symbol(C, Decl(decoratorOnClassMethod8.ts, 0, 38))
|
|
||||||
|
|
||||||
@dec method() {}
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassMethod8.ts, 0, 0))
|
|
||||||
>method : Symbol(method, Decl(decoratorOnClassMethod8.ts, 2, 9))
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
|
|
||||||
declare function dec<T>(target: T): T;
|
|
||||||
>dec : <T>(target: T) => T
|
|
||||||
>T : T
|
|
||||||
>target : T
|
|
||||||
>T : T
|
|
||||||
>T : T
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : C
|
|
||||||
|
|
||||||
@dec method() {}
|
|
||||||
>dec : <T>(target: T) => T
|
|
||||||
>method : () => void
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
//// [decoratorOnClassMethodParameter1.ts]
|
//// [decoratorOnClassMethodParameter1.ts]
|
||||||
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
|
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
method(@dec p: number) {}
|
method(@dec p: number) {}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
|
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
|
||||||
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
|
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassMethodParameter1.ts, 0, 0))
|
>dec : Symbol(dec, Decl(decoratorOnClassMethodParameter1.ts, 0, 0))
|
||||||
>target : Symbol(target, Decl(decoratorOnClassMethodParameter1.ts, 0, 21))
|
>target : Symbol(target, Decl(decoratorOnClassMethodParameter1.ts, 0, 21))
|
||||||
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
|
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
||||||
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter1.ts, 0, 38))
|
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter1.ts, 0, 36))
|
||||||
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter1.ts, 0, 68))
|
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter1.ts, 0, 66))
|
||||||
|
|
||||||
class C {
|
class C {
|
||||||
>C : Symbol(C, Decl(decoratorOnClassMethodParameter1.ts, 0, 99))
|
>C : Symbol(C, Decl(decoratorOnClassMethodParameter1.ts, 0, 97))
|
||||||
|
|
||||||
method(@dec p: number) {}
|
method(@dec p: number) {}
|
||||||
>method : Symbol(method, Decl(decoratorOnClassMethodParameter1.ts, 2, 9))
|
>method : Symbol(method, Decl(decoratorOnClassMethodParameter1.ts, 2, 9))
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
|
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
|
||||||
declare function dec(target: Function, propertyKey: string | symbol, parameterIndex: number): void;
|
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
|
||||||
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
|
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
|
||||||
>target : Function
|
>target : Object
|
||||||
>Function : Function
|
>Object : Object
|
||||||
>propertyKey : string | symbol
|
>propertyKey : string | symbol
|
||||||
>parameterIndex : number
|
>parameterIndex : number
|
||||||
|
|
||||||
|
@ -11,6 +11,6 @@ class C {
|
||||||
|
|
||||||
method(@dec p: number) {}
|
method(@dec p: number) {}
|
||||||
>method : (p: number) => void
|
>method : (p: number) => void
|
||||||
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
|
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
|
||||||
>p : number
|
>p : number
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
|
||||||
|
Supplied parameters do not match any signature of call target.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts (1 errors) ====
|
||||||
|
declare function dec(): <T>(target: any, propertyKey: string) => void;
|
||||||
|
|
||||||
|
class C {
|
||||||
|
@dec prop;
|
||||||
|
~~~~
|
||||||
|
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
|
||||||
|
!!! error TS1240: Supplied parameters do not match any signature of call target.
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
|
|
||||||
declare function dec(): <T>(target: any, propertyKey: string) => void;
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassProperty11.ts, 0, 0))
|
|
||||||
>T : Symbol(T, Decl(decoratorOnClassProperty11.ts, 0, 25))
|
|
||||||
>target : Symbol(target, Decl(decoratorOnClassProperty11.ts, 0, 28))
|
|
||||||
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassProperty11.ts, 0, 40))
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : Symbol(C, Decl(decoratorOnClassProperty11.ts, 0, 70))
|
|
||||||
|
|
||||||
@dec prop;
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassProperty11.ts, 0, 0))
|
|
||||||
>prop : Symbol(prop, Decl(decoratorOnClassProperty11.ts, 2, 9))
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
|
|
||||||
declare function dec(): <T>(target: any, propertyKey: string) => void;
|
|
||||||
>dec : () => <T>(target: any, propertyKey: string) => void
|
|
||||||
>T : T
|
|
||||||
>target : any
|
|
||||||
>propertyKey : string
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : C
|
|
||||||
|
|
||||||
@dec prop;
|
|
||||||
>dec : () => <T>(target: any, propertyKey: string) => void
|
|
||||||
>prop : any
|
|
||||||
}
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts(4,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
|
||||||
|
Supplied parameters do not match any signature of call target.
|
||||||
|
|
||||||
|
|
||||||
|
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts (1 errors) ====
|
||||||
|
declare function dec(target: Function): void;
|
||||||
|
|
||||||
|
class C {
|
||||||
|
@dec prop;
|
||||||
|
~~~~
|
||||||
|
!!! error TS1240: Unable to resolve signature of property decorator when called as an expression.
|
||||||
|
!!! error TS1240: Supplied parameters do not match any signature of call target.
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
|
|
||||||
declare function dec(target: Function): void;
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassProperty6.ts, 0, 0))
|
|
||||||
>target : Symbol(target, Decl(decoratorOnClassProperty6.ts, 0, 21))
|
|
||||||
>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11))
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : Symbol(C, Decl(decoratorOnClassProperty6.ts, 0, 45))
|
|
||||||
|
|
||||||
@dec prop;
|
|
||||||
>dec : Symbol(dec, Decl(decoratorOnClassProperty6.ts, 0, 0))
|
|
||||||
>prop : Symbol(prop, Decl(decoratorOnClassProperty6.ts, 2, 9))
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
|
|
||||||
declare function dec(target: Function): void;
|
|
||||||
>dec : (target: Function) => void
|
|
||||||
>target : Function
|
|
||||||
>Function : Function
|
|
||||||
|
|
||||||
class C {
|
|
||||||
>C : C
|
|
||||||
|
|
||||||
@dec prop;
|
|
||||||
>dec : (target: Function) => void
|
|
||||||
>prop : any
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue