Merge branch 'master' into jsDocClassification

This commit is contained in:
Cyrus Najmabadi
2015-06-02 13:48:56 -07:00
564 changed files with 15375 additions and 4267 deletions
+5 -8
View File
@@ -1502,6 +1502,11 @@ interface Array<T> {
copyWithin(target: number, start: number, end?: number): T[];
}
interface IArguments {
/** Iterator */
[Symbol.iterator](): IterableIterator<any>;
}
interface ArrayConstructor {
/**
* Creates an array from an array-like object.
@@ -1686,14 +1691,6 @@ interface GeneratorFunctionConstructor {
}
declare var GeneratorFunction: GeneratorFunctionConstructor;
interface Generator<T> extends IterableIterator<T> {
next(value?: any): IteratorResult<T>;
throw(exception: any): IteratorResult<T>;
return(value: T): IteratorResult<T>;
[Symbol.iterator](): Generator<T>;
[Symbol.toStringTag]: string;
}
interface Math {
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
+8 -8
View File
@@ -3552,10 +3552,10 @@ declare module Intl {
resolvedOptions(): ResolvedNumberFormatOptions;
}
var NumberFormat: {
new (locales?: string[], options?: NumberFormatOptions): Collator;
new (locale?: string, options?: NumberFormatOptions): Collator;
(locales?: string[], options?: NumberFormatOptions): Collator;
(locale?: string, options?: NumberFormatOptions): Collator;
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
(locale?: string, options?: NumberFormatOptions): NumberFormat;
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
}
@@ -3597,10 +3597,10 @@ declare module Intl {
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
new (locale?: string, options?: DateTimeFormatOptions): Collator;
(locales?: string[], options?: DateTimeFormatOptions): Collator;
(locale?: string, options?: DateTimeFormatOptions): Collator;
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
}
+8 -8
View File
@@ -2382,10 +2382,10 @@ declare module Intl {
resolvedOptions(): ResolvedNumberFormatOptions;
}
var NumberFormat: {
new (locales?: string[], options?: NumberFormatOptions): Collator;
new (locale?: string, options?: NumberFormatOptions): Collator;
(locales?: string[], options?: NumberFormatOptions): Collator;
(locale?: string, options?: NumberFormatOptions): Collator;
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
(locale?: string, options?: NumberFormatOptions): NumberFormat;
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
}
@@ -2427,10 +2427,10 @@ declare module Intl {
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
new (locale?: string, options?: DateTimeFormatOptions): Collator;
(locales?: string[], options?: DateTimeFormatOptions): Collator;
(locale?: string, options?: DateTimeFormatOptions): Collator;
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
}
+13 -16
View File
@@ -1502,6 +1502,11 @@ interface Array<T> {
copyWithin(target: number, start: number, end?: number): T[];
}
interface IArguments {
/** Iterator */
[Symbol.iterator](): IterableIterator<any>;
}
interface ArrayConstructor {
/**
* Creates an array from an array-like object.
@@ -1686,14 +1691,6 @@ interface GeneratorFunctionConstructor {
}
declare var GeneratorFunction: GeneratorFunctionConstructor;
interface Generator<T> extends IterableIterator<T> {
next(value?: any): IteratorResult<T>;
throw(exception: any): IteratorResult<T>;
return(value: T): IteratorResult<T>;
[Symbol.iterator](): Generator<T>;
[Symbol.toStringTag]: string;
}
interface Math {
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
@@ -4933,10 +4930,10 @@ declare module Intl {
resolvedOptions(): ResolvedNumberFormatOptions;
}
var NumberFormat: {
new (locales?: string[], options?: NumberFormatOptions): Collator;
new (locale?: string, options?: NumberFormatOptions): Collator;
(locales?: string[], options?: NumberFormatOptions): Collator;
(locale?: string, options?: NumberFormatOptions): Collator;
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
(locale?: string, options?: NumberFormatOptions): NumberFormat;
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
}
@@ -4978,10 +4975,10 @@ declare module Intl {
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
new (locale?: string, options?: DateTimeFormatOptions): Collator;
(locales?: string[], options?: DateTimeFormatOptions): Collator;
(locale?: string, options?: DateTimeFormatOptions): Collator;
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
}
+8 -8
View File
@@ -2382,10 +2382,10 @@ declare module Intl {
resolvedOptions(): ResolvedNumberFormatOptions;
}
var NumberFormat: {
new (locales?: string[], options?: NumberFormatOptions): Collator;
new (locale?: string, options?: NumberFormatOptions): Collator;
(locales?: string[], options?: NumberFormatOptions): Collator;
(locale?: string, options?: NumberFormatOptions): Collator;
new (locales?: string[], options?: NumberFormatOptions): NumberFormat;
new (locale?: string, options?: NumberFormatOptions): NumberFormat;
(locales?: string[], options?: NumberFormatOptions): NumberFormat;
(locale?: string, options?: NumberFormatOptions): NumberFormat;
supportedLocalesOf(locales: string[], options?: NumberFormatOptions): string[];
supportedLocalesOf(locale: string, options?: NumberFormatOptions): string[];
}
@@ -2427,10 +2427,10 @@ declare module Intl {
resolvedOptions(): ResolvedDateTimeFormatOptions;
}
var DateTimeFormat: {
new (locales?: string[], options?: DateTimeFormatOptions): Collator;
new (locale?: string, options?: DateTimeFormatOptions): Collator;
(locales?: string[], options?: DateTimeFormatOptions): Collator;
(locale?: string, options?: DateTimeFormatOptions): Collator;
new (locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
new (locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
(locales?: string[], options?: DateTimeFormatOptions): DateTimeFormat;
(locale?: string, options?: DateTimeFormatOptions): DateTimeFormat;
supportedLocalesOf(locales: string[], options?: DateTimeFormatOptions): string[];
supportedLocalesOf(locale: string, options?: DateTimeFormatOptions): string[];
}
+1631 -610
View File
File diff suppressed because it is too large Load Diff
+1719 -669
View File
File diff suppressed because it is too large Load Diff
+110 -9
View File
@@ -251,8 +251,30 @@ declare module "typescript" {
ShorthandPropertyAssignment = 226,
EnumMember = 227,
SourceFile = 228,
SyntaxList = 229,
Count = 230,
JSDocTypeExpression = 229,
JSDocAllType = 230,
JSDocUnknownType = 231,
JSDocArrayType = 232,
JSDocUnionType = 233,
JSDocTupleType = 234,
JSDocNullableType = 235,
JSDocNonNullableType = 236,
JSDocRecordType = 237,
JSDocRecordMember = 238,
JSDocTypeReference = 239,
JSDocOptionalType = 240,
JSDocFunctionType = 241,
JSDocVariadicType = 242,
JSDocConstructorType = 243,
JSDocThisType = 244,
JSDocComment = 245,
JSDocTag = 246,
JSDocParameterTag = 247,
JSDocReturnTag = 248,
JSDocTypeTag = 249,
JSDocTemplateTag = 250,
SyntaxList = 251,
Count = 252,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
@@ -495,7 +517,7 @@ declare module "typescript" {
}
interface YieldExpression extends Expression {
asteriskToken?: Node;
expression: Expression;
expression?: Expression;
}
interface BinaryExpression extends Expression {
left: Expression;
@@ -666,7 +688,7 @@ declare module "typescript" {
interface ClassElement extends Declaration {
_classElementBrand: any;
}
interface InterfaceDeclaration extends Declaration, ModuleElement {
interface InterfaceDeclaration extends Declaration, Statement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
heritageClauses?: NodeArray<HeritageClause>;
@@ -676,7 +698,7 @@ declare module "typescript" {
token: SyntaxKind;
types?: NodeArray<ExpressionWithTypeArguments>;
}
interface TypeAliasDeclaration extends Declaration, ModuleElement {
interface TypeAliasDeclaration extends Declaration, Statement {
name: Identifier;
type: TypeNode;
}
@@ -684,7 +706,7 @@ declare module "typescript" {
name: DeclarationName;
initializer?: Expression;
}
interface EnumDeclaration extends Declaration, ModuleElement {
interface EnumDeclaration extends Declaration, Statement {
name: Identifier;
members: NodeArray<EnumMember>;
}
@@ -739,6 +761,82 @@ declare module "typescript" {
hasTrailingNewLine?: boolean;
kind: SyntaxKind;
}
interface JSDocTypeExpression extends Node {
type: JSDocType;
}
interface JSDocType extends TypeNode {
_jsDocTypeBrand: any;
}
interface JSDocAllType extends JSDocType {
_JSDocAllTypeBrand: any;
}
interface JSDocUnknownType extends JSDocType {
_JSDocUnknownTypeBrand: any;
}
interface JSDocArrayType extends JSDocType {
elementType: JSDocType;
}
interface JSDocUnionType extends JSDocType {
types: NodeArray<JSDocType>;
}
interface JSDocTupleType extends JSDocType {
types: NodeArray<JSDocType>;
}
interface JSDocNonNullableType extends JSDocType {
type: JSDocType;
}
interface JSDocNullableType extends JSDocType {
type: JSDocType;
}
interface JSDocRecordType extends JSDocType, TypeLiteralNode {
members: NodeArray<JSDocRecordMember>;
}
interface JSDocTypeReference extends JSDocType {
name: EntityName;
typeArguments: NodeArray<JSDocType>;
}
interface JSDocOptionalType extends JSDocType {
type: JSDocType;
}
interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
parameters: NodeArray<ParameterDeclaration>;
type: JSDocType;
}
interface JSDocVariadicType extends JSDocType {
type: JSDocType;
}
interface JSDocConstructorType extends JSDocType {
type: JSDocType;
}
interface JSDocThisType extends JSDocType {
type: JSDocType;
}
interface JSDocRecordMember extends PropertyDeclaration {
name: Identifier | LiteralExpression;
type?: JSDocType;
}
interface JSDocComment extends Node {
tags: NodeArray<JSDocTag>;
}
interface JSDocTag extends Node {
atToken: Node;
tagName: Identifier;
}
interface JSDocTemplateTag extends JSDocTag {
typeParameters: NodeArray<TypeParameterDeclaration>;
}
interface JSDocReturnTag extends JSDocTag {
typeExpression: JSDocTypeExpression;
}
interface JSDocTypeTag extends JSDocTag {
typeExpression: JSDocTypeExpression;
}
interface JSDocParameterTag extends JSDocTag {
preParameterName?: Identifier;
typeExpression?: JSDocTypeExpression;
postParameterName?: Identifier;
isBracketed: boolean;
}
interface SourceFile extends Declaration {
statements: NodeArray<ModuleElement>;
endOfFileToken: Node;
@@ -1011,6 +1109,8 @@ declare module "typescript" {
}
interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
localTypeParameters: TypeParameter[];
}
interface InterfaceTypeWithBaseTypes extends InterfaceType {
baseTypes: ObjectType[];
@@ -1114,7 +1214,8 @@ declare module "typescript" {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
emitDecoratorMetadata?: boolean;
[option: string]: string | number | boolean;
}
@@ -1226,8 +1327,6 @@ declare module "typescript" {
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
}
declare module "typescript" {
function getDefaultLibFileName(options: CompilerOptions): string;
@@ -1256,8 +1355,10 @@ declare module "typescript" {
* Vn.
*/
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
}
declare module "typescript" {
var throwOnJSDocErrors: boolean;
function getNodeConstructor(kind: SyntaxKind): new () => Node;
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
+1999 -764
View File
File diff suppressed because it is too large Load Diff
+110 -9
View File
@@ -251,8 +251,30 @@ declare module ts {
ShorthandPropertyAssignment = 226,
EnumMember = 227,
SourceFile = 228,
SyntaxList = 229,
Count = 230,
JSDocTypeExpression = 229,
JSDocAllType = 230,
JSDocUnknownType = 231,
JSDocArrayType = 232,
JSDocUnionType = 233,
JSDocTupleType = 234,
JSDocNullableType = 235,
JSDocNonNullableType = 236,
JSDocRecordType = 237,
JSDocRecordMember = 238,
JSDocTypeReference = 239,
JSDocOptionalType = 240,
JSDocFunctionType = 241,
JSDocVariadicType = 242,
JSDocConstructorType = 243,
JSDocThisType = 244,
JSDocComment = 245,
JSDocTag = 246,
JSDocParameterTag = 247,
JSDocReturnTag = 248,
JSDocTypeTag = 249,
JSDocTemplateTag = 250,
SyntaxList = 251,
Count = 252,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
@@ -495,7 +517,7 @@ declare module ts {
}
interface YieldExpression extends Expression {
asteriskToken?: Node;
expression: Expression;
expression?: Expression;
}
interface BinaryExpression extends Expression {
left: Expression;
@@ -666,7 +688,7 @@ declare module ts {
interface ClassElement extends Declaration {
_classElementBrand: any;
}
interface InterfaceDeclaration extends Declaration, ModuleElement {
interface InterfaceDeclaration extends Declaration, Statement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
heritageClauses?: NodeArray<HeritageClause>;
@@ -676,7 +698,7 @@ declare module ts {
token: SyntaxKind;
types?: NodeArray<ExpressionWithTypeArguments>;
}
interface TypeAliasDeclaration extends Declaration, ModuleElement {
interface TypeAliasDeclaration extends Declaration, Statement {
name: Identifier;
type: TypeNode;
}
@@ -684,7 +706,7 @@ declare module ts {
name: DeclarationName;
initializer?: Expression;
}
interface EnumDeclaration extends Declaration, ModuleElement {
interface EnumDeclaration extends Declaration, Statement {
name: Identifier;
members: NodeArray<EnumMember>;
}
@@ -739,6 +761,82 @@ declare module ts {
hasTrailingNewLine?: boolean;
kind: SyntaxKind;
}
interface JSDocTypeExpression extends Node {
type: JSDocType;
}
interface JSDocType extends TypeNode {
_jsDocTypeBrand: any;
}
interface JSDocAllType extends JSDocType {
_JSDocAllTypeBrand: any;
}
interface JSDocUnknownType extends JSDocType {
_JSDocUnknownTypeBrand: any;
}
interface JSDocArrayType extends JSDocType {
elementType: JSDocType;
}
interface JSDocUnionType extends JSDocType {
types: NodeArray<JSDocType>;
}
interface JSDocTupleType extends JSDocType {
types: NodeArray<JSDocType>;
}
interface JSDocNonNullableType extends JSDocType {
type: JSDocType;
}
interface JSDocNullableType extends JSDocType {
type: JSDocType;
}
interface JSDocRecordType extends JSDocType, TypeLiteralNode {
members: NodeArray<JSDocRecordMember>;
}
interface JSDocTypeReference extends JSDocType {
name: EntityName;
typeArguments: NodeArray<JSDocType>;
}
interface JSDocOptionalType extends JSDocType {
type: JSDocType;
}
interface JSDocFunctionType extends JSDocType, SignatureDeclaration {
parameters: NodeArray<ParameterDeclaration>;
type: JSDocType;
}
interface JSDocVariadicType extends JSDocType {
type: JSDocType;
}
interface JSDocConstructorType extends JSDocType {
type: JSDocType;
}
interface JSDocThisType extends JSDocType {
type: JSDocType;
}
interface JSDocRecordMember extends PropertyDeclaration {
name: Identifier | LiteralExpression;
type?: JSDocType;
}
interface JSDocComment extends Node {
tags: NodeArray<JSDocTag>;
}
interface JSDocTag extends Node {
atToken: Node;
tagName: Identifier;
}
interface JSDocTemplateTag extends JSDocTag {
typeParameters: NodeArray<TypeParameterDeclaration>;
}
interface JSDocReturnTag extends JSDocTag {
typeExpression: JSDocTypeExpression;
}
interface JSDocTypeTag extends JSDocTag {
typeExpression: JSDocTypeExpression;
}
interface JSDocParameterTag extends JSDocTag {
preParameterName?: Identifier;
typeExpression?: JSDocTypeExpression;
postParameterName?: Identifier;
isBracketed: boolean;
}
interface SourceFile extends Declaration {
statements: NodeArray<ModuleElement>;
endOfFileToken: Node;
@@ -1011,6 +1109,8 @@ declare module ts {
}
interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[];
outerTypeParameters: TypeParameter[];
localTypeParameters: TypeParameter[];
}
interface InterfaceTypeWithBaseTypes extends InterfaceType {
baseTypes: ObjectType[];
@@ -1114,7 +1214,8 @@ declare module ts {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
emitDecoratorMetadata?: boolean;
[option: string]: string | number | boolean;
}
@@ -1226,8 +1327,6 @@ declare module ts {
function getTrailingCommentRanges(text: string, pos: number): CommentRange[];
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean;
function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean;
/** Creates a scanner over a (possibly unspecified) range of a piece of text. */
function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner;
}
declare module ts {
function getDefaultLibFileName(options: CompilerOptions): string;
@@ -1256,8 +1355,10 @@ declare module ts {
* Vn.
*/
function collapseTextChangeRangesAcrossMultipleVersions(changes: TextChangeRange[]): TextChangeRange;
function getTypeParameterOwner(d: Declaration): Declaration;
}
declare module ts {
var throwOnJSDocErrors: boolean;
function getNodeConstructor(kind: SyntaxKind): new () => Node;
function createNode(kind: SyntaxKind): Node;
function forEachChild<T>(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T;
+1999 -764
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "1.5.2",
"version": "1.5.3",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
+4 -4
View File
@@ -519,17 +519,17 @@ module ts {
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
break;
case SyntaxKind.InterfaceDeclaration:
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes);
break;
case SyntaxKind.TypeAliasDeclaration:
bindDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.TypeAlias, SymbolFlags.TypeAliasExcludes);
break;
case SyntaxKind.EnumDeclaration:
if (isConst(node)) {
bindDeclaration(<Declaration>node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.ConstEnum, SymbolFlags.ConstEnumExcludes);
}
else {
bindDeclaration(<Declaration>node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes, /*isBlockScopeContainer*/ false);
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.RegularEnum, SymbolFlags.RegularEnumExcludes);
}
break;
case SyntaxKind.ModuleDeclaration:
+540 -284
View File
File diff suppressed because it is too large Load Diff
+8 -2
View File
@@ -142,7 +142,7 @@ module ts {
paramType: Diagnostics.LOCATION,
},
{
name: "separateCompilation",
name: "isolatedModules",
type: "boolean",
},
{
@@ -188,10 +188,16 @@ module ts {
type: "boolean",
description: Diagnostics.Watch_input_files,
},
{
name: "experimentalDecorators",
type: "boolean",
description: Diagnostics.Enables_experimental_support_for_ES7_decorators
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
experimental: true,
description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators
}
];
+10
View File
@@ -129,6 +129,16 @@ module ts {
}
}
export function rangeEquals<T>(array1: T[], array2: T[], pos: number, end: number) {
while (pos < end) {
if (array1[pos] !== array2[pos]) {
return false;
}
pos++;
}
return true;
}
/**
* Returns the last element of an array if non-empty, undefined otherwise.
*/
@@ -120,7 +120,7 @@ module ts {
Unterminated_template_literal: { code: 1160, category: DiagnosticCategory.Error, key: "Unterminated template literal." },
Unterminated_regular_expression_literal: { code: 1161, category: DiagnosticCategory.Error, key: "Unterminated regular expression literal." },
An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." },
yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." },
A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: DiagnosticCategory.Error, key: "A 'yield' expression is only allowed in a generator body." },
Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." },
A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." },
A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." },
@@ -165,8 +165,8 @@ module ts {
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." },
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--isolatedModules' flag is provided." },
Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." },
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" },
@@ -174,7 +174,11 @@ module ts {
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
_0_tag_already_specified: { code: 1219, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." },
Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning: { code: 1219, category: DiagnosticCategory.Error, key: "Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning." },
Generators_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 1220, category: DiagnosticCategory.Error, key: "Generators are only available when targeting ECMAScript 6 or higher." },
Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: DiagnosticCategory.Error, key: "Generators are not allowed in an ambient context." },
An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: DiagnosticCategory.Error, key: "An overload signature cannot be declared as a generator." },
_0_tag_already_specified: { code: 1223, category: DiagnosticCategory.Error, key: "'{0}' tag already specified." },
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." },
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
@@ -366,6 +370,8 @@ module ts {
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: DiagnosticCategory.Error, key: "'{0}' is referenced directly or indirectly in its own type annotation." },
Cannot_find_namespace_0: { code: 2503, category: DiagnosticCategory.Error, key: "Cannot find namespace '{0}'." },
No_best_common_type_exists_among_yield_expressions: { code: 2504, category: DiagnosticCategory.Error, key: "No best common type exists among yield expressions." },
A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: DiagnosticCategory.Error, key: "A generator cannot have a 'void' type annotation." },
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
@@ -450,11 +456,11 @@ module ts {
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." },
Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." },
Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." },
Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." },
Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
Option_sourceMap_cannot_be_specified_with_option_isolatedModules: { code: 5043, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'isolatedModules'." },
Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." },
Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." },
Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." },
Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." },
Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." },
Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." },
@@ -508,6 +514,9 @@ module ts {
Specifies_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: DiagnosticCategory.Message, key: "Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." },
NEWLINE: { code: 6061, category: DiagnosticCategory.Message, key: "NEWLINE" },
Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." },
Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." },
Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." },
Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." },
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },
@@ -523,6 +532,7 @@ module ts {
_0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: DiagnosticCategory.Error, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." },
_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: DiagnosticCategory.Error, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: DiagnosticCategory.Error, key: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." },
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." },
import_can_only_be_used_in_a_ts_file: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in a .ts file." },
@@ -540,10 +550,7 @@ module 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." },
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." },
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
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." },
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
};
}
+50 -22
View File
@@ -467,7 +467,7 @@
"category": "Error",
"code": 1162
},
"'yield' expression must be contained_within a generator declaration.": {
"A 'yield' expression is only allowed in a generator body.": {
"category": "Error",
"code": 1163
},
@@ -647,11 +647,11 @@
"category": "Error",
"code": 1207
},
"Cannot compile namespaces when the '--separateCompilation' flag is provided.": {
"Cannot compile namespaces when the '--isolatedModules' flag is provided.": {
"category": "Error",
"code": 1208
},
"Ambient const enums are not allowed when the '--separateCompilation' flag is provided.": {
"Ambient const enums are not allowed when the '--isolatedModules' flag is provided.": {
"category": "Error",
"code": 1209
},
@@ -683,10 +683,27 @@
"category": "Error",
"code": 1218
},
"'{0}' tag already specified.": {
"Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.": {
"category": "Error",
"code": 1219
},
"Generators are only available when targeting ECMAScript 6 or higher.": {
"category": "Error",
"code": 1220
},
"Generators are not allowed in an ambient context.": {
"category": "Error",
"code": 1221
},
"An overload signature cannot be declared as a generator.": {
"category": "Error",
"code": 1222
},
"'{0}' tag already specified.": {
"category": "Error",
"code": 1223
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@@ -1451,6 +1468,14 @@
"category": "Error",
"code": 2503
},
"No best common type exists among yield expressions.": {
"category": "Error",
"code": 2504
},
"A generator cannot have a 'void' type annotation.": {
"category": "Error",
"code": 2505
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
@@ -1788,23 +1813,23 @@
"category": "Error",
"code": 5042
},
"Option 'sourceMap' cannot be specified with option 'separateCompilation'.": {
"Option 'sourceMap' cannot be specified with option 'isolatedModules'.": {
"category": "Error",
"code": 5043
},
"Option 'declaration' cannot be specified with option 'separateCompilation'.": {
"Option 'declaration' cannot be specified with option 'isolatedModules'.": {
"category": "Error",
"code": 5044
},
"Option 'noEmitOnError' cannot be specified with option 'separateCompilation'.": {
"Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.": {
"category": "Error",
"code": 5045
},
"Option 'out' cannot be specified with option 'separateCompilation'.": {
"Option 'out' cannot be specified with option 'isolatedModules'.": {
"category": "Error",
"code": 5046
},
"Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
"Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
"category": "Error",
"code": 5047
},
@@ -2021,7 +2046,18 @@
"category": "Error",
"code": 6062
},
"Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified.": {
"category": "Error",
"code": 6064
},
"Enables experimental support for ES7 decorators.": {
"category": "Message",
"code": 6065
},
"Enables experimental support for emitting type metadata for decorators.": {
"category": "Message",
"code": 6066
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
@@ -2083,6 +2119,10 @@
"category": "Error",
"code": 7024
},
"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.": {
"category": "Error",
"code": 7025
},
"You cannot rename this element.": {
"category": "Error",
"code": 8000
@@ -2152,14 +2192,6 @@
"code": 8017
},
"'yield' expressions are not currently supported.": {
"category": "Error",
"code": 9000
},
"Generators are not currently supported.": {
"category": "Error",
"code": 9001
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
"category": "Error",
"code": 9002
@@ -2167,9 +2199,5 @@
"'class' expressions are not currently supported.": {
"category": "Error",
"code": 9003
},
"'class' declarations are only supported directly inside a module or as a top level declaration.": {
"category": "Error",
"code": 9004
}
}
+4 -4
View File
@@ -1719,7 +1719,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
}
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
if (compilerOptions.separateCompilation) {
if (compilerOptions.isolatedModules) {
// do not inline enum values in separate compilation mode
return false;
}
@@ -4430,7 +4430,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
function shouldEmitEnumDeclaration(node: EnumDeclaration) {
let isConstEnum = isConst(node);
return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.separateCompilation;
return !isConstEnum || compilerOptions.preserveConstEnums || compilerOptions.isolatedModules;
}
function emitEnumDeclaration(node: EnumDeclaration) {
@@ -4535,7 +4535,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
}
function shouldEmitModuleDeclaration(node: ModuleDeclaration) {
return isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.separateCompilation);
return isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules);
}
function isModuleMergedWithES6Class(node: ModuleDeclaration) {
@@ -5744,7 +5744,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
}
}
if (isExternalModule(node) || compilerOptions.separateCompilation) {
if (isExternalModule(node) || compilerOptions.isolatedModules) {
if (languageVersion >= ScriptTarget.ES6) {
emitES6Module(node, startIndex);
}
+245 -301
View File
@@ -399,7 +399,7 @@ module ts {
module Parser {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ true);
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
const disallowInAndDecoratorContext = ParserContextFlags.DisallowIn | ParserContextFlags.Decorator;
let sourceFile: SourceFile;
@@ -491,6 +491,13 @@ module ts {
// attached to the EOF token.
let parseErrorBeforeNextFinishedNode: boolean = false;
export const enum StatementFlags {
None = 0,
Statement = 1,
ModuleElement = 2,
StatementOrModuleElement = Statement | ModuleElement
}
export function parseSourceFile(fileName: string, _sourceText: string, languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor, setParentNodes?: boolean): SourceFile {
initializeState(fileName, _sourceText, languageVersion, _syntaxCursor);
@@ -845,7 +852,7 @@ module ts {
// was in immediately prior to invoking the callback. The result of invoking the callback
// is returned from this function.
function lookAhead<T>(callback: () => T): T {
return speculationHelper(callback, /*isLookAhead:*/ true);
return speculationHelper(callback, /*isLookAhead*/ true);
}
// Invokes the provided callback. If the callback returns something falsy, then it restores
@@ -853,7 +860,7 @@ module ts {
// callback returns something truthy, then the parser state is not rolled back. The result
// of invoking the callback is returned from this function.
function tryParse<T>(callback: () => T): T {
return speculationHelper(callback, /*isLookAhead:*/ false);
return speculationHelper(callback, /*isLookAhead*/ false);
}
// Ignore strict mode flag because we will report an error in type checker instead.
@@ -1002,7 +1009,7 @@ module ts {
return finishNode(node);
}
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition:*/ false, diagnosticMessage || Diagnostics.Identifier_expected);
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ false, diagnosticMessage || Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage?: DiagnosticMessage): Identifier {
@@ -1021,7 +1028,7 @@ module ts {
function parsePropertyNameWorker(allowComputedPropertyNames: boolean): DeclarationName {
if (token === SyntaxKind.StringLiteral || token === SyntaxKind.NumericLiteral) {
return parseLiteralNode(/*internName:*/ true);
return parseLiteralNode(/*internName*/ true);
}
if (allowComputedPropertyNames && token === SyntaxKind.OpenBracketToken) {
return parseComputedPropertyName();
@@ -1119,10 +1126,17 @@ module ts {
switch (parsingContext) {
case ParsingContext.SourceElements:
case ParsingContext.ModuleElements:
return isSourceElement(inErrorRecovery);
// If we're in error recovery, then we don't want to treat ';' as an empty statement.
// The problem is that ';' can show up in far too many contexts, and if we see one
// and assume it's a statement, then we may bail out inappropriately from whatever
// we're parsing. For example, if we have a semicolon in the middle of a class, then
// we really don't want to assume the class is over and we're on a statement in the
// outer module. We just want to consume and move on.
return !(token === SyntaxKind.SemicolonToken && inErrorRecovery) && isStartOfModuleElement();
case ParsingContext.BlockStatements:
case ParsingContext.SwitchClauseStatements:
return isStartOfStatement(inErrorRecovery);
// During error recovery we don't treat empty statements as statements
return !(token === SyntaxKind.SemicolonToken && inErrorRecovery) && isStartOfStatement();
case ParsingContext.SwitchClauses:
return token === SyntaxKind.CaseKeyword || token === SyntaxKind.DefaultKeyword;
case ParsingContext.TypeMembers:
@@ -1803,7 +1817,7 @@ module ts {
// Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually
// be an identifier and the error woudl be quite confusing.
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentToken:*/ true, Diagnostics.Identifier_expected);
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentToken*/ true, Diagnostics.Identifier_expected);
}
}
@@ -1841,7 +1855,7 @@ module ts {
literal = parseLiteralNode();
}
else {
literal = <LiteralExpression>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition:*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
literal = <LiteralExpression>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
}
span.literal = literal;
@@ -1934,7 +1948,7 @@ module ts {
function parseParameterType(): TypeNode {
if (parseOptional(SyntaxKind.ColonToken)) {
return token === SyntaxKind.StringLiteral
? <StringLiteral>parseLiteralNode(/*internName:*/ true)
? <StringLiteral>parseLiteralNode(/*internName*/ true)
: parseType();
}
@@ -2075,7 +2089,7 @@ module ts {
if (kind === SyntaxKind.ConstructSignature) {
parseExpected(SyntaxKind.NewKeyword);
}
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
parseTypeMemberSemicolon();
return finishNode(node);
}
@@ -2165,7 +2179,7 @@ module ts {
// Method signatues don't exist in expression contexts. So they have neither
// [Yield] nor [GeneratorParameter]
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, method);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, method);
parseTypeMemberSemicolon();
return finishNode(method);
}
@@ -2222,7 +2236,7 @@ module ts {
case SyntaxKind.OpenBracketToken:
// Indexer or computed property
return isIndexSignature()
? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined)
? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined)
: parsePropertyOrMethodSignature();
case SyntaxKind.NewKeyword:
if (lookAhead(isStartOfConstructSignature)) {
@@ -2304,7 +2318,7 @@ module ts {
if (kind === SyntaxKind.ConstructorType) {
parseExpected(SyntaxKind.NewKeyword);
}
fillSignature(SyntaxKind.EqualsGreaterThanToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
fillSignature(SyntaxKind.EqualsGreaterThanToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
return finishNode(node);
}
@@ -2613,7 +2627,7 @@ module ts {
// Otherwise, we try to parse out the conditional expression bit. We want to allow any
// binary expression here, so we pass in the 'lowest' precedence here so that it matches
// and consumes anything.
let expr = parseBinaryExpressionOrHigher(/*precedence:*/ 0);
let expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
@@ -2675,12 +2689,6 @@ module ts {
return !scanner.hasPrecedingLineBreak() && isIdentifier()
}
function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() {
nextToken();
return !scanner.hasPrecedingLineBreak() &&
(isIdentifier() || token === SyntaxKind.OpenBraceToken || token === SyntaxKind.OpenBracketToken);
}
function parseYieldExpression(): YieldExpression {
let node = <YieldExpression>createNode(SyntaxKind.YieldExpression);
@@ -2735,7 +2743,7 @@ module ts {
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
// expression instead.
let arrowFunction = triState === Tristate.True
? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity:*/ true)
? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ true)
: tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead);
if (!arrowFunction) {
@@ -2746,7 +2754,7 @@ module ts {
// If we have an arrow, then try to parse the body. Even if not, try to parse if we
// have an opening brace, just in case we're in an error state.
var lastToken = token;
arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition:*/false, Diagnostics._0_expected, "=>");
arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition*/false, Diagnostics._0_expected, "=>");
arrowFunction.body = (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken)
? parseArrowFunctionExpressionBody()
: parseIdentifier();
@@ -2844,7 +2852,7 @@ module ts {
}
function parsePossibleParenthesizedArrowFunctionExpressionHead(): ArrowFunction {
return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity:*/ false);
return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false);
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity: boolean): ArrowFunction {
@@ -2856,7 +2864,7 @@ module ts {
// a => (b => c)
// And think that "(b =>" was actually a parenthesized arrow function with a missing
// close paren.
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ !allowAmbiguity, node);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ !allowAmbiguity, node);
// If we couldn't get parameters, we definitely could not parse out an arrow function.
if (!node.parameters) {
@@ -2881,14 +2889,14 @@ module ts {
function parseArrowFunctionExpressionBody(): Block | Expression {
if (token === SyntaxKind.OpenBraceToken) {
return parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ false);
return parseFunctionBlock(/*allowYield*/ false, /*ignoreMissingOpenBrace*/ false);
}
if (isStartOfStatement(/*inErrorRecovery:*/ true) &&
!isStartOfExpressionStatement() &&
if (token !== SyntaxKind.SemicolonToken &&
token !== SyntaxKind.FunctionKeyword &&
token !== SyntaxKind.ClassKeyword) {
token !== SyntaxKind.ClassKeyword &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
//
// Here we try to recover from a potential error situation in the case where the
@@ -2903,7 +2911,7 @@ module ts {
// up preemptively closing the containing construct.
//
// Note: even when 'ignoreMissingOpenBrace' is passed as true, parseBody will still error.
return parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ true);
return parseFunctionBlock(/*allowYield*/ false, /*ignoreMissingOpenBrace*/ true);
}
return parseAssignmentExpressionOrHigher();
@@ -2922,7 +2930,7 @@ module ts {
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition:*/ false,
node.colonToken = parseExpectedToken(SyntaxKind.ColonToken, /*reportAtCurrentPosition*/ false,
Diagnostics._0_expected, tokenToString(SyntaxKind.ColonToken));
node.whenFalse = parseAssignmentExpressionOrHigher();
return finishNode(node);
@@ -3186,8 +3194,8 @@ module ts {
// If it wasn't then just try to parse out a '.' and report an error.
let node = <PropertyAccessExpression>createNode(SyntaxKind.PropertyAccessExpression, expression.pos);
node.expression = expression;
node.dotToken = parseExpectedToken(SyntaxKind.DotToken, /*reportAtCurrentPosition:*/ false, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames:*/ true);
node.dotToken = parseExpectedToken(SyntaxKind.DotToken, /*reportAtCurrentPosition*/ false, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
return finishNode(node);
}
@@ -3207,7 +3215,7 @@ module ts {
let propertyAccess = <PropertyAccessExpression>createNode(SyntaxKind.PropertyAccessExpression, expression.pos);
propertyAccess.expression = expression;
propertyAccess.dotToken = dotToken;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames:*/ true);
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
continue;
}
@@ -3470,7 +3478,7 @@ module ts {
node.flags |= NodeFlags.MultiLine;
}
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimeter:*/ true);
node.properties = parseDelimitedList(ParsingContext.ObjectLiteralMembers, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true);
parseExpected(SyntaxKind.CloseBraceToken);
return finishNode(node);
}
@@ -3488,8 +3496,8 @@ module ts {
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!node.asteriskToken, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlock(/*allowYield:*/ !!node.asteriskToken, /* ignoreMissingOpenBrace */ false);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ !!node.asteriskToken, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlock(/*allowYield*/ !!node.asteriskToken, /* ignoreMissingOpenBrace */ false);
if (saveDecoratorContext) {
setDecoratorContext(true);
}
@@ -3599,7 +3607,7 @@ module ts {
let initializer: VariableDeclarationList | Expression = undefined;
if (token !== SyntaxKind.SemicolonToken) {
if (token === SyntaxKind.VarKeyword || token === SyntaxKind.LetKeyword || token === SyntaxKind.ConstKeyword) {
initializer = parseVariableDeclarationList(/*inForStatementInitializer:*/ true);
initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
}
else {
initializer = disallowInAnd(parseExpression);
@@ -3729,14 +3737,14 @@ module ts {
let node = <TryStatement>createNode(SyntaxKind.TryStatement);
parseExpected(SyntaxKind.TryKeyword);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode*/ false);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
node.catchClause = token === SyntaxKind.CatchKeyword ? parseCatchClause() : undefined;
// If we don't have a catch clause, then we must have a finally clause. Try to parse
// one out no matter what.
if (!node.catchClause || token === SyntaxKind.FinallyKeyword) {
parseExpected(SyntaxKind.FinallyKeyword);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode*/ false);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
}
return finishNode(node);
@@ -3750,7 +3758,7 @@ module ts {
}
parseExpected(SyntaxKind.CloseParenToken);
result.block = parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false);
result.block = parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
return finishNode(result);
}
@@ -3782,34 +3790,72 @@ module ts {
}
}
function isStartOfStatement(inErrorRecovery: boolean): boolean {
// Functions, variable statements and classes are allowed as a statement. But as per
// the grammar, they also allow modifiers. So we have to check for those statements
// that might be following modifiers.This ensures that things work properly when
// incrementally parsing as the parser will produce the same FunctionDeclaraiton,
// VariableStatement or ClassDeclaration, if it has the same text regardless of whether
// it is inside a block or not.
if (isModifier(token)) {
let result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
if (result) {
return true;
function isIdentifierOrKeyword() {
return token >= SyntaxKind.Identifier;
}
function nextTokenIsIdentifierOrKeywordOnSameLine() {
nextToken();
return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak();
}
function parseDeclarationFlags(): StatementFlags {
while (true) {
switch (token) {
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.FunctionKeyword:
case SyntaxKind.ClassKeyword:
case SyntaxKind.EnumKeyword:
return StatementFlags.Statement;
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.TypeKeyword:
nextToken();
return isIdentifierOrKeyword() ? StatementFlags.Statement : StatementFlags.None;
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
nextToken();
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral ? StatementFlags.ModuleElement : StatementFlags.None;
case SyntaxKind.ImportKeyword:
nextToken();
return token === SyntaxKind.StringLiteral || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || isIdentifierOrKeyword() ?
StatementFlags.ModuleElement : StatementFlags.None;
case SyntaxKind.ExportKeyword:
nextToken();
if (token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword) {
return StatementFlags.ModuleElement;
}
continue;
case SyntaxKind.DeclareKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
nextToken();
continue;
default:
return StatementFlags.None;
}
}
}
function getDeclarationFlags(): StatementFlags {
return lookAhead(parseDeclarationFlags);
}
function getStatementFlags(): StatementFlags {
switch (token) {
case SyntaxKind.AtToken:
case SyntaxKind.SemicolonToken:
// If we're in error recovery, then we don't want to treat ';' as an empty statement.
// The problem is that ';' can show up in far too many contexts, and if we see one
// and assume it's a statement, then we may bail out inappropriately from whatever
// we're parsing. For example, if we have a semicolon in the middle of a class, then
// we really don't want to assume the class is over and we're on a statement in the
// outer module. We just want to consume and move on.
return !inErrorRecovery;
case SyntaxKind.OpenBraceToken:
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.FunctionKeyword:
case SyntaxKind.ClassKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.IfKeyword:
case SyntaxKind.DoKeyword:
case SyntaxKind.WhileKeyword:
@@ -3826,62 +3872,84 @@ module ts {
// however, we say they are here so that we may gracefully parse them and error later.
case SyntaxKind.CatchKeyword:
case SyntaxKind.FinallyKeyword:
return true;
return StatementFlags.Statement;
case SyntaxKind.ConstKeyword:
// const keyword can precede enum keyword when defining constant enums
// 'const enum' do not start statement.
// In ES 6 'enum' is a future reserved keyword, so it should not be used as identifier
let isConstEnum = lookAhead(nextTokenIsEnumKeyword);
return !isConstEnum;
case SyntaxKind.ExportKeyword:
case SyntaxKind.ImportKeyword:
return getDeclarationFlags();
case SyntaxKind.DeclareKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.TypeKeyword:
// When followed by an identifier, these do not start a statement but might
// instead be following declarations
if (isDeclarationStart()) {
return false;
}
// When these don't start a declaration, they're an identifier in an expression statement
return getDeclarationFlags() || StatementFlags.Statement;
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
// When followed by an identifier or keyword, these do not start a statement but
// might instead be following type members
if (lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine)) {
return false;
}
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return getDeclarationFlags() ||
(lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? StatementFlags.None : StatementFlags.Statement);
default:
return isStartOfExpression();
return isStartOfExpression() ? StatementFlags.Statement : StatementFlags.None;
}
}
function nextTokenIsEnumKeyword() {
nextToken();
return token === SyntaxKind.EnumKeyword
function isStartOfStatement(): boolean {
return (getStatementFlags() & StatementFlags.Statement) !== 0;
}
function nextTokenIsIdentifierOrKeywordOnSameLine() {
function isStartOfModuleElement(): boolean {
return (getStatementFlags() & StatementFlags.StatementOrModuleElement) !== 0;
}
function nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine() {
nextToken();
return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak();
return !scanner.hasPrecedingLineBreak() &&
(isIdentifier() || token === SyntaxKind.OpenBraceToken || token === SyntaxKind.OpenBracketToken);
}
function isLetDeclaration() {
// It is let declaration if in strict mode or next token is identifier\open bracket\open curly on same line.
// otherwise it needs to be treated like identifier
return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine);
}
function parseStatement(): Statement {
return <Statement>parseModuleElementOfKind(StatementFlags.Statement);
}
function parseModuleElement(): ModuleElement {
return parseModuleElementOfKind(StatementFlags.StatementOrModuleElement);
}
function parseSourceElement(): ModuleElement {
return parseModuleElementOfKind(StatementFlags.StatementOrModuleElement);
}
function parseModuleElementOfKind(flags: StatementFlags): ModuleElement {
switch (token) {
case SyntaxKind.OpenBraceToken:
return parseBlock(/*ignoreMissingOpenBrace:*/ false, /*checkForStrictMode:*/ false);
case SyntaxKind.VarKeyword:
case SyntaxKind.ConstKeyword:
// const here should always be parsed as const declaration because of check in 'isStatement'
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.SemicolonToken:
return parseEmptyStatement();
case SyntaxKind.OpenBraceToken:
return parseBlock(/*ignoreMissingOpenBrace*/ false, /*checkForStrictMode*/ false);
case SyntaxKind.VarKeyword:
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
case SyntaxKind.LetKeyword:
if (isLetDeclaration()) {
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
}
break;
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined);
case SyntaxKind.IfKeyword:
return parseIfStatement();
case SyntaxKind.DoKeyword:
@@ -3909,61 +3977,69 @@ module ts {
return parseTryStatement();
case SyntaxKind.DebuggerKeyword:
return parseDebuggerStatement();
case SyntaxKind.LetKeyword:
// If let follows identifier on the same line, it is declaration parse it as variable statement
if (isLetDeclaration()) {
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
case SyntaxKind.AtToken:
return parseDeclaration();
case SyntaxKind.ConstKeyword:
case SyntaxKind.DeclareKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.ExportKeyword:
case SyntaxKind.ImportKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.StaticKeyword:
case SyntaxKind.TypeKeyword:
if (getDeclarationFlags() & flags) {
return parseDeclaration();
}
// Else parse it like identifier - fall through
default:
// Functions and variable statements are allowed as a statement. But as per
// the grammar, they also allow modifiers. So we have to check for those
// statements that might be following modifiers. This ensures that things
// work properly when incrementally parsing as the parser will produce the
// same FunctionDeclaraiton or VariableStatement if it has the same text
// regardless of whether it is inside a block or not.
// Even though variable statements and function declarations cannot have decorators,
// we parse them here to provide better error recovery.
if (isModifier(token) || token === SyntaxKind.AtToken) {
let result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
if (result) {
return result;
}
}
return parseExpressionOrLabeledStatement();
break;
}
return parseExpressionOrLabeledStatement();
}
function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement | ClassDeclaration {
let start = scanner.getStartPos();
function parseDeclaration(): ModuleElement {
let fullStart = getNodePos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
switch (token) {
case SyntaxKind.ConstKeyword:
let nextTokenIsEnum = lookAhead(nextTokenIsEnumKeyword)
if (nextTokenIsEnum) {
return undefined;
}
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.LetKeyword:
if (!isLetDeclaration()) {
return undefined;
}
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.VarKeyword:
return parseVariableStatement(start, decorators, modifiers);
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
return parseVariableStatement(fullStart, decorators, modifiers);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(start, decorators, modifiers);
return parseFunctionDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(start, decorators, modifiers);
return parseClassDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.InterfaceKeyword:
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.TypeKeyword:
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.EnumKeyword:
return parseEnumDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
return parseModuleDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ImportKeyword:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ExportKeyword:
nextToken();
return token === SyntaxKind.DefaultKeyword || token === SyntaxKind.EqualsToken ?
parseExportAssignment(fullStart, decorators, modifiers) :
parseExportDeclaration(fullStart, decorators, modifiers);
default:
if (decorators) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
let node = <ModuleElement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
setModifiers(node, modifiers);
return finishNode(node);
}
}
return undefined;
}
function parseFunctionBlockOrSemicolon(isGenerator: boolean, diagnosticMessage?: DiagnosticMessage): Block {
@@ -3972,7 +4048,7 @@ module ts {
return;
}
return parseFunctionBlock(isGenerator, /*ignoreMissingOpenBrace:*/ false, diagnosticMessage);
return parseFunctionBlock(isGenerator, /*ignoreMissingOpenBrace*/ false, diagnosticMessage);
}
// DECLARATIONS
@@ -4095,7 +4171,7 @@ module ts {
let node = <VariableStatement>createNode(SyntaxKind.VariableStatement, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false);
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
parseSemicolon();
return finishNode(node);
}
@@ -4107,7 +4183,7 @@ module ts {
parseExpected(SyntaxKind.FunctionKeyword);
node.asteriskToken = parseOptionalToken(SyntaxKind.AsteriskToken);
node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!node.asteriskToken, /*requireCompleteParameterList:*/ false, node);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ !!node.asteriskToken, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken, Diagnostics.or_expected);
return finishNode(node);
}
@@ -4117,8 +4193,8 @@ module ts {
node.decorators = decorators;
setModifiers(node, modifiers);
parseExpected(SyntaxKind.ConstructorKeyword);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false, Diagnostics.or_expected);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, Diagnostics.or_expected);
return finishNode(node);
}
@@ -4129,7 +4205,7 @@ module ts {
method.asteriskToken = asteriskToken;
method.name = name;
method.questionToken = questionToken;
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ !!asteriskToken, /*requireCompleteParameterList:*/ false, method);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ !!asteriskToken, /*requireCompleteParameterList*/ false, method);
method.body = parseFunctionBlockOrSemicolon(!!asteriskToken, diagnosticMessage);
return finishNode(method);
}
@@ -4141,7 +4217,20 @@ module ts {
property.name = name;
property.questionToken = questionToken;
property.type = parseTypeAnnotation();
property.initializer = allowInAnd(parseNonParameterInitializer);
// For instance properties specifically, since they are evaluated inside the constructor,
// we do *not * want to parse yield expressions, so we specifically turn the yield context
// off. The grammar would look something like this:
//
// MemberVariableDeclaration[Yield]:
// AccessibilityModifier_opt PropertyName TypeAnnotation_opt Initialiser_opt[In];
// AccessibilityModifier_opt static_opt PropertyName TypeAnnotation_opt Initialiser_opt[In, ?Yield];
//
// The checker may still error in the static case to explicitly disallow the yield expression.
property.initializer = modifiers && modifiers.flags & NodeFlags.Static
? allowInAnd(parseNonParameterInitializer)
: doOutsideOfContext(ParserContextFlags.Yield | ParserContextFlags.DisallowIn, parseNonParameterInitializer);
parseSemicolon();
return finishNode(property);
}
@@ -4170,8 +4259,8 @@ module ts {
node.decorators = decorators;
setModifiers(node, modifiers);
node.name = parsePropertyName();
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext:*/ false, /*requireCompleteParameterList:*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator:*/ false);
fillSignature(SyntaxKind.ColonToken, /*yieldAndGeneratorParameterContext*/ false, /*requireCompleteParameterList*/ false, node);
node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false);
return finishNode(node);
}
@@ -4350,9 +4439,9 @@ module ts {
function parseClassExpression(): ClassExpression {
return <ClassExpression>parseClassDeclarationOrExpression(
/*fullStart:*/ scanner.getStartPos(),
/*decorators:*/ undefined,
/*modifiers:*/ undefined,
/*fullStart*/ scanner.getStartPos(),
/*decorators*/ undefined,
/*modifiers*/ undefined,
SyntaxKind.ClassExpression);
}
@@ -4371,7 +4460,7 @@ module ts {
parseExpected(SyntaxKind.ClassKeyword);
node.name = parseOptionalIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause:*/ true);
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ true);
if (parseExpected(SyntaxKind.OpenBraceToken)) {
// ClassTail[Yield,GeneratorParameter] : See 14.5
@@ -4407,7 +4496,7 @@ module ts {
}
function parseHeritageClausesWorker() {
return parseList(ParsingContext.HeritageClauses, /*checkForStrictMode:*/ false, parseHeritageClause);
return parseList(ParsingContext.HeritageClauses, /*checkForStrictMode*/ false, parseHeritageClause);
}
function parseHeritageClause() {
@@ -4447,7 +4536,7 @@ module ts {
parseExpected(SyntaxKind.InterfaceKeyword);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause:*/ false);
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ false);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -4510,7 +4599,7 @@ module ts {
node.flags |= flags;
node.name = parseIdentifier();
node.body = parseOptional(SyntaxKind.DotToken)
? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers:*/undefined, NodeFlags.Export)
? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, NodeFlags.Export)
: parseModuleBlock();
return finishNode(node);
}
@@ -4519,7 +4608,7 @@ module ts {
let node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.name = parseLiteralNode(/*internName:*/ true);
node.name = parseLiteralNode(/*internName*/ true);
node.body = parseModuleBlock();
return finishNode(node);
}
@@ -4746,151 +4835,6 @@ module ts {
return finishNode(node);
}
function isLetDeclaration() {
// It is let declaration if in strict mode or next token is identifier\open bracket\open curly on same line.
// otherwise it needs to be treated like identifier
return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOrStartOfDestructuringOnTheSameLine);
}
function isDeclarationStart(followsModifier?: boolean): boolean {
switch (token) {
case SyntaxKind.VarKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.FunctionKeyword:
return true;
case SyntaxKind.LetKeyword:
return isLetDeclaration();
case SyntaxKind.ClassKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.TypeKeyword:
// Not true keywords so ensure an identifier follows
return lookAhead(nextTokenIsIdentifierOrKeyword);
case SyntaxKind.ImportKeyword:
// Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace
return lookAhead(nextTokenCanFollowImportKeyword);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
// Not a true keyword so ensure an identifier or string literal follows
return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral);
case SyntaxKind.ExportKeyword:
// Check for export assignment or modifier on source element
return lookAhead(nextTokenCanFollowExportKeyword);
case SyntaxKind.DeclareKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.StaticKeyword:
// Check for modifier on source element
return lookAhead(nextTokenIsDeclarationStart);
case SyntaxKind.AtToken:
// a lookahead here is too costly, and decorators are only valid on a declaration.
// We will assume we are parsing a declaration here and report an error later
return !followsModifier;
}
}
function isIdentifierOrKeyword() {
return token >= SyntaxKind.Identifier;
}
function nextTokenIsIdentifierOrKeyword() {
nextToken();
return isIdentifierOrKeyword();
}
function nextTokenIsIdentifierOrKeywordOrStringLiteral() {
nextToken();
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral;
}
function nextTokenCanFollowImportKeyword() {
nextToken();
return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral ||
token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken;
}
function nextTokenCanFollowExportKeyword() {
nextToken();
return token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword || isDeclarationStart(/*followsModifier*/ true);
}
function nextTokenIsDeclarationStart() {
nextToken();
return isDeclarationStart(/*followsModifier*/ true);
}
function nextTokenIsAsKeyword() {
return nextToken() === SyntaxKind.AsKeyword;
}
function parseDeclaration(): ModuleElement {
let fullStart = getNodePos();
let decorators = parseDecorators();
let modifiers = parseModifiers();
if (token === SyntaxKind.ExportKeyword) {
nextToken();
if (token === SyntaxKind.DefaultKeyword || token === SyntaxKind.EqualsToken) {
return parseExportAssignment(fullStart, decorators, modifiers);
}
if (token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken) {
return parseExportDeclaration(fullStart, decorators, modifiers);
}
}
switch (token) {
case SyntaxKind.VarKeyword:
case SyntaxKind.LetKeyword:
case SyntaxKind.ConstKeyword:
return parseVariableStatement(fullStart, decorators, modifiers);
case SyntaxKind.FunctionKeyword:
return parseFunctionDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ClassKeyword:
return parseClassDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.InterfaceKeyword:
return parseInterfaceDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.TypeKeyword:
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.EnumKeyword:
return parseEnumDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
return parseModuleDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ImportKeyword:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
default:
if (decorators) {
// We reached this point because we encountered an AtToken and assumed a declaration would
// follow. For recovery and error reporting purposes, return an incomplete declaration.
let node = <ModuleElement>createMissingNode(SyntaxKind.MissingDeclaration, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected);
node.pos = fullStart;
node.decorators = decorators;
setModifiers(node, modifiers);
return finishNode(node);
}
Debug.fail("Mismatch between isDeclarationStart and parseDeclaration");
}
}
function isSourceElement(inErrorRecovery: boolean): boolean {
return isDeclarationStart() || isStartOfStatement(inErrorRecovery);
}
function parseSourceElement() {
return parseSourceElementOrModuleElement();
}
function parseModuleElement() {
return parseSourceElementOrModuleElement();
}
function parseSourceElementOrModuleElement(): ModuleElement {
return isDeclarationStart()
? parseDeclaration()
: parseStatement();
}
function processReferenceComments(sourceFile: SourceFile): void {
let triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText);
let referencedFiles: FileReference[] = [];
@@ -5890,7 +5834,7 @@ module ts {
if (child.pos > changeRangeOldEnd) {
// Node is entirely past the change range. We need to move both its pos and
// end, forward or backward appropriately.
moveElementEntirelyPastChangeRange(child, /*isArray:*/ false, delta, oldText, newText, aggressiveChecks);
moveElementEntirelyPastChangeRange(child, /*isArray*/ false, delta, oldText, newText, aggressiveChecks);
return;
}
@@ -5919,7 +5863,7 @@ module ts {
if (array.pos > changeRangeOldEnd) {
// Array is entirely after the change range. We need to move it, and move any of
// its children.
moveElementEntirelyPastChangeRange(array, /*isArray:*/ true, delta, oldText, newText, aggressiveChecks);
moveElementEntirelyPastChangeRange(array, /*isArray*/ true, delta, oldText, newText, aggressiveChecks);
return;
}
+14 -9
View File
@@ -8,7 +8,7 @@ module ts {
/* @internal */ export let ioWriteTime = 0;
/** The version of the TypeScript compiler release */
export const version = "1.5.2";
export const version = "1.5.3";
const carriageReturnLineFeed = "\r\n";
const lineFeed = "\n";
@@ -534,21 +534,21 @@ module ts {
}
function verifyCompilerOptions() {
if (options.separateCompilation) {
if (options.isolatedModules) {
if (options.sourceMap) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_isolatedModules));
}
if (options.declaration) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules));
}
if (options.noEmitOnError) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules));
}
if (options.out) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules));
}
}
@@ -585,15 +585,15 @@ module ts {
let languageVersion = options.target || ScriptTarget.ES3;
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
if (options.separateCompilation) {
if (options.isolatedModules) {
if (!options.module && languageVersion < ScriptTarget.ES6) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
}
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
if (firstNonExternalModuleSourceFile) {
let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided));
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
@@ -640,6 +640,11 @@ module ts {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration));
}
}
if (options.emitDecoratorMetadata &&
!options.experimentalDecorators) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified));
}
}
}
}
+1 -1
View File
@@ -231,7 +231,7 @@ module ts {
var directories: string[] = [];
for (let current of files) {
var name = combinePaths(path, current);
var stat = _fs.lstatSync(name);
var stat = _fs.statSync(name);
if (stat.isFile()) {
if (!extension || fileExtensionIs(name, extension)) {
result.push(name);
+15 -5
View File
@@ -693,7 +693,7 @@ module ts {
export interface YieldExpression extends Expression {
asteriskToken?: Node;
expression: Expression;
expression?: Expression;
}
export interface BinaryExpression extends Expression {
@@ -917,7 +917,7 @@ module ts {
_classElementBrand: any;
}
export interface InterfaceDeclaration extends Declaration, ModuleElement {
export interface InterfaceDeclaration extends Declaration, Statement {
name: Identifier;
typeParameters?: NodeArray<TypeParameterDeclaration>;
heritageClauses?: NodeArray<HeritageClause>;
@@ -929,7 +929,7 @@ module ts {
types?: NodeArray<ExpressionWithTypeArguments>;
}
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
export interface TypeAliasDeclaration extends Declaration, Statement {
name: Identifier;
type: TypeNode;
}
@@ -941,7 +941,7 @@ module ts {
initializer?: Expression;
}
export interface EnumDeclaration extends Declaration, ModuleElement {
export interface EnumDeclaration extends Declaration, Statement {
name: Identifier;
members: NodeArray<EnumMember>;
}
@@ -1626,6 +1626,8 @@ module ts {
// Class and interface types (TypeFlags.Class and TypeFlags.Interface)
export interface InterfaceType extends ObjectType {
typeParameters: TypeParameter[]; // Type parameters (undefined if non-generic)
outerTypeParameters: TypeParameter[]; // Outer type parameters (undefined if none)
localTypeParameters: TypeParameter[]; // Local type parameters (undefined if none)
}
export interface InterfaceTypeWithBaseTypes extends InterfaceType {
@@ -1676,6 +1678,13 @@ module ts {
numberIndexType: Type; // Numeric index type
}
// Just a place to cache element types of iterables and iterators
/* @internal */
export interface IterableOrIteratorType extends ObjectType, UnionType {
iterableElementType?: Type;
iteratorElementType?: Type;
}
// Type parameters (TypeFlags.TypeParameter)
export interface TypeParameter extends Type {
constraint: Type; // Constraint
@@ -1810,7 +1819,8 @@ module ts {
target?: ScriptTarget;
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
isolatedModules?: boolean;
experimentalDecorators?: boolean;
emitDecoratorMetadata?: boolean;
/* @internal */ stripInternal?: boolean;
[option: string]: string | number | boolean;
+129 -1
View File
@@ -408,6 +408,93 @@ module ts {
export let fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/
export function isTypeNode(node: Node): boolean {
if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) {
return true;
}
switch (node.kind) {
case SyntaxKind.AnyKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.SymbolKeyword:
return true;
case SyntaxKind.VoidKeyword:
return node.parent.kind !== SyntaxKind.VoidExpression;
case SyntaxKind.StringLiteral:
// Specialized signatures can have string literals as their parameters' type names
return node.parent.kind === SyntaxKind.Parameter;
case SyntaxKind.ExpressionWithTypeArguments:
return true;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
case SyntaxKind.Identifier:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
if (node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node) {
node = node.parent;
}
else if (node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node) {
node = node.parent;
}
// fall through
case SyntaxKind.QualifiedName:
case SyntaxKind.PropertyAccessExpression:
// At this point, node is either a qualified name or an identifier
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression,
"'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'.");
let parent = node.parent;
if (parent.kind === SyntaxKind.TypeQuery) {
return false;
}
// Do not recursively call isTypeNode on the parent. In the example:
//
// let a: A.B.C;
//
// Calling isTypeNode would consider the qualified name A.B a type node. Only C or
// A.B.C is a type node.
if (SyntaxKind.FirstTypeNode <= parent.kind && parent.kind <= SyntaxKind.LastTypeNode) {
return true;
}
switch (parent.kind) {
case SyntaxKind.ExpressionWithTypeArguments:
return true;
case SyntaxKind.TypeParameter:
return node === (<TypeParameterDeclaration>parent).constraint;
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.PropertySignature:
case SyntaxKind.Parameter:
case SyntaxKind.VariableDeclaration:
return node === (<VariableLikeDeclaration>parent).type;
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.Constructor:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.MethodSignature:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return node === (<FunctionLikeDeclaration>parent).type;
case SyntaxKind.CallSignature:
case SyntaxKind.ConstructSignature:
case SyntaxKind.IndexSignature:
return node === (<SignatureDeclaration>parent).type;
case SyntaxKind.TypeAssertionExpression:
return node === (<TypeAssertion>parent).type;
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
return (<CallExpression>parent).typeArguments && indexOf((<CallExpression>parent).typeArguments, node) >= 0;
case SyntaxKind.TaggedTemplateExpression:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
}
return false;
}
// Warning: This has the same semantics as the forEach family of functions,
// in that traversal terminates in the event that 'visitor' supplies a truthy value.
export function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T {
@@ -438,6 +525,46 @@ module ts {
}
}
export function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void {
return traverse(body);
function traverse(node: Node): void {
switch (node.kind) {
case SyntaxKind.YieldExpression:
visitor(<YieldExpression>node);
let operand = (<YieldExpression>node).expression;
if (operand) {
traverse(operand);
}
case SyntaxKind.EnumDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.TypeAliasDeclaration:
case SyntaxKind.ClassDeclaration:
// 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
// skipped in this traversal.
return;
default:
if (isFunctionLike(node)) {
let name = (<FunctionLikeDeclaration>node).name;
if (name && name.kind === SyntaxKind.ComputedPropertyName) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse((<ComputedPropertyName>name).expression);
return;
}
}
else if (!isTypeNode(node)) {
// This is the general case, which should include mostly expressions and statements.
// Also includes NodeArrays.
forEachChild(node, traverse);
}
}
}
}
export function isVariableLike(node: Node): boolean {
if (node) {
switch (node.kind) {
@@ -739,6 +866,7 @@ module ts {
case SyntaxKind.TemplateExpression:
case SyntaxKind.NoSubstitutionTemplateLiteral:
case SyntaxKind.OmittedExpression:
case SyntaxKind.YieldExpression:
return true;
case SyntaxKind.QualifiedName:
while (node.parent.kind === SyntaxKind.QualifiedName) {
@@ -1525,7 +1653,7 @@ module ts {
if ((isExternalModule(sourceFile) || !compilerOptions.out)) {
// 1. in-browser single file compilation scenario
// 2. non .js file
return compilerOptions.separateCompilation || !fileExtensionIs(sourceFile.fileName, ".js");
return compilerOptions.isolatedModules || !fileExtensionIs(sourceFile.fileName, ".js");
}
return false;
}
+9
View File
@@ -798,8 +798,17 @@ module FourSlash {
return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
}
public getSyntacticDiagnostics(expected: string) {
var diagnostics = this.languageService.getSyntacticDiagnostics(this.activeFile.fileName);
this.testDiagnostics(expected, diagnostics);
}
public getSemanticDiagnostics(expected: string) {
var diagnostics = this.languageService.getSemanticDiagnostics(this.activeFile.fileName);
this.testDiagnostics(expected, diagnostics);
}
private testDiagnostics(expected: string, diagnostics: ts.Diagnostic[]) {
var realized = ts.realizeDiagnostics(diagnostics, "\r\n");
var actual = JSON.stringify(realized, null, " ");
assert.equal(actual, expected);
+8 -4
View File
@@ -1011,6 +1011,10 @@ module Harness {
options.target = <any>setting.value;
}
break;
case 'experimentaldecorators':
options.experimentalDecorators = setting.value === 'true';
break;
case 'emitdecoratormetadata':
options.emitDecoratorMetadata = setting.value === 'true';
@@ -1105,8 +1109,8 @@ module Harness {
options.preserveConstEnums = setting.value === 'true';
break;
case 'separatecompilation':
options.separateCompilation = setting.value === 'true';
case 'isolatedmodules':
options.isolatedModules = setting.value === 'true';
break;
case 'suppressimplicitanyindexerrors':
@@ -1522,8 +1526,8 @@ module Harness {
"noimplicitany", "noresolve", "newline", "normalizenewline", "emitbom",
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
"separatecompilation", "inlinesourcemap", "maproot", "sourceroot",
"inlinesources", "emitdecoratormetadata"];
"isolatedmodules", "inlinesourcemap", "maproot", "sourceroot",
"inlinesources", "emitdecoratormetadata", "experimentaldecorators"];
function extractCompilerSettings(content: string): CompilerSetting[] {
+5 -8
View File
@@ -316,6 +316,11 @@ interface Array<T> {
copyWithin(target: number, start: number, end?: number): T[];
}
interface IArguments {
/** Iterator */
[Symbol.iterator](): IterableIterator<any>;
}
interface ArrayConstructor {
/**
* Creates an array from an array-like object.
@@ -500,14 +505,6 @@ interface GeneratorFunctionConstructor {
}
declare var GeneratorFunction: GeneratorFunctionConstructor;
interface Generator<T> extends IterableIterator<T> {
next(value?: any): IteratorResult<T>;
throw(exception: any): IteratorResult<T>;
return(value: T): IteratorResult<T>;
[Symbol.iterator](): Generator<T>;
[Symbol.toStringTag]: string;
}
interface Math {
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
+22 -1
View File
@@ -193,12 +193,18 @@ module ts.formatting {
// Insert space after function keyword for anonymous functions
public SpaceAfterAnonymousFunctionKeyword: Rule;
public NoSpaceAfterAnonymousFunctionKeyword: Rule;
// Insert space after @ in decorator
public SpaceBeforeAt: Rule;
public NoSpaceAfterAt: Rule;
public SpaceAfterDecorator: Rule;
// Generator: function*
public NoSpaceBetweenFunctionKeywordAndStar: Rule;
public SpaceAfterStarInGeneratorDeclaration: Rule;
public NoSpaceBetweenYieldKeywordAndStar: Rule;
public SpaceBetweenYieldOrYieldStarAndOperand: Rule;
constructor() {
///
/// Common Rules
@@ -340,6 +346,11 @@ module ts.formatting {
this.NoSpaceAfterAt = new Rule(RuleDescriptor.create3(SyntaxKind.AtToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
this.SpaceAfterDecorator = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.ExportKeyword, SyntaxKind.DefaultKeyword, SyntaxKind.ClassKeyword, SyntaxKind.StaticKeyword, SyntaxKind.PublicKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.GetKeyword, SyntaxKind.SetKeyword, SyntaxKind.OpenBracketToken, SyntaxKind.AsteriskToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), RuleAction.Space));
this.NoSpaceBetweenFunctionKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Delete));
this.SpaceAfterStarInGeneratorDeclaration = new Rule(RuleDescriptor.create3(SyntaxKind.AsteriskToken, Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), RuleAction.Space));
this.NoSpaceBetweenYieldKeywordAndStar = new Rule(RuleDescriptor.create1(SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Delete));
this.SpaceBetweenYieldOrYieldStarAndOperand = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.YieldKeyword, SyntaxKind.AsteriskToken]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), RuleAction.Space));
// These rules are higher in priority than user-configurable rules.
this.HighPriorityCommonRules =
[
@@ -357,7 +368,9 @@ module ts.formatting {
this.NoSpaceAfterCloseBrace,
this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext,
this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,
this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,
this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,
this.NoSpaceBetweenYieldKeywordAndStar, this.SpaceBetweenYieldOrYieldStarAndOperand,
this.NoSpaceBetweenReturnAndSemicolon,
this.SpaceAfterCertainKeywords,
this.SpaceAfterLetConstInVariableDeclaration,
@@ -574,6 +587,10 @@ module ts.formatting {
return false;
}
static IsFunctionDeclarationOrFunctionExpressionContext(context: FormattingContext): boolean {
return context.contextNode.kind === SyntaxKind.FunctionDeclaration || context.contextNode.kind === SyntaxKind.FunctionExpression;
}
static IsTypeScriptDeclWithBlockContext(context: FormattingContext): boolean {
return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode);
}
@@ -717,5 +734,9 @@ module ts.formatting {
static IsVoidOpContext(context: FormattingContext): boolean {
return context.currentTokenSpan.kind === SyntaxKind.VoidKeyword && context.currentTokenParent.kind === SyntaxKind.VoidExpression;
}
static IsYieldOrYieldStarWithOperand(context: FormattingContext): boolean {
return context.contextNode.kind === SyntaxKind.YieldExpression && (<YieldExpression>context.contextNode).expression !== undefined;
}
}
}
+7 -2
View File
@@ -1763,13 +1763,13 @@ module ts {
* This function will compile source text from 'input' argument using specified compiler options.
* If not options are provided - it will use a set of default compiler options.
* Extra compiler options that will unconditionally be used bu this function are:
* - separateCompilation = true
* - isolatedModules = true
* - allowNonTsExtensions = true
*/
export function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string {
let options = compilerOptions ? clone(compilerOptions) : getDefaultCompilerOptions();
options.separateCompilation = true;
options.isolatedModules = true;
// Filename can be non-ts file.
options.allowNonTsExtensions = true;
@@ -2478,6 +2478,10 @@ module ts {
}
}
// hostCache is captured in the closure for 'getOrCreateSourceFile' but it should not be used past this point.
// It needs to be cleared to allow all collected snapshots to be released
hostCache = undefined;
program = newProgram;
// Make sure all the nodes in the program are both bound, and have their parent
@@ -2486,6 +2490,7 @@ module ts {
return;
function getOrCreateSourceFile(fileName: string): SourceFile {
Debug.assert(hostCache !== undefined);
// The program is asking for this file, check first if the host can locate it.
// If the host can not locate the file, then it does not exist. return undefined
// to the program to allow reporting of errors for missing files.
+1 -1
View File
@@ -989,4 +989,4 @@ module TypeScript.Services {
}
/* @internal */
let toolsVersion = "1.4";
let toolsVersion = "1.5";
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
function * foo(a = yield => yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration11_es6.ts (1 errors) ====
function * yield() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,11 +1,11 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration13_es6.ts (2 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
// Legal to use 'yield' in a type context.
var v: yield;
~~~~~
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration1_es6.ts (1 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,11 +1,11 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
function*foo(a = yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
@@ -1,16 +1,16 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (3 errors) ====
function*bar() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
// 'yield' here is an identifier, and not a yield expression.
function*foo(a = yield) {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (1 errors) ====
function * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
var v = { [yield]: foo }
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts(1,18): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression1_es6.ts (1 errors) ====
var v = function * () { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts(1,18): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionExpressions/FunctionExpression2_es6.ts (1 errors) ====
var v = function * foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments1_es6.ts (1 errors) ====
var v = { *foo() { } }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,10 +1,10 @@
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ====
var v = { *[foo()]() { } }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
~~~
!!! error TS2304: Cannot find name 'foo'.
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration1_es6.ts (1 errors) ====
class C {
*foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts(2,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration2_es6.ts (1 errors) ====
class C {
public * foo() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts(2,6): error TS2304: Cannot find name 'foo'.
@@ -6,7 +6,7 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration
class C {
*[foo]() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts(2,4): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration7_es6.ts (1 errors) ====
class C {
*foo<T>() { }
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
}
@@ -1,14 +1,14 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(2,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(1,11): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts(2,11): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression10_es6.ts (2 errors) ====
var v = { * foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
}
@@ -1,14 +1,14 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,5): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ====
class C {
*foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts (1 errors) ====
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): erro
constructor() {
yield foo
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
}
@@ -1,10 +1,7 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,19): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression13_es6.ts (1 errors) ====
function* foo() { yield }
~
!!! error TS9001: Generators are not currently supported.
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts (1 errors) ====
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): erro
foo() {
yield foo
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
}
@@ -1,9 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts (1 errors) ====
var v = () => {
yield foo
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
@@ -1,14 +1,14 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (2 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
function bar() {
yield foo;
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
}
}
@@ -1,6 +1,6 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts (3 errors) ====
@@ -10,4 +10,4 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): err
~~~
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
@@ -1,8 +1,8 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts (1 errors) ====
"use strict";
yield(foo);
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
@@ -1,19 +1,16 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(4,7): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts(3,13): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression19_es6.ts (2 errors) ====
function*foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
function bar() {
function* quux() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
}
}
@@ -1,7 +1,7 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: A 'yield' expression is only allowed in a generator body.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts (1 errors) ====
yield foo;
~~~~~
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
@@ -1,16 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression3_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
yield
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,16 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression4_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
yield;
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,12 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts(2,9): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression6_es6.ts (2 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield*foo
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
}
@@ -1,12 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts(1,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (2 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression7_es6.ts (1 errors) ====
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield foo
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,16 +1,13 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(3,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts(2,9): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (3 errors) ====
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression8_es6.ts (2 errors) ====
yield(foo);
~~~~~
!!! error TS2304: Cannot find name 'yield'.
function* foo() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
}
@@ -1,12 +1,12 @@
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS9001: Generators are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(2,3): error TS9000: 'yield' expressions are not currently supported.
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(1,17): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts(2,9): error TS2304: Cannot find name 'foo'.
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression9_es6.ts (2 errors) ====
var v = function*() {
~
!!! error TS9001: Generators are not currently supported.
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield(foo);
~~~~~
!!! error TS9000: 'yield' expressions are not currently supported.
~~~
!!! error TS2304: Cannot find name 'foo'.
}
@@ -0,0 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts(1,9): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression1_es6.ts (2 errors) ====
yield * [];
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~~
!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
@@ -0,0 +1,5 @@
//// [YieldStarExpression1_es6.ts]
yield * [];
//// [YieldStarExpression1_es6.js]
yield * [];
@@ -0,0 +1,10 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression2_es6.ts(1,1): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression2_es6.ts(1,8): error TS1109: Expression expected.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression2_es6.ts (2 errors) ====
yield *;
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~
!!! error TS1109: Expression expected.
@@ -0,0 +1,5 @@
//// [YieldStarExpression2_es6.ts]
yield *;
//// [YieldStarExpression2_es6.js]
yield * ;
@@ -0,0 +1,9 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression3_es6.ts(2,12): error TS1109: Expression expected.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression3_es6.ts (1 errors) ====
function *g() {
yield *;
~
!!! error TS1109: Expression expected.
}
@@ -0,0 +1,9 @@
//// [YieldStarExpression3_es6.ts]
function *g() {
yield *;
}
//// [YieldStarExpression3_es6.js]
function g() {
yield* ;
}
@@ -0,0 +1,12 @@
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(1,10): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts(2,13): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
==== tests/cases/conformance/es6/yieldExpressions/YieldStarExpression4_es6.ts (2 errors) ====
function *g() {
~
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
yield * [];
~~
!!! error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
}
@@ -0,0 +1,9 @@
//// [YieldStarExpression4_es6.ts]
function *g() {
yield * [];
}
//// [YieldStarExpression4_es6.js]
function g() {
yield* [];
}
@@ -0,0 +1,14 @@
tests/cases/compiler/argumentsObjectIterator01_ES5.ts(4,21): error TS2495: Type 'IArguments' is not an array type or a string type.
==== tests/cases/compiler/argumentsObjectIterator01_ES5.ts (1 errors) ====
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
let result = [];
for (let arg of arguments) {
~~~~~~~~~
!!! error TS2495: Type 'IArguments' is not an array type or a string type.
result.push(arg + arg);
}
return <[any, any, any]>result;
}
@@ -0,0 +1,19 @@
//// [argumentsObjectIterator01_ES5.ts]
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
let result = [];
for (let arg of arguments) {
result.push(arg + arg);
}
return <[any, any, any]>result;
}
//// [argumentsObjectIterator01_ES5.js]
function doubleAndReturnAsArray(x, y, z) {
var result = [];
for (var _i = 0; _i < arguments.length; _i++) {
var arg = arguments[_i];
result.push(arg + arg);
}
return result;
}
@@ -0,0 +1,18 @@
//// [argumentsObjectIterator01_ES6.ts]
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
let result = [];
for (let arg of arguments) {
result.push(arg + arg);
}
return <[any, any, any]>result;
}
//// [argumentsObjectIterator01_ES6.js]
function doubleAndReturnAsArray(x, y, z) {
let result = [];
for (let arg of arguments) {
result.push(arg + arg);
}
return result;
}
@@ -0,0 +1,25 @@
=== tests/cases/compiler/argumentsObjectIterator01_ES6.ts ===
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
>doubleAndReturnAsArray : Symbol(doubleAndReturnAsArray, Decl(argumentsObjectIterator01_ES6.ts, 0, 0))
>x : Symbol(x, Decl(argumentsObjectIterator01_ES6.ts, 1, 32))
>y : Symbol(y, Decl(argumentsObjectIterator01_ES6.ts, 1, 42))
>z : Symbol(z, Decl(argumentsObjectIterator01_ES6.ts, 1, 53))
let result = [];
>result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 2, 7))
for (let arg of arguments) {
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12))
>arguments : Symbol(arguments)
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 2, 7))
>push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 3, 12))
}
return <[any, any, any]>result;
>result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 2, 7))
}
@@ -0,0 +1,29 @@
=== tests/cases/compiler/argumentsObjectIterator01_ES6.ts ===
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
>doubleAndReturnAsArray : (x: number, y: number, z: number) => [number, number, number]
>x : number
>y : number
>z : number
let result = [];
>result : any[]
>[] : undefined[]
for (let arg of arguments) {
>arg : any
>arguments : IArguments
result.push(arg + arg);
>result.push(arg + arg) : number
>result.push : (...items: any[]) => number
>result : any[]
>push : (...items: any[]) => number
>arg + arg : any
>arg : any
>arg : any
}
return <[any, any, any]>result;
><[any, any, any]>result : [any, any, any]
>result : any[]
}
@@ -0,0 +1,18 @@
tests/cases/compiler/argumentsObjectIterator02_ES5.ts(3,26): error TS2304: Cannot find name 'Symbol'.
==== tests/cases/compiler/argumentsObjectIterator02_ES5.ts (1 errors) ====
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
let blah = arguments[Symbol.iterator];
~~~~~~
!!! error TS2304: Cannot find name 'Symbol'.
let result = [];
for (let arg of blah()) {
result.push(arg + arg);
}
return <[any, any, any]>result;
}
@@ -0,0 +1,24 @@
//// [argumentsObjectIterator02_ES5.ts]
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
let blah = arguments[Symbol.iterator];
let result = [];
for (let arg of blah()) {
result.push(arg + arg);
}
return <[any, any, any]>result;
}
//// [argumentsObjectIterator02_ES5.js]
function doubleAndReturnAsArray(x, y, z) {
var blah = arguments[Symbol.iterator];
var result = [];
for (var _i = 0, _a = blah(); _i < _a.length; _i++) {
var arg = _a[_i];
result.push(arg + arg);
}
return result;
}
@@ -0,0 +1,23 @@
//// [argumentsObjectIterator02_ES6.ts]
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
let blah = arguments[Symbol.iterator];
let result = [];
for (let arg of blah()) {
result.push(arg + arg);
}
return <[any, any, any]>result;
}
//// [argumentsObjectIterator02_ES6.js]
function doubleAndReturnAsArray(x, y, z) {
let blah = arguments[Symbol.iterator];
let result = [];
for (let arg of blah()) {
result.push(arg + arg);
}
return result;
}
@@ -0,0 +1,34 @@
=== tests/cases/compiler/argumentsObjectIterator02_ES6.ts ===
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
>doubleAndReturnAsArray : Symbol(doubleAndReturnAsArray, Decl(argumentsObjectIterator02_ES6.ts, 0, 0))
>x : Symbol(x, Decl(argumentsObjectIterator02_ES6.ts, 1, 32))
>y : Symbol(y, Decl(argumentsObjectIterator02_ES6.ts, 1, 42))
>z : Symbol(z, Decl(argumentsObjectIterator02_ES6.ts, 1, 53))
let blah = arguments[Symbol.iterator];
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7))
>arguments : Symbol(arguments)
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31))
let result = [];
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
for (let arg of blah()) {
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12))
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7))
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
>push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 5, 12))
}
return <[any, any, any]>result;
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7))
}
@@ -0,0 +1,40 @@
=== tests/cases/compiler/argumentsObjectIterator02_ES6.ts ===
function doubleAndReturnAsArray(x: number, y: number, z: number): [number, number, number] {
>doubleAndReturnAsArray : (x: number, y: number, z: number) => [number, number, number]
>x : number
>y : number
>z : number
let blah = arguments[Symbol.iterator];
>blah : () => IterableIterator<any>
>arguments[Symbol.iterator] : () => IterableIterator<any>
>arguments : IArguments
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
let result = [];
>result : any[]
>[] : undefined[]
for (let arg of blah()) {
>arg : any
>blah() : IterableIterator<any>
>blah : () => IterableIterator<any>
result.push(arg + arg);
>result.push(arg + arg) : number
>result.push : (...items: any[]) => number
>result : any[]
>push : (...items: any[]) => number
>arg + arg : any
>arg : any
>arg : any
}
return <[any, any, any]>result;
><[any, any, any]>result : [any, any, any]
>result : any[]
}
@@ -0,0 +1,14 @@
tests/cases/compiler/argumentsObjectIterator03_ES5.ts(3,9): error TS2461: Type 'IArguments' is not an array type.
==== tests/cases/compiler/argumentsObjectIterator03_ES5.ts (1 errors) ====
function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] {
let [x, y, z] = arguments;
~~~~~~~~~
!!! error TS2461: Type 'IArguments' is not an array type.
return [z, y, x];
}
@@ -0,0 +1,15 @@
//// [argumentsObjectIterator03_ES5.ts]
function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] {
let [x, y, z] = arguments;
return [z, y, x];
}
//// [argumentsObjectIterator03_ES5.js]
function asReversedTuple(a, b, c) {
var x = arguments[0], y = arguments[1], z = arguments[2];
return [z, y, x];
}
@@ -0,0 +1,15 @@
//// [argumentsObjectIterator03_ES6.ts]
function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] {
let [x, y, z] = arguments;
return [z, y, x];
}
//// [argumentsObjectIterator03_ES6.js]
function asReversedTuple(a, b, c) {
let [x, y, z] = arguments;
return [z, y, x];
}
@@ -0,0 +1,21 @@
=== tests/cases/compiler/argumentsObjectIterator03_ES6.ts ===
function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] {
>asReversedTuple : Symbol(asReversedTuple, Decl(argumentsObjectIterator03_ES6.ts, 0, 0))
>a : Symbol(a, Decl(argumentsObjectIterator03_ES6.ts, 1, 25))
>b : Symbol(b, Decl(argumentsObjectIterator03_ES6.ts, 1, 35))
>c : Symbol(c, Decl(argumentsObjectIterator03_ES6.ts, 1, 46))
let [x, y, z] = arguments;
>x : Symbol(x, Decl(argumentsObjectIterator03_ES6.ts, 2, 9))
>y : Symbol(y, Decl(argumentsObjectIterator03_ES6.ts, 2, 11))
>z : Symbol(z, Decl(argumentsObjectIterator03_ES6.ts, 2, 14))
>arguments : Symbol(arguments)
return [z, y, x];
>z : Symbol(z, Decl(argumentsObjectIterator03_ES6.ts, 2, 14))
>y : Symbol(y, Decl(argumentsObjectIterator03_ES6.ts, 2, 11))
>x : Symbol(x, Decl(argumentsObjectIterator03_ES6.ts, 2, 9))
}
@@ -0,0 +1,22 @@
=== tests/cases/compiler/argumentsObjectIterator03_ES6.ts ===
function asReversedTuple(a: number, b: string, c: boolean): [boolean, string, number] {
>asReversedTuple : (a: number, b: string, c: boolean) => [boolean, string, number]
>a : number
>b : string
>c : boolean
let [x, y, z] = arguments;
>x : any
>y : any
>z : any
>arguments : IArguments
return [z, y, x];
>[z, y, x] : [any, any, any]
>z : any
>y : any
>x : any
}
@@ -79,7 +79,7 @@ interface myArray2 extends Array<Number|String> { }
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))
@@ -1,13 +0,0 @@
tests/cases/compiler/classDeclarationBlockScoping1.ts(5,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/compiler/classDeclarationBlockScoping1.ts (1 errors) ====
class C {
}
{
class C {
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/classDeclarationBlockScoping1.ts ===
class C {
>C : Symbol(C, Decl(classDeclarationBlockScoping1.ts, 0, 0))
}
{
class C {
>C : Symbol(C, Decl(classDeclarationBlockScoping1.ts, 3, 1))
}
}
@@ -0,0 +1,10 @@
=== tests/cases/compiler/classDeclarationBlockScoping1.ts ===
class C {
>C : C
}
{
class C {
>C : C
}
}
@@ -1,18 +0,0 @@
tests/cases/compiler/classDeclarationBlockScoping2.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
tests/cases/compiler/classDeclarationBlockScoping2.ts(5,15): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/compiler/classDeclarationBlockScoping2.ts (2 errors) ====
function f() {
class C {}
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
var c1 = C;
{
class C {}
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
var c2 = C;
}
return C === c1;
}
@@ -0,0 +1,22 @@
=== tests/cases/compiler/classDeclarationBlockScoping2.ts ===
function f() {
>f : Symbol(f, Decl(classDeclarationBlockScoping2.ts, 0, 0))
class C {}
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 0, 14))
var c1 = C;
>c1 : Symbol(c1, Decl(classDeclarationBlockScoping2.ts, 2, 7))
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 0, 14))
{
class C {}
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 3, 5))
var c2 = C;
>c2 : Symbol(c2, Decl(classDeclarationBlockScoping2.ts, 5, 11))
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 3, 5))
}
return C === c1;
>C : Symbol(C, Decl(classDeclarationBlockScoping2.ts, 0, 14))
>c1 : Symbol(c1, Decl(classDeclarationBlockScoping2.ts, 2, 7))
}
@@ -0,0 +1,23 @@
=== tests/cases/compiler/classDeclarationBlockScoping2.ts ===
function f() {
>f : () => boolean
class C {}
>C : C
var c1 = C;
>c1 : typeof C
>C : typeof C
{
class C {}
>C : C
var c2 = C;
>c2 : typeof C
>C : typeof C
}
return C === c1;
>C === c1 : boolean
>C : typeof C
>c1 : typeof C
}
@@ -1,18 +0,0 @@
tests/cases/compiler/classExpressionTest1.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/compiler/classExpressionTest1.ts (1 errors) ====
function M() {
class C<X> {
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
f<T>() {
var t: T;
var x: X;
return { t, x };
}
}
var v = new C<number>();
return v.f<string>();
}
@@ -0,0 +1,35 @@
=== tests/cases/compiler/classExpressionTest1.ts ===
function M() {
>M : Symbol(M, Decl(classExpressionTest1.ts, 0, 0))
class C<X> {
>C : Symbol(C, Decl(classExpressionTest1.ts, 0, 14))
>X : Symbol(X, Decl(classExpressionTest1.ts, 1, 12))
f<T>() {
>f : Symbol(f, Decl(classExpressionTest1.ts, 1, 16))
>T : Symbol(T, Decl(classExpressionTest1.ts, 2, 10))
var t: T;
>t : Symbol(t, Decl(classExpressionTest1.ts, 3, 15))
>T : Symbol(T, Decl(classExpressionTest1.ts, 2, 10))
var x: X;
>x : Symbol(x, Decl(classExpressionTest1.ts, 4, 15))
>X : Symbol(X, Decl(classExpressionTest1.ts, 1, 12))
return { t, x };
>t : Symbol(t, Decl(classExpressionTest1.ts, 5, 20))
>x : Symbol(x, Decl(classExpressionTest1.ts, 5, 23))
}
}
var v = new C<number>();
>v : Symbol(v, Decl(classExpressionTest1.ts, 9, 7))
>C : Symbol(C, Decl(classExpressionTest1.ts, 0, 14))
return v.f<string>();
>v.f : Symbol(C.f, Decl(classExpressionTest1.ts, 1, 16))
>v : Symbol(v, Decl(classExpressionTest1.ts, 9, 7))
>f : Symbol(C.f, Decl(classExpressionTest1.ts, 1, 16))
}
@@ -0,0 +1,38 @@
=== tests/cases/compiler/classExpressionTest1.ts ===
function M() {
>M : () => { t: string; x: number; }
class C<X> {
>C : C<X>
>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 C<number>();
>v : C<number>
>new C<number>() : C<number>
>C : typeof C
return v.f<string>();
>v.f<string>() : { t: string; x: number; }
>v.f : <T>() => { t: T; x: number; }
>v : C<number>
>f : <T>() => { t: T; x: number; }
}
@@ -1,9 +0,0 @@
tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
==== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts (1 errors) ====
function foo() {
class C { }
~
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
}
@@ -0,0 +1,7 @@
=== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts ===
function foo() {
>foo : Symbol(foo, Decl(classInsideBlock.ts, 0, 0))
class C { }
>C : Symbol(C, Decl(classInsideBlock.ts, 0, 16))
}
@@ -0,0 +1,7 @@
=== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts ===
function foo() {
>foo : () => void
class C { }
>C : C
}
@@ -9,17 +9,17 @@
type arrayString = Array<String>
>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5.ts, 0, 0))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
type someArray = Array<String> | number[];
>someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5.ts, 7, 32))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
type stringOrNumArray = Array<String|Number>;
>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5.ts, 8, 42))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
function a1(...x: (number|string)[]) { }
@@ -34,7 +34,7 @@ function a3(...a: Array<String>) { }
>a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5.ts, 12, 21))
>a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 13, 12))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
function a4(...a: arrayString) { }
>a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5.ts, 13, 36))
@@ -9,17 +9,17 @@
type arrayString = Array<String>
>arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES6.ts, 0, 0))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
type someArray = Array<String> | number[];
>someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES6.ts, 7, 32))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
type stringOrNumArray = Array<String|Number>;
>stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES6.ts, 8, 42))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
function a1(...x: (number|string)[]) { }
@@ -34,7 +34,7 @@ function a3(...a: Array<String>) { }
>a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES6.ts, 12, 21))
>a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 13, 12))
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1543, 1))
function a4(...a: arrayString) { }
>a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES6.ts, 13, 36))

Some files were not shown because too many files have changed in this diff Show More