diff --git a/.gitignore b/.gitignore index 8e2c10d7b32..57e8804d7c3 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,4 @@ scripts/word2md.js scripts/ior.js scripts/*.js.map coverage/ +internal/ diff --git a/Jakefile b/Jakefile index 15661debff6..dc8070fd751 100644 --- a/Jakefile +++ b/Jakefile @@ -194,7 +194,7 @@ var compilerFilename = "tsc.js"; * @param keepComments: false to compile using --removeComments * @param callback: a function to execute after the compilation process ends */ -function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, callback) { +function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) { file(outFile, prereqs, function() { var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory; var options = "--module commonjs -noImplicitAny"; @@ -227,6 +227,10 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu options += " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile)); } + if (stripInternal) { + options += " --stripInternal" + } + var cmd = host + " " + dir + compilerFilename + " " + options + " "; cmd = cmd + sources.join(" "); console.log(cmd + "\n"); @@ -331,7 +335,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca /*outDir*/ undefined, /*preserveConstEnums*/ true, /*keepComments*/ false, - /*noResolve*/ false); + /*noResolve*/ false, + /*stripInternal*/ false); var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); @@ -347,6 +352,7 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright /*preserveConstEnums*/ true, /*keepComments*/ true, /*noResolve*/ true, + /*stripInternal*/ true, /*callback*/ function () { function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) { // Create the standalone definition file @@ -376,6 +382,10 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright desc("Builds the full compiler and services"); task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile]); +// Local target to build only tsc.js +desc("Builds only the compiler"); +task("tsc", ["generate-diagnostics", "lib", tscFile]); + // Local target to build the compiler and services desc("Sets release mode flag"); task("release", function() { @@ -451,14 +461,16 @@ directory(builtLocalDirectory); var run = path.join(builtLocalDirectory, "run.js"); compileFile(run, harnessSources, [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources), [], /*useBuiltCompiler:*/ true); +var internalTests = "internal/" + var localBaseline = "tests/baselines/local/"; var refBaseline = "tests/baselines/reference/"; -var localRwcBaseline = "tests/baselines/rwc/local/"; -var refRwcBaseline = "tests/baselines/rwc/reference/"; +var localRwcBaseline = path.join(internalTests, "baselines/rwc/local"); +var refRwcBaseline = path.join(internalTests, "baselines/rwc/reference"); -var localTest262Baseline = "tests/baselines/test262/local/"; -var refTest262Baseline = "tests/baselines/test262/reference/"; +var localTest262Baseline = path.join(internalTests, "baselines/test262/local"); +var refTest262Baseline = path.join(internalTests, "baselines/test262/reference"); desc("Builds the test infrastructure using the built compiler"); task("tests", ["local", run].concat(libraryTargets)); @@ -491,11 +503,13 @@ function cleanTestDirs() { jake.rmRf(localBaseline); } - // Clean the local Rwc baselines directory + // Clean the local Rwc baselines directory if (fs.existsSync(localRwcBaseline)) { jake.rmRf(localRwcBaseline); } + jake.mkdirP(localRwcBaseline); + jake.mkdirP(localTest262Baseline); jake.mkdirP(localBaseline); } @@ -507,8 +521,8 @@ function writeTestConfigFile(tests, testConfigFile) { } function deleteTemporaryProjectOutput() { - if (fs.existsSync(localBaseline + "projectOutput/")) { - jake.rmRf(localBaseline + "projectOutput/"); + if (fs.existsSync(path.join(localBaseline, "projectOutput/"))) { + jake.rmRf(path.join(localBaseline, "projectOutput/")); } } diff --git a/bin/tsc.js b/bin/tsc.js index 070f5356189..ab5386e2b40 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -182,6 +182,19 @@ var ts; return result; } ts.clone = clone; + function extend(first, second) { + var result = {}; + for (var id in first) { + result[id] = first[id]; + } + for (var id in second) { + if (!hasProperty(result, id)) { + result[id] = second[id]; + } + } + return result; + } + ts.extend = extend; function forEachValue(map, callback) { var result; for (var id in map) { @@ -503,7 +516,7 @@ var ts; return path2; if (!(path2 && path2.length)) return path1; - if (path2.charAt(0) === ts.directorySeparator) + if (getRootLength(path2) !== 0) return path2; if (path1.charAt(path1.length - 1) === ts.directorySeparator) return path1 + path2; @@ -666,6 +679,32 @@ var ts; fileStream.Close(); } } + function getNames(collection) { + var result = []; + for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { + result.push(e.item().Name); + } + return result.sort(); + } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var folder = fso.GetFolder(path || "."); + var files = getNames(folder.files); + for (var i = 0; i < files.length; i++) { + var name = files[i]; + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(ts.combinePaths(path, name)); + } + } + var subfolders = getNames(folder.subfolders); + for (var i = 0; i < subfolders.length; i++) { + visitDirectory(ts.combinePaths(path, subfolders[i])); + } + } + } return { args: args, newLine: "\r\n", @@ -695,6 +734,7 @@ var ts; getCurrentDirectory: function () { return new ActiveXObject("WScript.Shell").CurrentDirectory; }, + readDirectory: readDirectory, exit: function (exitCode) { try { WScript.Quit(exitCode); @@ -739,6 +779,30 @@ var ts; } _fs.writeFileSync(fileName, data, "utf8"); } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var files = _fs.readdirSync(path || ".").sort(); + var directories = []; + for (var i = 0; i < files.length; i++) { + var name = ts.combinePaths(path, files[i]); + var stat = _fs.lstatSync(name); + if (stat.isFile()) { + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(name); + } + } + else if (stat.isDirectory()) { + directories.push(name); + } + } + for (var i = 0; i < directories.length; i++) { + visitDirectory(directories[i]); + } + } + } return { args: process.argv.slice(2), newLine: _os.EOL, @@ -783,6 +847,7 @@ var ts; getCurrentDirectory: function () { return process.cwd(); }, + readDirectory: readDirectory, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -952,6 +1017,7 @@ var ts; Modifiers_cannot_appear_here: { code: 1184, category: 1 /* Error */, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: 1 /* Error */, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1 /* Error */, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1 /* Error */, key: "A parameter property may not be a binding pattern." }, Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* 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: 1 /* Error */, key: "Static members cannot reference class type parameters." }, @@ -1103,6 +1169,11 @@ var ts; Type_0_has_no_property_1: { code: 2460, category: 1 /* Error */, key: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: 1 /* Error */, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1 /* Error */, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1 /* Error */, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: 1 /* Error */, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1 /* Error */, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1 /* Error */, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: 1 /* Error */, key: "A computed property name cannot reference a type parameter from its containing type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1175,19 +1246,22 @@ var ts; Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: 1 /* Error */, key: "A const enum member can only be accessed using a string literal.", isEarly: true }, const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: 1 /* Error */, key: "Property '{0}' does not exist on 'const' enum '{1}'.", isEarly: true }, The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, Unsupported_file_encoding: { code: 5013, category: 1 /* Error */, key: "Unsupported file encoding." }, Unknown_compiler_option_0: { code: 5023, category: 1 /* Error */, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1 /* Error */, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: 1 /* Error */, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option mapRoot cannot be specified without specifying sourcemap option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option sourceRoot cannot be specified without specifying sourcemap option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1 /* Error */, key: "Option noEmit cannot be specified with option out or outDir." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1 /* Error */, key: "Option noEmit cannot be specified with option declaration." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1 /* Error */, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1 /* 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: 1 /* Error */, key: "Option 'project' cannot be mixed with source files on a command line." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2 /* Message */, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: 2 /* Message */, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2 /* Message */, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1202,6 +1276,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, Print_this_message: { code: 6017, category: 2 /* Message */, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: 2 /* Message */, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2 /* Message */, key: "Compile the project in the given directory." }, Syntax_Colon_0: { code: 6023, category: 2 /* Message */, key: "Syntax: {0}" }, options: { code: 6024, category: 2 /* Message */, key: "options" }, file: { code: 6025, category: 2 /* Message */, key: "file" }, @@ -1209,7 +1284,7 @@ var ts; Options_Colon: { code: 6027, category: 2 /* Message */, key: "Options:" }, Version_0: { code: 6029, category: 2 /* Message */, key: "Version {0}" }, Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2 /* Message */, key: "Insert command line options and files from a file." }, - File_change_detected_Compiling: { code: 6032, category: 2 /* Message */, key: "File change detected. Compiling..." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2 /* Message */, key: "File change detected. Starting incremental compilation..." }, KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, @@ -1225,7 +1300,7 @@ var ts; Unsupported_locale_0: { code: 6049, category: 1 /* Error */, key: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: 1 /* Error */, key: "Unable to open file '{0}'." }, Corrupted_locale_file_0: { code: 6051, category: 1 /* Error */, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Warn on expressions and declarations with an implied 'any' type." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: 1 /* Error */, key: "File '{0}' not found." }, File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1 /* Error */, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2 /* Message */, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, @@ -1247,8 +1322,7 @@ var ts; 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: 1 /* 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." }, You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." }, yield_expressions_are_not_currently_supported: { code: 9000, category: 1 /* Error */, key: "'yield' expressions are not currently supported.", isEarly: true }, - Generators_are_not_currently_supported: { code: 9001, category: 1 /* Error */, key: "Generators are not currently supported.", isEarly: true }, - Computed_property_names_are_not_currently_supported: { code: 9002, category: 1 /* Error */, key: "Computed property names are not currently supported.", isEarly: true } + Generators_are_not_currently_supported: { code: 9001, category: 1 /* Error */, key: "Generators are not currently supported.", isEarly: true } }; })(ts || (ts = {})); var ts; @@ -1388,10 +1462,10 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); + return languageVersion >= 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); + return languageVersion >= 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -1435,7 +1509,7 @@ var ts; } ts.computeLineStarts = computeLineStarts; function getPositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0); + ts.Debug.assert(line > 0 && line <= lineStarts.length); return lineStarts[line - 1] + character - 1; } ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; @@ -2099,7 +2173,7 @@ var ts; value = 0; } tokenValue = "" + value; - return 7 /* NumericLiteral */; + return token = 7 /* NumericLiteral */; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { pos += 2; @@ -2109,7 +2183,7 @@ var ts; value = 0; } tokenValue = "" + value; - return 7 /* NumericLiteral */; + return token = 7 /* NumericLiteral */; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); @@ -2667,6 +2741,12 @@ var ts; return undefined; } switch (node.kind) { + case 122 /* ComputedPropertyName */: + if (node.parent.parent.kind === 191 /* ClassDeclaration */) { + return node; + } + node = node.parent; + break; case 157 /* ArrowFunction */: if (!includeArrowFunctions) { continue; @@ -2688,13 +2768,24 @@ var ts; } } ts.getThisContainer = getThisContainer; - function getSuperContainer(node) { + function getSuperContainer(node, includeFunctions) { while (true) { node = node.parent; - if (!node) { - return undefined; - } + if (!node) + return node; switch (node.kind) { + case 122 /* ComputedPropertyName */: + if (node.parent.parent.kind === 191 /* ClassDeclaration */) { + return node; + } + node = node.parent; + break; + case 190 /* FunctionDeclaration */: + case 156 /* FunctionExpression */: + case 157 /* ArrowFunction */: + if (!includeFunctions) { + continue; + } case 126 /* PropertyDeclaration */: case 125 /* PropertySignature */: case 128 /* MethodDeclaration */: @@ -2787,6 +2878,8 @@ var ts; return node === parent.expression; case 169 /* TemplateSpan */: return node === parent.expression; + case 122 /* ComputedPropertyName */: + return node === parent.expression; default: if (isExpression(parent)) { return true; @@ -3971,7 +4064,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 /* OpenBracketToken */ || token === 35 /* AsteriskToken */ || isLiteralPropertyName(); + return token === 18 /* OpenBracketToken */ || token === 14 /* OpenBraceToken */ || token === 35 /* AsteriskToken */ || isLiteralPropertyName(); } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -6294,7 +6387,7 @@ var ts; var ts; (function (ts) { function getModuleInstanceState(node) { - if (node.kind === 192 /* InterfaceDeclaration */) { + if (node.kind === 192 /* InterfaceDeclaration */ || node.kind === 193 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { @@ -6327,10 +6420,10 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; - function hasComputedNameButNotSymbol(declaration) { + function hasDynamicName(declaration) { return declaration.name && declaration.name.kind === 122 /* ComputedPropertyName */; } - ts.hasComputedNameButNotSymbol = hasComputedNameButNotSymbol; + ts.hasDynamicName = hasDynamicName; function bindSourceFile(file) { var parent; var container; @@ -6366,7 +6459,7 @@ var ts; if (node.kind === 195 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { return '"' + node.name.text + '"'; } - ts.Debug.assert(!hasComputedNameButNotSymbol(node)); + ts.Debug.assert(!hasDynamicName(node)); return node.name.text; } switch (node.kind) { @@ -6386,9 +6479,7 @@ var ts; return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); } function declareSymbol(symbols, parent, node, includes, excludes) { - if (hasComputedNameButNotSymbol(node)) { - return undefined; - } + ts.Debug.assert(!hasDynamicName(node)); var name = getDeclarationName(node); if (name !== undefined) { var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); @@ -6607,14 +6698,14 @@ var ts; break; case 126 /* PropertyDeclaration */: case 125 /* PropertySignature */: - bindDeclaration(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0), 107455 /* PropertyExcludes */, false); + bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0), 107455 /* PropertyExcludes */, false); break; case 204 /* PropertyAssignment */: case 205 /* ShorthandPropertyAssignment */: - bindDeclaration(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); + bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); break; case 206 /* EnumMember */: - bindDeclaration(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); + bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); break; case 132 /* CallSignature */: case 133 /* ConstructSignature */: @@ -6623,7 +6714,7 @@ var ts; break; case 128 /* MethodDeclaration */: case 127 /* MethodSignature */: - bindDeclaration(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); + bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); break; case 190 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); @@ -6632,10 +6723,10 @@ var ts; bindDeclaration(node, 16384 /* Constructor */, 0, true); break; case 130 /* GetAccessor */: - bindDeclaration(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); + bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); break; case 131 /* SetAccessor */: - bindDeclaration(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); + bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); break; case 136 /* FunctionType */: case 137 /* ConstructorType */: @@ -6708,6 +6799,14 @@ var ts; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); } } + function bindPropertyOrMethodOrAccessor(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + if (hasDynamicName(node)) { + bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); + } + else { + bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer); + } + } } ts.bindSourceFile = bindSourceFile; })(ts || (ts = {})); @@ -6724,6 +6823,7 @@ var ts; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; var emitResolver = createResolver(); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, @@ -6769,8 +6869,8 @@ var ts; var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 131072 /* Unwidened */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 131072 /* Unwidened */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -6800,6 +6900,20 @@ var ts; var potentialThisCollisions = []; var diagnostics = []; var diagnosticsModified = false; + var primitiveTypeInfo = { + "string": { + type: stringType, + flags: 258 /* StringLike */ + }, + "number": { + type: numberType, + flags: 132 /* NumberLike */ + }, + "boolean": { + type: booleanType, + flags: 8 /* Boolean */ + } + }; function addDiagnostic(diagnostic) { diagnostics.push(diagnostic); diagnosticsModified = true; @@ -7016,6 +7130,15 @@ var ts; break loop; } break; + case 122 /* ComputedPropertyName */: + var grandparent = location.parent.parent; + if (grandparent.kind === 191 /* ClassDeclaration */ || grandparent.kind === 192 /* InterfaceDeclaration */) { + if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + return undefined; + } + } + break; case 128 /* MethodDeclaration */: case 127 /* MethodSignature */: case 129 /* Constructor */: @@ -8050,7 +8173,7 @@ var ts; } if (pattern.kind === 144 /* ObjectBindingPattern */) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericName(name.text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); + var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; @@ -8087,7 +8210,7 @@ var ts; } if (declaration.kind === 124 /* Parameter */) { var func = declaration.parent; - if (func.kind === 131 /* SetAccessor */ && !ts.hasComputedNameButNotSymbol(func)) { + if (func.kind === 131 /* SetAccessor */ && !ts.hasDynamicName(func)) { var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 130 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); @@ -8868,7 +8991,7 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 130 /* GetAccessor */ && !ts.hasComputedNameButNotSymbol(declaration)) { + if (declaration.kind === 130 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { var setter = ts.getDeclarationOfKind(declaration.symbol, 131 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } @@ -9030,14 +9153,18 @@ var ts; return result; } } - function getUnwidenedFlagOfTypes(types) { - return ts.forEach(types, function (t) { return t.flags & 131072 /* Unwidened */; }) || 0; + function getWideningFlagsOfTypes(types) { + var result = 0; + for (var i = 0; i < types.length; i++) { + result |= types[i].flags; + } + return result & 786432 /* RequiresWidening */; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | getUnwidenedFlagOfTypes(typeArguments); + var flags = 4096 /* Reference */ | getWideningFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -9254,7 +9381,7 @@ var ts; var id = getTypeListId(sortedTypes); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getUnwidenedFlagOfTypes(sortedTypes)); + type = unionTypes[id] = createObjectType(16384 /* Union */ | getWideningFlagsOfTypes(sortedTypes)); type.types = sortedTypes; } return type; @@ -9481,6 +9608,8 @@ var ts; case 128 /* MethodDeclaration */: case 127 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); + case 155 /* ParenthesizedExpression */: + return isContextSensitive(node.expression); } return false; } @@ -9541,6 +9670,10 @@ var ts; error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { + if (errorInfo.next === undefined) { + errorInfo = undefined; + isRelatedTo(source, target, errorNode !== undefined, headMessage, true); + } if (containingMessageChain) { errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } @@ -9550,7 +9683,8 @@ var ts; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } - function isRelatedTo(source, target, reportErrors, headMessage) { + function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } var result; if (source === target) return -1 /* True */; @@ -9619,7 +9753,7 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 /* ObjectType */ && target.flags & 48128 /* ObjectType */ && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { + if (sourceOrApparentType.flags & 48128 /* ObjectType */ && target.flags & 48128 /* ObjectType */ && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -9700,14 +9834,17 @@ var ts; return 0 /* False */; } } - function objectTypeRelatedTo(source, target, reportErrors) { + function objectTypeRelatedTo(source, target, reportErrors, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } if (overflow) { return 0 /* False */; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { - return related ? -1 /* True */ : 0 /* False */; + if (!elaborateErrors || (related === 3 /* FailedAndReported */)) { + return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; + } } if (depth > 0) { for (var i = 0; i < depth; i++) { @@ -9729,7 +9866,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; - maybeStack[depth][id] = true; + maybeStack[depth][id] = 1 /* Succeeded */; depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) @@ -9758,11 +9895,11 @@ var ts; depth--; if (result) { var maybeCache = maybeStack[depth]; - var destinationCache = result === -1 /* True */ || depth === 0 ? relation : maybeStack[depth - 1]; + var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { - relation[id] = false; + relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */; } return result; } @@ -9787,12 +9924,13 @@ var ts; } var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); + var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072 /* ObjectLiteral */); for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (relation === subtypeRelation || !(targetProp.flags & 536870912 /* Optional */)) { + if (!(targetProp.flags & 536870912 /* Optional */) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } @@ -10137,9 +10275,6 @@ var ts; } checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); } - function isTypeOfObjectLiteral(type) { - return (type.flags & 32768 /* Anonymous */) && type.symbol && (type.symbol.flags & 4096 /* ObjectLiteral */) ? true : false; - } function isArrayType(type) { return type.flags & 4096 /* Reference */ && type.target === globalArrayType; } @@ -10150,14 +10285,19 @@ var ts; var properties = getPropertiesOfObjectType(type); var members = {}; ts.forEach(properties, function (p) { - var symbol = createSymbol(p.flags | 67108864 /* Transient */, p.name); - symbol.declarations = p.declarations; - symbol.parent = p.parent; - symbol.type = getWidenedType(getTypeOfSymbol(p)); - symbol.target = p; - if (p.valueDeclaration) - symbol.valueDeclaration = p.valueDeclaration; - members[symbol.name] = symbol; + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + var symbol = createSymbol(p.flags | 67108864 /* Transient */, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedType; + symbol.target = p; + if (p.valueDeclaration) + symbol.valueDeclaration = p.valueDeclaration; + p = symbol; + } + members[p.name] = p; }); var stringIndexType = getIndexTypeOfType(type, 0 /* String */); var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); @@ -10168,16 +10308,16 @@ var ts; return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); } function getWidenedType(type) { - if (type.flags & 131072 /* Unwidened */) { + if (type.flags & 786432 /* RequiresWidening */) { if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { return anyType; } + if (type.flags & 131072 /* ObjectLiteral */) { + return getWidenedTypeOfObjectLiteral(type); + } if (type.flags & 16384 /* Union */) { return getUnionType(ts.map(type.types, getWidenedType)); } - if (isTypeOfObjectLiteral(type)) { - return getWidenedTypeOfObjectLiteral(type); - } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); } @@ -10197,11 +10337,11 @@ var ts; if (isArrayType(type)) { return reportWideningErrorsInType(type.typeArguments[0]); } - if (isTypeOfObjectLiteral(type)) { + if (type.flags & 131072 /* ObjectLiteral */) { var errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); - if (t.flags & 131072 /* Unwidened */) { + if (t.flags & 262144 /* ContainsUndefinedOrNull */) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -10241,7 +10381,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 131072 /* Unwidened */) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 262144 /* ContainsUndefinedOrNull */) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -10465,11 +10605,14 @@ var ts; } ts.Debug.fail("should not get here"); } - function subtractPrimitiveTypes(type, subtractMask) { + function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { if (type.flags & 16384 /* Union */) { var types = type.types; - if (ts.forEach(types, function (t) { return t.flags & subtractMask; })) { - return getUnionType(ts.filter(types, function (t) { return !(t.flags & subtractMask); })); + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); + if (narrowedType !== emptyObjectType) { + return narrowedType; + } } } return type; @@ -10614,7 +10757,7 @@ var ts; case 129 /* Constructor */: break loop; } - if (narrowedType !== type && isTypeSubtypeOf(narrowedType, type)) { + if (narrowedType !== type) { if (isVariableAssignedWithin(symbol, node)) { break; } @@ -10632,16 +10775,24 @@ var ts; if (left.expression.kind !== 64 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { return type; } - var t = right.text; - var checkType = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; + var typeInfo = primitiveTypeInfo[right.text]; if (expr.operator === 31 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } if (assumeTrue) { - return checkType === emptyObjectType ? subtractPrimitiveTypes(type, 2 /* String */ | 4 /* Number */ | 8 /* Boolean */) : checkType; + if (!typeInfo) { + return removeTypesFromUnionType(type, 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */, true); + } + if (isTypeSubtypeOf(typeInfo.type, type)) { + return typeInfo.type; + } + return removeTypesFromUnionType(type, typeInfo.flags, false); } else { - return checkType === emptyObjectType ? type : subtractPrimitiveTypes(type, checkType.flags); + if (typeInfo) { + return removeTypesFromUnionType(type, typeInfo.flags, true); + } + return type; } } function narrowTypeByAnd(type, expr, assumeTrue) { @@ -10678,8 +10829,14 @@ var ts; if (!prototypeProperty) { return type; } - var prototypeType = getTypeOfSymbol(prototypeProperty); - return isTypeSubtypeOf(prototypeType, type) ? prototypeType : type; + var targetType = getTypeOfSymbol(prototypeProperty); + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 16384 /* Union */) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } + return type; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { @@ -10777,6 +10934,9 @@ var ts; error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; + case 122 /* ComputedPropertyName */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); @@ -10788,26 +10948,6 @@ var ts; } return anyType; } - function getSuperContainer(node) { - while (true) { - node = node.parent; - if (!node) - return node; - switch (node.kind) { - case 190 /* FunctionDeclaration */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - return node; - } - } - } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { if (n.kind === 124 /* Parameter */) { @@ -10828,7 +10968,7 @@ var ts; error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); return unknownType; } - var container = getSuperContainer(node); + var container = ts.getSuperContainer(node, true); if (container) { var canUseSuperExpression = false; if (isCallExpression) { @@ -10837,7 +10977,7 @@ var ts; else { var needToCaptureLexicalThis = false; while (container && container.kind === 157 /* ArrowFunction */) { - container = getSuperContainer(container); + container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } if (container && container.parent && container.parent.kind === 191 /* ClassDeclaration */) { @@ -10869,7 +11009,10 @@ var ts; return returnType; } } - if (isCallExpression) { + if (container.kind === 122 /* ComputedPropertyName */) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + } + else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } else { @@ -11008,9 +11151,15 @@ var ts; function getContextualTypeForObjectLiteralElement(element) { var objectLiteral = element.parent; var type = getContextualType(objectLiteral); - var name = element.name.text; - if (type && name) { - return getTypeOfPropertyOfContextualType(type, name) || isNumericName(name) && getIndexTypeOfContextualType(type, 1 /* Number */) || getIndexTypeOfContextualType(type, 0 /* String */); + if (type) { + if (!ts.hasDynamicName(element)) { + var symbolName = getSymbolOfNode(element).name; + var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); + if (propertyType) { + return propertyType; + } + } + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1 /* Number */) || getIndexTypeOfContextualType(type, 0 /* String */); } return undefined; } @@ -11061,6 +11210,8 @@ var ts; case 169 /* TemplateSpan */: ts.Debug.assert(parent.parent.kind === 165 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 155 /* ParenthesizedExpression */: + return getContextualType(parent); } return undefined; } @@ -11165,72 +11316,84 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { + return name.kind === 122 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + } + function isNumericComputedName(name) { + return isTypeOfKind(checkComputedPropertyName(name), 1 /* Any */ | 132 /* NumberLike */); + } + function isNumericLiteralName(name) { return (+name).toString() === name; } + function checkComputedPropertyName(node) { + var links = getNodeLinks(node.expression); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node.expression); + if (!isTypeOfKind(links.resolvedType, 1 /* Any */ | 132 /* NumberLike */ | 258 /* StringLike */)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + } + } + return links.resolvedType; + } function checkObjectLiteral(node, contextualMapper) { checkGrammarObjectLiteralExpression(node); - var members = node.symbol.members; - var properties = {}; + var propertiesTable = {}; + var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var id in members) { - if (ts.hasProperty(members, id)) { - var member = members[id]; - if (member.flags & 4 /* Property */ || ts.isObjectLiteralMethod(member.declarations[0])) { - var memberDecl = member.declarations[0]; - if (memberDecl.kind === 204 /* PropertyAssignment */) { - var type = checkExpression(memberDecl.initializer, contextualMapper); - } - else if (memberDecl.kind === 128 /* MethodDeclaration */) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); - } - else { - ts.Debug.assert(memberDecl.kind === 205 /* ShorthandPropertyAssignment */); - var type = memberDecl.name.kind === 122 /* ComputedPropertyName */ ? unknownType : checkExpression(memberDecl.name, contextualMapper); - } - typeFlags |= type.flags; - var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); - prop.declarations = member.declarations; - prop.parent = member.parent; - if (member.valueDeclaration) { - prop.valueDeclaration = member.valueDeclaration; - } - prop.type = type; - prop.target = member; - member = prop; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; + var member = memberDecl.symbol; + if (memberDecl.kind === 204 /* PropertyAssignment */ || memberDecl.kind === 205 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 204 /* PropertyAssignment */) { + var type = checkPropertyAssignment(memberDecl, contextualMapper); + } + else if (memberDecl.kind === 128 /* MethodDeclaration */) { + var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - var getAccessor = ts.getDeclarationOfKind(member, 130 /* GetAccessor */); - if (getAccessor) { - checkAccessorDeclaration(getAccessor); - } - var setAccessor = ts.getDeclarationOfKind(member, 131 /* SetAccessor */); - if (setAccessor) { - checkAccessorDeclaration(setAccessor); - } + ts.Debug.assert(memberDecl.kind === 205 /* ShorthandPropertyAssignment */); + var type = memberDecl.name.kind === 122 /* ComputedPropertyName */ ? unknownType : checkExpression(memberDecl.name, contextualMapper); } - properties[member.name] = member; + typeFlags |= type.flags; + var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); + prop.declarations = member.declarations; + prop.parent = member.parent; + if (member.valueDeclaration) { + prop.valueDeclaration = member.valueDeclaration; + } + prop.type = type; + prop.target = member; + member = prop; } + else { + ts.Debug.assert(memberDecl.kind === 130 /* GetAccessor */ || memberDecl.kind === 131 /* SetAccessor */); + checkAccessorDeclaration(memberDecl); + } + if (!ts.hasDynamicName(memberDecl)) { + propertiesTable[member.name] = member; + } + propertiesArray.push(member); } var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); - var result = createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= (typeFlags & 131072 /* Unwidened */); + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + result.flags |= 131072 /* ObjectLiteral */ | 524288 /* ContainsObjectLiteral */ | (typeFlags & 262144 /* ContainsUndefinedOrNull */); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { var propTypes = []; - for (var id in properties) { - if (ts.hasProperty(properties, id)) { - if (kind === 0 /* String */ || isNumericName(id)) { - var type = getTypeOfSymbol(properties[id]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); - } + for (var i = 0; i < propertiesArray.length; i++) { + var propertyDecl = node.properties[i]; + if (kind === 0 /* String */ || isNumericName(propertyDecl.name)) { + var type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, type)) { + propTypes.push(type); } } } - return propTypes.length ? getUnionType(propTypes) : undefinedType; + var result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= result.flags; + return result; } return undefined; } @@ -11341,8 +11504,10 @@ var ts; if (objectType === unknownType) { return unknownType; } - if (isConstEnumObjectType(objectType) && node.argumentExpression && node.argumentExpression.kind !== 8 /* StringLiteral */) { - error(node.argumentExpression, ts.Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string); + var isConstEnum = isConstEnumObjectType(objectType); + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8 /* StringLiteral */)) { + error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + return unknownType; } if (node.argumentExpression) { if (node.argumentExpression.kind === 8 /* StringLiteral */ || node.argumentExpression.kind === 7 /* NumericLiteral */) { @@ -11352,10 +11517,14 @@ var ts; getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } + else if (isConstEnum) { + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + return unknownType; + } } } - if (indexType.flags & (1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { - if (indexType.flags & (1 /* Any */ | 132 /* NumberLike */)) { + if (isTypeOfKind(indexType, 1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { + if (isTypeOfKind(indexType, 1 /* Any */ | 132 /* NumberLike */)) { var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); if (numberIndexType) { return numberIndexType; @@ -11539,10 +11708,25 @@ var ts; } return args; } + function getEffectiveTypeArguments(callExpression) { + if (callExpression.expression.kind === 90 /* SuperKeyword */) { + var containingClass = ts.getAncestor(callExpression, 191 /* ClassDeclaration */); + var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + return baseClassTypeNode && baseClassTypeNode.typeArguments; + } + else { + return callExpression.typeArguments; + } + } function resolveCall(node, signatures, candidatesOutArray) { var isTaggedTemplate = node.kind === 153 /* TaggedTemplateExpression */; - var typeArguments = isTaggedTemplate ? undefined : node.typeArguments; - ts.forEach(typeArguments, checkSourceElement); + var typeArguments; + if (!isTaggedTemplate) { + typeArguments = getEffectiveTypeArguments(node); + if (node.expression.kind !== 90 /* SuperKeyword */) { + ts.forEach(typeArguments, checkSourceElement); + } + } var candidates = candidatesOutArray || []; collectCandidates(); if (!candidates.length) { @@ -11659,8 +11843,10 @@ var ts; var result = candidates; var lastParent; var lastSymbol; - var cutoffPos = 0; - var pos; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; ts.Debug.assert(!result.length); for (var i = 0; i < signatures.length; i++) { var signature = signatures[i]; @@ -11668,22 +11854,27 @@ var ts; var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { if (lastParent && parent === lastParent) { - pos++; + index++; } else { lastParent = parent; - pos = cutoffPos; + index = cutoffIndex; } } else { - pos = cutoffPos = result.length; + index = cutoffIndex = result.length; lastParent = parent; } lastSymbol = symbol; - for (var j = result.length; j > pos; j--) { - result[j] = result[j - 1]; + if (signature.hasStringLiterals) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; } - result[pos] = signature; + else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, signature); } } } @@ -11799,7 +11990,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { grammarErrorOnFirstToken(node.template, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); } return getReturnTypeOfSignature(getResolvedSignature(node)); @@ -11948,7 +12139,7 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic) { - if (!(type.flags & (1 /* Any */ | 132 /* NumberLike */))) { + if (!isTypeOfKind(type, 1 /* Any */ | 132 /* NumberLike */)) { error(operand, diagnostic); return false; } @@ -12052,11 +12243,20 @@ var ts; } return numberType; } - function isStructuredType(type) { - if (type.flags & 16384 /* Union */) { - return !ts.forEach(type.types, function (t) { return !isStructuredType(t); }); + function isTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; } - return (type.flags & (48128 /* ObjectType */ | 512 /* TypeParameter */)) !== 0; + if (type.flags & 16384 /* Union */) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (!(types[i].flags & kind)) { + return false; + } + } + return true; + } + return false; } function isConstEnumObjectType(type) { return type.flags & (48128 /* ObjectType */ | 32768 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); @@ -12065,7 +12265,7 @@ var ts; return (symbol.flags & 128 /* ConstEnum */) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (!(leftType.flags & 1 /* Any */ || isStructuredType(leftType))) { + if (isTypeOfKind(leftType, 510 /* Primitive */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(rightType.flags & 1 /* Any */ || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -12074,10 +12274,10 @@ var ts; return booleanType; } function checkInExpression(node, leftType, rightType) { - if (leftType !== anyType && leftType !== stringType && leftType !== numberType) { + if (!isTypeOfKind(leftType, 1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); } - if (!(rightType.flags & 1 /* Any */ || isStructuredType(rightType))) { + if (!isTypeOfKind(rightType, 1 /* Any */ | 48128 /* ObjectType */ | 512 /* TypeParameter */)) { error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -12088,7 +12288,7 @@ var ts; var p = properties[i]; if (p.kind === 204 /* PropertyAssignment */ || p.kind === 205 /* ShorthandPropertyAssignment */) { var name = p.name; - var type = sourceType.flags & 1 /* Any */ ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericName(name.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); + var type = sourceType.flags & 1 /* Any */ ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -12207,13 +12407,13 @@ var ts; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) rightType = leftType; var resultType; - if (leftType.flags & 132 /* NumberLike */ && rightType.flags & 132 /* NumberLike */) { + if (isTypeOfKind(leftType, 132 /* NumberLike */) && isTypeOfKind(rightType, 132 /* NumberLike */)) { resultType = numberType; } - else if (leftType.flags & 258 /* StringLike */ || rightType.flags & 258 /* StringLike */) { + else if (isTypeOfKind(leftType, 258 /* StringLike */) || isTypeOfKind(rightType, 258 /* StringLike */)) { resultType = stringType; } - else if (leftType.flags & 1 /* Any */ || leftType === unknownType || rightType.flags & 1 /* Any */ || rightType === unknownType) { + else if (leftType.flags & 1 /* Any */ || rightType.flags & 1 /* Any */) { resultType = anyType; } if (!resultType) { @@ -12311,8 +12511,17 @@ var ts; } return links.resolvedType; } + function checkPropertyAssignment(node, contextualMapper) { + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } + return checkExpression(node.initializer, contextualMapper); + } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } @@ -12435,12 +12644,15 @@ var ts; checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { + if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); if (!(func.kind === 129 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } + if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { + error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); + } if (node.dotDotDotToken) { if (!isArrayType(getTypeOfSymbol(node.symbol))) { error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); @@ -12585,7 +12797,7 @@ var ts; error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } - if (!ts.hasComputedNameButNotSymbol(node)) { + if (!ts.hasDynamicName(node)) { var otherKind = node.kind === 130 /* GetAccessor */ ? 131 /* SetAccessor */ : 130 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { @@ -12600,8 +12812,8 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); } + checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -12909,7 +13121,10 @@ var ts; } function checkFunctionLikeDeclaration(node) { checkSignatureDeclaration(node); - if (!ts.hasComputedNameButNotSymbol(node)) { + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } + else { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); @@ -13063,7 +13278,8 @@ var ts; } function checkVariableLikeDeclaration(node) { checkSourceElement(node.type); - if (ts.hasComputedNameButNotSymbol(node)) { + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } @@ -13207,7 +13423,7 @@ var ts; } } var exprType = checkExpression(node.expression); - if (!(exprType.flags & 1 /* Any */ || isStructuredType(exprType))) { + if (!isTypeOfKind(exprType, 1 /* Any */ | 48128 /* ObjectType */ | 512 /* TypeParameter */)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -13327,29 +13543,6 @@ var ts; checkBlock(node.finallyBlock); } function checkIndexConstraints(type) { - function checkIndexConstraintForProperty(prop, propertyType, indexDeclaration, indexType, indexKind) { - if (!indexType) { - return; - } - if (indexKind === 1 /* Number */ && !isNumericName(prop.name)) { - return; - } - var errorNode; - if (prop.parent === type.symbol) { - errorNode = prop.valueDeclaration; - } - else if (indexDeclaration) { - errorNode = indexDeclaration; - } - else if (type.flags & 2048 /* Interface */) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(type.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : type.symbol.declarations[0]; - } - if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 /* String */ ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); - } - } var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1 /* Number */); var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0 /* String */); var stringIndexType = getIndexTypeOfType(type, 0 /* String */); @@ -13357,9 +13550,20 @@ var ts; if (stringIndexType || numberIndexType) { ts.forEach(getPropertiesOfObjectType(type), function (prop) { var propType = getTypeOfSymbol(prop); - checkIndexConstraintForProperty(prop, propType, declaredStringIndexer, stringIndexType, 0 /* String */); - checkIndexConstraintForProperty(prop, propType, declaredNumberIndexer, numberIndexType, 1 /* Number */); + checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); + checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); }); + if (type.flags & 1024 /* Class */ && type.symbol.valueDeclaration.kind === 191 /* ClassDeclaration */) { + var classDeclaration = type.symbol.valueDeclaration; + for (var i = 0; i < classDeclaration.members.length; i++) { + var member = classDeclaration.members[i]; + if (!(member.flags & 128 /* Static */) && ts.hasDynamicName(member)) { + var propType = getTypeOfSymbol(member.symbol); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); + } + } + } } var errorNode; if (stringIndexType && numberIndexType) { @@ -13372,6 +13576,29 @@ var ts; if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) { error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)); } + function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) { + if (!indexType) { + return; + } + if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) { + return; + } + var errorNode; + if (prop.valueDeclaration.name.kind === 122 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + errorNode = prop.valueDeclaration; + } + else if (indexDeclaration) { + errorNode = indexDeclaration; + } + else if (containingType.flags & 2048 /* Interface */) { + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + } + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 /* String */ ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + } + } } function checkTypeNameIsReserved(name, message) { switch (name.text) { @@ -13600,7 +13827,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (isNumericName(member.name.text)) { + if (member.name.kind !== 122 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -14564,8 +14791,8 @@ var ts; if (symbol && (symbol.flags & 8 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 206 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { - return constantValue; + if (declaration.kind === 206 /* EnumMember */) { + return getEnumMemberValue(declaration); } } return undefined; @@ -14624,7 +14851,7 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTemplateStringsArrayType = compilerOptions.target >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; + globalTemplateStringsArrayType = languageVersion >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; anyArrayType = createArrayType(anyType); } function checkGrammarModifiers(node) { @@ -14748,6 +14975,9 @@ var ts; else if (node.kind === 192 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } + else if (node.kind === 124 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); + } } function checkGrammarForDisallowedTrailingComma(list) { if (list && list.hasTrailingComma) { @@ -14932,16 +15162,14 @@ var ts; } function checkGrammarComputedPropertyName(node) { if (node.kind !== 122 /* ComputedPropertyName */) { - return; + return false; } - grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_not_currently_supported); - return; var computedPropertyName = node; - if (compilerOptions.target < 2 /* ES6 */) { - grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); + if (languageVersion < 2 /* ES6 */) { + return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); } else if (computedPropertyName.expression.kind === 163 /* BinaryExpression */ && computedPropertyName.expression.operator === 23 /* CommaToken */) { - grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { @@ -15017,7 +15245,7 @@ var ts; } function checkGrammarAccessor(accessor) { var kind = accessor.kind; - if (compilerOptions.target < 1 /* ES5 */) { + if (languageVersion < 1 /* ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } else if (ts.isInAmbientContext(accessor)) { @@ -15182,7 +15410,7 @@ var ts; if (!declarationList.declarations.length) { return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); } - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { if (ts.isLet(declarationList)) { return grammarErrorOnFirstToken(declarationList, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); } @@ -15265,7 +15493,7 @@ var ts; function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var scanner = ts.createScanner(compilerOptions.target, true, sourceFile.text); + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); var start = scanToken(scanner, node.pos); diagnostics.push(ts.createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); return true; @@ -15365,7 +15593,7 @@ var ts; if (node.parserContextFlags & 1 /* StrictMode */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } - else if (compilerOptions.target >= 1 /* ES5 */) { + else if (languageVersion >= 1 /* ES5 */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -15373,7 +15601,7 @@ var ts; function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var scanner = ts.createScanner(compilerOptions.target, true, sourceFile.text); + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); scanToken(scanner, node.pos); diagnostics.push(ts.createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); return true; @@ -15500,9 +15728,10 @@ var ts; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos); + var lastLine = currentSourceFile.getLineStarts().length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, 1); + var nextLineStart = currentLine === lastLine ? (comment.end + 1) : currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, 1); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(currentSourceFile.getPositionFromLineAndCharacter(firstCommentLineAndCharacter.line, 1), comment.pos); @@ -15622,6 +15851,7 @@ var ts; function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; var write; var writeLine; var increaseIndent; @@ -16114,6 +16344,9 @@ var ts; } } function emitPropertyDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } emitJsDocComments(node); emitClassMemberDeclarationFlags(node); emitVariableDeclaration(node); @@ -16182,6 +16415,9 @@ var ts; } } function emitAccessorDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } var accessors = getAllAccessorDeclarations(node.parent, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); @@ -16239,6 +16475,9 @@ var ts; } } function emitFunctionDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } if ((node.kind !== 190 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 190 /* FunctionDeclaration */) { @@ -16490,6 +16729,7 @@ var ts; ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitFiles(resolver, host, targetSourceFile) { var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; var diagnostics = []; var newLine = host.getNewLine(); @@ -16646,7 +16886,11 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - scopeName = sourceMapData.sourceMapNames[parentIndex] + "." + scopeName; + var name = node.name; + if (!name || name.kind !== 122 /* ComputedPropertyName */) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; } scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); if (scopeNameIndex === undefined) { @@ -16662,7 +16906,8 @@ var ts; } else if (node.kind === 190 /* FunctionDeclaration */ || node.kind === 156 /* FunctionExpression */ || node.kind === 128 /* MethodDeclaration */ || node.kind === 127 /* MethodSignature */ || node.kind === 130 /* GetAccessor */ || node.kind === 131 /* SetAccessor */ || node.kind === 195 /* ModuleDeclaration */ || node.kind === 191 /* ClassDeclaration */ || node.kind === 194 /* EnumDeclaration */) { if (node.name) { - scopeName = node.name.text; + var name = node.name; + scopeName = name.kind === 122 /* ComputedPropertyName */ ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -16882,11 +17127,11 @@ var ts; return false; } function emitLiteral(node) { - var text = compilerOptions.target < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; + var text = languageVersion < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; if (compilerOptions.sourceMap && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } - else if (compilerOptions.target < 2 /* ES6 */ && node.kind === 7 /* NumericLiteral */ && isBinaryOrOctalIntegerLiteral(text)) { + else if (languageVersion < 2 /* ES6 */ && node.kind === 7 /* NumericLiteral */ && isBinaryOrOctalIntegerLiteral(text)) { write(node.text); } else { @@ -16897,7 +17142,7 @@ var ts; return '"' + ts.escapeString(node.text) + '"'; } function emitTemplateExpression(node) { - if (compilerOptions.target >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES6 */) { ts.forEachChild(node, emit); return; } @@ -16944,7 +17189,7 @@ var ts; } } function comparePrecedenceToBinaryPlus(expression) { - ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); + ts.Debug.assert(languageVersion < 2 /* ES6 */); switch (expression.kind) { case 163 /* BinaryExpression */: switch (expression.operator) { @@ -17110,7 +17355,7 @@ var ts; write("[]"); return; } - if (compilerOptions.target >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES6 */) { write("["); emitList(elements, 0, elements.length, (node.flags & 256 /* MultiLine */) !== 0, elements.hasTrailingComma); write("]"); @@ -17155,7 +17400,7 @@ var ts; if (!multiLine) { write(" "); } - emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && compilerOptions.target >= 1 /* ES5 */); + emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && languageVersion >= 1 /* ES5 */); if (!multiLine) { write(" "); } @@ -17168,32 +17413,23 @@ var ts; write("]"); } function emitMethod(node) { - if (!ts.isObjectLiteralMethod(node)) { - return; - } - emitLeadingComments(node); emit(node.name); - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { write(": function "); } emitSignatureAndBody(node); - emitTrailingComments(node); } function emitPropertyAssignment(node) { - emitLeadingComments(node); emit(node.name); write(": "); emit(node.initializer); - emitTrailingComments(node); } function emitShorthandPropertyAssignment(node) { - emitLeadingComments(node); emit(node.name); - if (compilerOptions.target < 2 /* ES6 */ || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion < 2 /* ES6 */ || resolver.getExpressionNamePrefix(node.name)) { write(": "); emitExpressionIdentifier(node.name); } - emitTrailingComments(node); } function tryEmitConstantValue(node) { var constantValue = resolver.getConstantValue(node); @@ -17261,7 +17497,7 @@ var ts; } } function emitTaggedTemplateExpression(node) { - ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); + ts.Debug.assert(languageVersion >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); emit(node.tag); write(" "); emit(node.template); @@ -17314,7 +17550,7 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (compilerOptions.target < 2 /* ES6 */ && node.operator === 52 /* EqualsToken */ && (node.left.kind === 148 /* ObjectLiteralExpression */ || node.left.kind === 147 /* ArrayLiteralExpression */)) { + if (languageVersion < 2 /* ES6 */ && node.operator === 52 /* EqualsToken */ && (node.left.kind === 148 /* ObjectLiteralExpression */ || node.left.kind === 147 /* ArrayLiteralExpression */)) { emitDestructuring(node); } else { @@ -17363,13 +17599,10 @@ var ts; } } function emitExpressionStatement(node) { - emitLeadingComments(node); emitParenthesized(node.expression, node.expression.kind === 157 /* ArrowFunction */); write(";"); - emitTrailingComments(node); } function emitIfStatement(node) { - emitLeadingComments(node); var endPos = emitToken(83 /* IfKeyword */, node.pos); write(" "); endPos = emitToken(16 /* OpenParenToken */, endPos); @@ -17387,7 +17620,6 @@ var ts; emitEmbeddedStatement(node.elseStatement); } } - emitTrailingComments(node); } function emitDoStatement(node) { write("do"); @@ -17469,11 +17701,9 @@ var ts; write(";"); } function emitReturnStatement(node) { - emitLeadingComments(node); emitToken(89 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); - emitTrailingComments(node); } function emitWithStatement(node) { write("with ("); @@ -17754,9 +17984,8 @@ var ts; } } function emitVariableDeclaration(node) { - emitLeadingComments(node); if (ts.isBindingPattern(node.name)) { - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { emitDestructuring(node); } else { @@ -17768,10 +17997,8 @@ var ts; emitModuleMemberName(node); emitOptional(" = ", node.initializer); } - emitTrailingComments(node); } function emitVariableStatement(node) { - emitLeadingComments(node); if (!(node.flags & 1 /* Export */)) { if (ts.isLet(node.declarationList)) { write("let "); @@ -17785,11 +18012,9 @@ var ts; } emitCommaList(node.declarationList.declarations); write(";"); - emitTrailingComments(node); } function emitParameter(node) { - emitLeadingComments(node); - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { if (ts.isBindingPattern(node.name)) { var name = createTempVariable(node); if (!tempParameters) { @@ -17809,10 +18034,9 @@ var ts; emit(node.name); emitOptional(" = ", node.initializer); } - emitTrailingComments(node); } function emitDefaultValueAssignments(node) { - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { var tempIndex = 0; ts.forEach(node.parameters, function (p) { if (ts.isBindingPattern(p.name)) { @@ -17841,7 +18065,7 @@ var ts; } } function emitRestParameter(node) { - if (compilerOptions.target < 2 /* ES6 */ && ts.hasRestParameters(node)) { + if (languageVersion < 2 /* ES6 */ && ts.hasRestParameters(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; var tempName = createTempVariable(node, true).text; @@ -17879,11 +18103,9 @@ var ts; } } function emitAccessor(node) { - emitLeadingComments(node); write(node.kind === 130 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); - emitTrailingComments(node); } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { @@ -17914,7 +18136,7 @@ var ts; write("("); if (node) { var parameters = node.parameters; - var omitCount = compilerOptions.target < 2 /* ES6 */ && ts.hasRestParameters(node) ? 1 : 0; + var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameters(node) ? 1 : 0; emitList(parameters, 0, parameters.length - omitCount, false, false); } write(")"); @@ -17945,7 +18167,7 @@ var ts; write(" "); emitStart(node.body); write("return "); - emitNode(node.body); + emitNode(node.body, true); emitEnd(node.body); write(";"); emitTempDeclarations(false); @@ -17962,7 +18184,7 @@ var ts; writeLine(); emitLeadingComments(node.body); write("return "); - emit(node.body); + emit(node.body, true); write(";"); emitTrailingComments(node.body); } @@ -18136,7 +18358,6 @@ var ts; }); } function emitClassDeclaration(node) { - emitLeadingComments(node); write("var "); emit(node.name); write(" = (function ("); @@ -18186,7 +18407,6 @@ var ts; emitEnd(node); write(";"); } - emitTrailingComments(node); function emitConstructorOfClass() { var saveTempCount = tempCount; var saveTempVariables = tempVariables; @@ -18261,12 +18481,14 @@ var ts; function emitInterfaceDeclaration(node) { emitPinnedOrTripleSlashComments(node); } - function emitEnumDeclaration(node) { + function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - if (isConstEnum && !compilerOptions.preserveConstEnums) { + return !isConstEnum || compilerOptions.preserveConstEnums; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { return; } - emitLeadingComments(node); if (!(node.flags & 1 /* Export */)) { emitStart(node); write("var "); @@ -18283,7 +18505,7 @@ var ts; write(") {"); increaseIndent(); scopeEmitStart(node); - emitEnumMemberDeclarations(isConstEnum); + emitLines(node.members); decreaseIndent(); writeLine(); emitToken(15 /* CloseBraceToken */, node.members.end); @@ -18304,31 +18526,26 @@ var ts; emitEnd(node); write(";"); } - emitTrailingComments(node); - function emitEnumMemberDeclarations(isConstEnum) { - ts.forEach(node.members, function (member) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - write(resolver.getLocalNameOfContainer(node)); - write("["); - write(resolver.getLocalNameOfContainer(node)); - write("["); - emitExpressionForPropertyName(member.name); - write("] = "); - if (member.initializer && !isConstEnum) { - emit(member.initializer); - } - else { - write(resolver.getEnumMemberValue(member).toString()); - } - write("] = "); - emitExpressionForPropertyName(member.name); - emitEnd(member); - write(";"); - emitTrailingComments(member); - }); + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + if (node.initializer && !ts.isConst(enumParent)) { + emit(node.initializer); } + else { + write(resolver.getEnumMemberValue(node).toString()); + } + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { if (moduleDeclaration.body.kind === 195 /* ModuleDeclaration */) { @@ -18336,12 +18553,14 @@ var ts; return recursiveInnerModule || moduleDeclaration.body; } } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + } function emitModuleDeclaration(node) { - var shouldEmit = ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { return emitPinnedOrTripleSlashComments(node); } - emitLeadingComments(node); emitStart(node); write("var "); emit(node.name); @@ -18386,7 +18605,6 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - emitTrailingComments(node); } function emitImportDeclaration(node) { var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); @@ -18559,13 +18777,38 @@ var ts; } emitLeadingComments(node.endOfFileToken); } - function emitNode(node) { + function emitNode(node, disableComments) { if (!node) { return; } if (node.flags & 2 /* Ambient */) { return emitPinnedOrTripleSlashComments(node); } + var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { + emitLeadingComments(node); + } + emitJavaScriptWorker(node); + if (emitComments) { + emitTrailingComments(node); + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 192 /* InterfaceDeclaration */: + case 190 /* FunctionDeclaration */: + case 197 /* ImportDeclaration */: + case 193 /* TypeAliasDeclaration */: + case 198 /* ExportAssignment */: + return false; + case 195 /* ModuleDeclaration */: + return shouldEmitModuleDeclaration(node); + case 194 /* EnumDeclaration */: + return shouldEmitEnumDeclaration(node); + } + return true; + } + function emitJavaScriptWorker(node) { switch (node.kind) { case 64 /* Identifier */: return emitIdentifier(node); @@ -18702,6 +18945,8 @@ var ts; return emitInterfaceDeclaration(node); case 194 /* EnumDeclaration */: return emitEnumDeclaration(node); + case 206 /* EnumMember */: + return emitEnumMember(node); case 195 /* ModuleDeclaration */: return emitModuleDeclaration(node); case 197 /* ImportDeclaration */: @@ -18724,15 +18969,17 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 207 /* SourceFile */ || node.pos !== node.parent.pos) { - var leadingComments; - if (hasDetachedComments(node.pos)) { - leadingComments = getLeadingCommentsWithoutDetachedComments(); + if (node.parent) { + if (node.parent.kind === 207 /* SourceFile */ || node.pos !== node.parent.pos) { + var leadingComments; + if (hasDetachedComments(node.pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + return leadingComments; } - else { - leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); - } - return leadingComments; } } function emitLeadingDeclarationComments(node) { @@ -18741,9 +18988,11 @@ var ts; emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 207 /* SourceFile */ || node.end !== node.parent.end) { - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); - emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + if (node.parent) { + if (node.parent.kind === 207 /* SourceFile */ || node.end !== node.parent.end) { + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } } } function emitLeadingCommentsOfLocalPosition(pos) { @@ -19181,7 +19430,7 @@ var ts; return; } var firstExternalModule = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModule && options.module === 0 /* None */) { + if (firstExternalModule && !options.module) { var externalModuleErrorSpan = ts.getErrorSpanForNode(firstExternalModule.externalModuleIndicator); var errorStart = ts.skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); var errorLength = externalModuleErrorSpan.end - errorStart; @@ -19261,6 +19510,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Print_this_message }, + { + name: "listFiles", + type: "boolean" + }, { name: "locale", type: "string" @@ -19268,6 +19521,7 @@ var ts; { name: "mapRoot", type: "string", + isFilePath: true, description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, @@ -19318,6 +19572,7 @@ var ts; { name: "outDir", type: "string", + isFilePath: true, description: ts.Diagnostics.Redirect_output_structure_to_the_directory, paramType: ts.Diagnostics.DIRECTORY }, @@ -19326,6 +19581,14 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Compile_the_project_in_the_given_directory, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "removeComments", type: "boolean", @@ -19339,6 +19602,7 @@ var ts; { name: "sourceRoot", type: "string", + isFilePath: true, description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, @@ -19368,21 +19632,18 @@ var ts; description: ts.Diagnostics.Watch_input_files } ]; - var shortOptionNames = {}; - var optionNameMap = {}; - ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; - if (option.shortName) { - shortOptionNames[option.shortName] = option.name; - } - }); function parseCommandLine(commandLine) { - var options = { - target: 0 /* ES3 */, - module: 0 /* None */ - }; + var options = {}; var filenames = []; var errors = []; + var shortOptionNames = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name.toLowerCase()] = option; + if (option.shortName) { + shortOptionNames[option.shortName] = option.name; + } + }); parseStrings(commandLine); return { options: options, @@ -19472,10 +19733,87 @@ var ts; } } ts.parseCommandLine = parseCommandLine; + function readConfigFile(filename) { + try { + var text = ts.sys.readFile(filename); + return /\S/.test(text) ? JSON.parse(text) : {}; + } + catch (e) { + } + } + ts.readConfigFile = readConfigFile; + function parseConfigFile(json, basePath) { + var errors = []; + return { + options: getCompilerOptions(), + filenames: getFiles(), + errors: errors + }; + function getCompilerOptions() { + var options = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name] = option; + }); + var jsonOptions = json["compilerOptions"]; + if (jsonOptions) { + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + var optType = opt.type; + var value = jsonOptions[id]; + var expectedType = typeof optType === "string" ? optType : "string"; + if (typeof value === expectedType) { + if (typeof optType !== "string") { + var key = value.toLowerCase(); + if (ts.hasProperty(optType, key)) { + value = optType[key]; + } + else { + errors.push(ts.createCompilerDiagnostic(opt.error)); + value = 0; + } + } + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + } + options[opt.name] = value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); + } + } + } + return options; + } + function getFiles() { + var files = []; + if (ts.hasProperty(json, "files")) { + if (json["files"] instanceof Array) { + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + } + } + else { + var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + for (var i = 0; i < sysFiles.length; i++) { + var name = sysFiles[i]; + if (!ts.fileExtensionIs(name, ".d.ts") || !ts.contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { + files.push(name); + } + } + } + return files; + } + } + ts.parseConfigFile = parseConfigFile; })(ts || (ts = {})); var ts; (function (ts) { - var version = "1.4.0.0"; + var version = "1.5.0.0"; function validateLocaleAndSetLanguage(locale, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { @@ -19568,13 +19906,39 @@ var ts; function reportTimeStatistic(name, time) { reportStatisticalValue(name, (time / 1000).toFixed(2) + "s"); } + function isJSONSupported() { + return typeof JSON === "object" && typeof JSON.parse === "function"; + } + function findConfigFile() { + var searchPath = ts.normalizePath(ts.sys.getCurrentDirectory()); + var filename = "tsconfig.json"; + while (true) { + if (ts.sys.fileExists(filename)) { + return filename; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + filename = "../" + filename; + } + return undefined; + } function executeCommandLine(args) { var commandLine = ts.parseCommandLine(args); - var compilerOptions = commandLine.options; - if (compilerOptions.locale) { - if (typeof JSON === "undefined") { + var configFilename; + var configFileWatcher; + var cachedProgram; + var rootFilenames; + var compilerOptions; + var compilerHost; + var hostGetSourceFile; + var timerHandle; + if (commandLine.options.locale) { + if (!isJSONSupported()) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); - return ts.sys.exit(1); + return ts.sys.exit(5 /* CompilerOptionsErrors */); } validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } @@ -19582,92 +19946,126 @@ var ts; reportDiagnostics(commandLine.errors); return ts.sys.exit(5 /* CompilerOptionsErrors */); } - if (compilerOptions.version) { + if (commandLine.options.version) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, version)); return ts.sys.exit(0 /* Succeeded */); } - if (compilerOptions.help) { + if (commandLine.options.help) { printVersion(); printHelp(); return ts.sys.exit(0 /* Succeeded */); } - if (commandLine.filenames.length === 0) { + if (commandLine.options.project) { + if (!isJSONSupported()) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); + return ts.sys.exit(5 /* CompilerOptionsErrors */); + } + configFilename = ts.normalizePath(ts.combinePaths(commandLine.options.project, "tsconfig.json")); + if (commandLine.filenames.length !== 0) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); + return ts.sys.exit(5 /* CompilerOptionsErrors */); + } + } + else if (commandLine.filenames.length === 0 && isJSONSupported()) { + configFilename = findConfigFile(); + } + if (commandLine.filenames.length === 0 && !configFilename) { printVersion(); printHelp(); return ts.sys.exit(5 /* CompilerOptionsErrors */); } - var defaultCompilerHost = ts.createCompilerHost(compilerOptions); - if (compilerOptions.watch) { + if (commandLine.options.watch) { if (!ts.sys.watchFile) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); return ts.sys.exit(5 /* CompilerOptionsErrors */); } - watchProgram(commandLine, defaultCompilerHost); + if (configFilename) { + configFileWatcher = ts.sys.watchFile(configFilename, configFileChanged); + } } - else { - var result = compile(commandLine, defaultCompilerHost).exitStatus; - return ts.sys.exit(result); + performCompilation(); + function performCompilation() { + if (!cachedProgram) { + if (configFilename) { + var configObject = ts.readConfigFile(configFilename); + if (!configObject) { + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, configFilename)); + return ts.sys.exit(5 /* CompilerOptionsErrors */); + } + var configParseResult = ts.parseConfigFile(configObject, ts.getDirectoryPath(configFilename)); + if (configParseResult.errors.length > 0) { + reportDiagnostics(configParseResult.errors); + return ts.sys.exit(5 /* CompilerOptionsErrors */); + } + rootFilenames = configParseResult.filenames; + compilerOptions = ts.extend(commandLine.options, configParseResult.options); + } + else { + rootFilenames = commandLine.filenames; + compilerOptions = commandLine.options; + } + compilerHost = ts.createCompilerHost(compilerOptions); + hostGetSourceFile = compilerHost.getSourceFile; + compilerHost.getSourceFile = getSourceFile; + } + var compileResult = compile(rootFilenames, compilerOptions, compilerHost); + if (!commandLine.options.watch) { + return ts.sys.exit(compileResult.exitStatus); + } + setCachedProgram(compileResult.program); + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); + } + function getSourceFile(filename, languageVersion, onError) { + if (cachedProgram) { + var sourceFile = cachedProgram.getSourceFile(filename); + if (sourceFile && sourceFile.fileWatcher) { + return sourceFile; + } + } + var sourceFile = hostGetSourceFile(filename, languageVersion, onError); + if (sourceFile && commandLine.options.watch) { + sourceFile.fileWatcher = ts.sys.watchFile(sourceFile.filename, function () { return sourceFileChanged(sourceFile); }); + } + return sourceFile; + } + function setCachedProgram(program) { + if (cachedProgram) { + var newSourceFiles = program ? program.getSourceFiles() : undefined; + ts.forEach(cachedProgram.getSourceFiles(), function (sourceFile) { + if (!(newSourceFiles && ts.contains(newSourceFiles, sourceFile))) { + if (sourceFile.fileWatcher) { + sourceFile.fileWatcher.close(); + sourceFile.fileWatcher = undefined; + } + } + }); + } + cachedProgram = program; + } + function sourceFileChanged(sourceFile) { + sourceFile.fileWatcher = undefined; + startTimer(); + } + function configFileChanged() { + setCachedProgram(undefined); + startTimer(); + } + function startTimer() { + if (timerHandle) { + clearTimeout(timerHandle); + } + timerHandle = setTimeout(recompile, 250); + } + function recompile() { + timerHandle = undefined; + reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation)); + performCompilation(); } } ts.executeCommandLine = executeCommandLine; - function watchProgram(commandLine, compilerHost) { - var watchers = {}; - var updatedFiles = {}; - var program = compile(commandLine, compilerHost).program; - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); - addWatchers(program); - return; - function addWatchers(program) { - ts.forEach(program.getSourceFiles(), function (f) { - var filename = getCanonicalName(f.filename); - watchers[filename] = ts.sys.watchFile(filename, fileUpdated); - }); - } - function removeWatchers(program) { - ts.forEach(program.getSourceFiles(), function (f) { - var filename = getCanonicalName(f.filename); - if (ts.hasProperty(watchers, filename)) { - watchers[filename].close(); - } - }); - watchers = {}; - } - function fileUpdated(filename) { - var firstNotification = ts.isEmpty(updatedFiles); - updatedFiles[getCanonicalName(filename)] = true; - if (firstNotification) { - setTimeout(function () { - var changedFiles = updatedFiles; - updatedFiles = {}; - recompile(changedFiles); - }, 250); - } - } - function recompile(changedFiles) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.File_change_detected_Compiling)); - removeWatchers(program); - var oldSourceFiles = ts.arrayToMap(ts.filter(program.getSourceFiles(), function (file) { return !ts.hasProperty(changedFiles, getCanonicalName(file.filename)); }), function (file) { return getCanonicalName(file.filename); }); - var newCompilerHost = ts.clone(compilerHost); - newCompilerHost.getSourceFile = function (fileName, languageVersion, onError) { - fileName = getCanonicalName(fileName); - var sourceFile = ts.lookUp(oldSourceFiles, fileName); - if (sourceFile) { - return sourceFile; - } - return compilerHost.getSourceFile(fileName, languageVersion, onError); - }; - program = compile(commandLine, newCompilerHost).program; - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Compilation_complete_Watching_for_file_changes)); - addWatchers(program); - } - function getCanonicalName(fileName) { - return compilerHost.getCanonicalFileName(fileName); - } - } - function compile(commandLine, compilerHost) { + function compile(filenames, compilerOptions, compilerHost) { var parseStart = new Date().getTime(); - var compilerOptions = commandLine.options; - var program = ts.createProgram(commandLine.filenames, compilerOptions, compilerHost); + var program = ts.createProgram(filenames, compilerOptions, compilerHost); var bindStart = new Date().getTime(); var errors = program.getDiagnostics(); var exitStatus; @@ -19697,7 +20095,12 @@ var ts; } } reportDiagnostics(errors); - if (commandLine.options.diagnostics) { + if (compilerOptions.listFiles) { + ts.forEach(program.getSourceFiles(), function (file) { + ts.sys.write(file.filename + ts.sys.newLine); + }); + } + if (compilerOptions.diagnostics) { var memoryUsed = ts.sys.getMemoryUsage ? ts.sys.getMemoryUsage() : -1; reportCountStatistic("Files", program.getSourceFiles().length); reportCountStatistic("Lines", countLines(program)); diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 592b73ba8d9..11f29d7624e 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -283,6 +283,11 @@ declare module "typescript" { ThisNodeOrAnySubNodesHasError = 32, HasAggregatedChildData = 64, } + const enum RelationComparisonResult { + Succeeded = 1, + Failed = 2, + FailedAndReported = 3, + } interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; @@ -994,11 +999,15 @@ declare module "typescript" { Union = 16384, Anonymous = 32768, FromSignature = 65536, - Unwidened = 131072, + ObjectLiteral = 131072, + ContainsUndefinedOrNull = 262144, + ContainsObjectLiteral = 524288, Intrinsic = 127, + Primitive = 510, StringLike = 258, NumberLike = 132, ObjectType = 48128, + RequiresWidening = 786432, } interface Type { flags: TypeFlags; @@ -1123,6 +1132,7 @@ declare module "typescript" { diagnostics?: boolean; emitBOM?: boolean; help?: boolean; + listFiles?: boolean; locale?: string; mapRoot?: string; module?: ModuleKind; @@ -1136,6 +1146,7 @@ declare module "typescript" { out?: string; outDir?: string; preserveConstEnums?: boolean; + project?: string; removeComments?: boolean; sourceMap?: boolean; sourceRoot?: string; @@ -1168,6 +1179,7 @@ declare module "typescript" { interface CommandLineOption { name: string; type: string | Map; + isFilePath?: boolean; shortName?: string; description?: DiagnosticMessage; paramType?: DiagnosticMessage; @@ -1428,6 +1440,7 @@ declare module "typescript" { isOpen: boolean; version: string; scriptSnapshot: IScriptSnapshot; + nameTable: Map; getNamedDeclarations(): Declaration[]; } /** @@ -1470,6 +1483,7 @@ declare module "typescript" { } interface LanguageServiceHost extends Logger { getCompilationSettings(): CompilerOptions; + getNewLine?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; getScriptIsOpen(fileName: string): boolean; diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 6fd1cda359a..d4fa86da1b5 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -283,6 +283,11 @@ declare module ts { ThisNodeOrAnySubNodesHasError = 32, HasAggregatedChildData = 64, } + const enum RelationComparisonResult { + Succeeded = 1, + Failed = 2, + FailedAndReported = 3, + } interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; @@ -994,11 +999,15 @@ declare module ts { Union = 16384, Anonymous = 32768, FromSignature = 65536, - Unwidened = 131072, + ObjectLiteral = 131072, + ContainsUndefinedOrNull = 262144, + ContainsObjectLiteral = 524288, Intrinsic = 127, + Primitive = 510, StringLike = 258, NumberLike = 132, ObjectType = 48128, + RequiresWidening = 786432, } interface Type { flags: TypeFlags; @@ -1123,6 +1132,7 @@ declare module ts { diagnostics?: boolean; emitBOM?: boolean; help?: boolean; + listFiles?: boolean; locale?: string; mapRoot?: string; module?: ModuleKind; @@ -1136,6 +1146,7 @@ declare module ts { out?: string; outDir?: string; preserveConstEnums?: boolean; + project?: string; removeComments?: boolean; sourceMap?: boolean; sourceRoot?: string; @@ -1168,6 +1179,7 @@ declare module ts { interface CommandLineOption { name: string; type: string | Map; + isFilePath?: boolean; shortName?: string; description?: DiagnosticMessage; paramType?: DiagnosticMessage; @@ -1428,6 +1440,7 @@ declare module ts { isOpen: boolean; version: string; scriptSnapshot: IScriptSnapshot; + nameTable: Map; getNamedDeclarations(): Declaration[]; } /** @@ -1470,6 +1483,7 @@ declare module ts { } interface LanguageServiceHost extends Logger { getCompilationSettings(): CompilerOptions; + getNewLine?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; getScriptIsOpen(fileName: string): boolean; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index c3725bdc367..0ea95acc9f6 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -280,6 +280,12 @@ var ts; ParserContextFlags[ParserContextFlags["HasAggregatedChildData"] = 64] = "HasAggregatedChildData"; })(ts.ParserContextFlags || (ts.ParserContextFlags = {})); var ParserContextFlags = ts.ParserContextFlags; + (function (RelationComparisonResult) { + RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded"; + RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed"; + RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; + })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); + var RelationComparisonResult = ts.RelationComparisonResult; (function (EmitReturnStatus) { EmitReturnStatus[EmitReturnStatus["Succeeded"] = 0] = "Succeeded"; EmitReturnStatus[EmitReturnStatus["AllOutputGenerationSkipped"] = 1] = "AllOutputGenerationSkipped"; @@ -407,11 +413,15 @@ var ts; TypeFlags[TypeFlags["Union"] = 16384] = "Union"; TypeFlags[TypeFlags["Anonymous"] = 32768] = "Anonymous"; TypeFlags[TypeFlags["FromSignature"] = 65536] = "FromSignature"; - TypeFlags[TypeFlags["Unwidened"] = 131072] = "Unwidened"; + TypeFlags[TypeFlags["ObjectLiteral"] = 131072] = "ObjectLiteral"; + TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 262144] = "ContainsUndefinedOrNull"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 524288] = "ContainsObjectLiteral"; TypeFlags[TypeFlags["Intrinsic"] = 127] = "Intrinsic"; + TypeFlags[TypeFlags["Primitive"] = 510] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; TypeFlags[TypeFlags["ObjectType"] = 48128] = "ObjectType"; + TypeFlags[TypeFlags["RequiresWidening"] = 786432] = "RequiresWidening"; })(ts.TypeFlags || (ts.TypeFlags = {})); var TypeFlags = ts.TypeFlags; (function (SignatureKind) { @@ -733,6 +743,19 @@ var ts; return result; } ts.clone = clone; + function extend(first, second) { + var result = {}; + for (var id in first) { + result[id] = first[id]; + } + for (var id in second) { + if (!hasProperty(result, id)) { + result[id] = second[id]; + } + } + return result; + } + ts.extend = extend; function forEachValue(map, callback) { var result; for (var id in map) { @@ -1054,7 +1077,7 @@ var ts; return path2; if (!(path2 && path2.length)) return path1; - if (path2.charAt(0) === ts.directorySeparator) + if (getRootLength(path2) !== 0) return path2; if (path1.charAt(path1.length - 1) === ts.directorySeparator) return path1 + path2; @@ -1224,6 +1247,32 @@ var ts; fileStream.Close(); } } + function getNames(collection) { + var result = []; + for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { + result.push(e.item().Name); + } + return result.sort(); + } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var folder = fso.GetFolder(path || "."); + var files = getNames(folder.files); + for (var i = 0; i < files.length; i++) { + var name = files[i]; + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(ts.combinePaths(path, name)); + } + } + var subfolders = getNames(folder.subfolders); + for (var i = 0; i < subfolders.length; i++) { + visitDirectory(ts.combinePaths(path, subfolders[i])); + } + } + } return { args: args, newLine: "\r\n", @@ -1253,6 +1302,7 @@ var ts; getCurrentDirectory: function () { return new ActiveXObject("WScript.Shell").CurrentDirectory; }, + readDirectory: readDirectory, exit: function (exitCode) { try { WScript.Quit(exitCode); @@ -1297,6 +1347,30 @@ var ts; } _fs.writeFileSync(fileName, data, "utf8"); } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var files = _fs.readdirSync(path || ".").sort(); + var directories = []; + for (var i = 0; i < files.length; i++) { + var name = ts.combinePaths(path, files[i]); + var stat = _fs.lstatSync(name); + if (stat.isFile()) { + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(name); + } + } + else if (stat.isDirectory()) { + directories.push(name); + } + } + for (var i = 0; i < directories.length; i++) { + visitDirectory(directories[i]); + } + } + } return { args: process.argv.slice(2), newLine: _os.EOL, @@ -1341,6 +1415,7 @@ var ts; getCurrentDirectory: function () { return process.cwd(); }, + readDirectory: readDirectory, getMemoryUsage: function () { if (global.gc) { global.gc(); @@ -1510,6 +1585,7 @@ var ts; Modifiers_cannot_appear_here: { code: 1184, category: 1 /* Error */, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: 1 /* Error */, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1 /* Error */, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1 /* Error */, key: "A parameter property may not be a binding pattern." }, Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* 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: 1 /* Error */, key: "Static members cannot reference class type parameters." }, @@ -1661,6 +1737,11 @@ var ts; Type_0_has_no_property_1: { code: 2460, category: 1 /* Error */, key: "Type '{0}' has no property '{1}'." }, Type_0_is_not_an_array_type: { code: 2461, category: 1 /* Error */, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1 /* Error */, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1 /* Error */, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: 1 /* Error */, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1 /* Error */, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1 /* Error */, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: 1 /* Error */, key: "A computed property name cannot reference a type parameter from its containing type." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* 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: 1 /* 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: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1733,19 +1814,22 @@ var ts; Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - Index_expression_arguments_in_const_enums_must_be_of_type_string: { code: 4085, category: 1 /* Error */, key: "Index expression arguments in 'const' enums must be of type 'string'." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: 1 /* Error */, key: "A const enum member can only be accessed using a string literal.", isEarly: true }, const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: 1 /* Error */, key: "Property '{0}' does not exist on 'const' enum '{1}'.", isEarly: true }, The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, Unsupported_file_encoding: { code: 5013, category: 1 /* Error */, key: "Unsupported file encoding." }, Unknown_compiler_option_0: { code: 5023, category: 1 /* Error */, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1 /* Error */, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: 1 /* Error */, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option mapRoot cannot be specified without specifying sourcemap option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option sourceRoot cannot be specified without specifying sourcemap option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1 /* Error */, key: "Option noEmit cannot be specified with option out or outDir." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1 /* Error */, key: "Option noEmit cannot be specified with option declaration." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1 /* Error */, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1 /* 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: 1 /* Error */, key: "Option 'project' cannot be mixed with source files on a command line." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2 /* Message */, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: 2 /* Message */, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2 /* Message */, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1760,6 +1844,7 @@ var ts; Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, Print_this_message: { code: 6017, category: 2 /* Message */, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: 2 /* Message */, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2 /* Message */, key: "Compile the project in the given directory." }, Syntax_Colon_0: { code: 6023, category: 2 /* Message */, key: "Syntax: {0}" }, options: { code: 6024, category: 2 /* Message */, key: "options" }, file: { code: 6025, category: 2 /* Message */, key: "file" }, @@ -1767,7 +1852,7 @@ var ts; Options_Colon: { code: 6027, category: 2 /* Message */, key: "Options:" }, Version_0: { code: 6029, category: 2 /* Message */, key: "Version {0}" }, Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2 /* Message */, key: "Insert command line options and files from a file." }, - File_change_detected_Compiling: { code: 6032, category: 2 /* Message */, key: "File change detected. Compiling..." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2 /* Message */, key: "File change detected. Starting incremental compilation..." }, KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, @@ -1783,7 +1868,7 @@ var ts; Unsupported_locale_0: { code: 6049, category: 1 /* Error */, key: "Unsupported locale '{0}'." }, Unable_to_open_file_0: { code: 6050, category: 1 /* Error */, key: "Unable to open file '{0}'." }, Corrupted_locale_file_0: { code: 6051, category: 1 /* Error */, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Warn on expressions and declarations with an implied 'any' type." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Raise error on expressions and declarations with an implied 'any' type." }, File_0_not_found: { code: 6053, category: 1 /* Error */, key: "File '{0}' not found." }, File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1 /* Error */, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2 /* Message */, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, @@ -1805,8 +1890,7 @@ var ts; 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: 1 /* 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." }, You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." }, yield_expressions_are_not_currently_supported: { code: 9000, category: 1 /* Error */, key: "'yield' expressions are not currently supported.", isEarly: true }, - Generators_are_not_currently_supported: { code: 9001, category: 1 /* Error */, key: "Generators are not currently supported.", isEarly: true }, - Computed_property_names_are_not_currently_supported: { code: 9002, category: 1 /* Error */, key: "Computed property names are not currently supported.", isEarly: true } + Generators_are_not_currently_supported: { code: 9001, category: 1 /* Error */, key: "Generators are not currently supported.", isEarly: true } }; })(ts || (ts = {})); var ts; @@ -1946,10 +2030,10 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierStart) : lookupInUnicodeMap(code, unicodeES5IdentifierStart); + return languageVersion >= 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion === 0 /* ES3 */ ? lookupInUnicodeMap(code, unicodeES3IdentifierPart) : lookupInUnicodeMap(code, unicodeES5IdentifierPart); + return languageVersion >= 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -1993,7 +2077,7 @@ var ts; } ts.computeLineStarts = computeLineStarts; function getPositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0); + ts.Debug.assert(line > 0 && line <= lineStarts.length); return lineStarts[line - 1] + character - 1; } ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; @@ -2657,7 +2741,7 @@ var ts; value = 0; } tokenValue = "" + value; - return 7 /* NumericLiteral */; + return token = 7 /* NumericLiteral */; } else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { pos += 2; @@ -2667,7 +2751,7 @@ var ts; value = 0; } tokenValue = "" + value; - return 7 /* NumericLiteral */; + return token = 7 /* NumericLiteral */; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); @@ -3225,6 +3309,12 @@ var ts; return undefined; } switch (node.kind) { + case 122 /* ComputedPropertyName */: + if (node.parent.parent.kind === 191 /* ClassDeclaration */) { + return node; + } + node = node.parent; + break; case 157 /* ArrowFunction */: if (!includeArrowFunctions) { continue; @@ -3246,13 +3336,24 @@ var ts; } } ts.getThisContainer = getThisContainer; - function getSuperContainer(node) { + function getSuperContainer(node, includeFunctions) { while (true) { node = node.parent; - if (!node) { - return undefined; - } + if (!node) + return node; switch (node.kind) { + case 122 /* ComputedPropertyName */: + if (node.parent.parent.kind === 191 /* ClassDeclaration */) { + return node; + } + node = node.parent; + break; + case 190 /* FunctionDeclaration */: + case 156 /* FunctionExpression */: + case 157 /* ArrowFunction */: + if (!includeFunctions) { + continue; + } case 126 /* PropertyDeclaration */: case 125 /* PropertySignature */: case 128 /* MethodDeclaration */: @@ -3345,6 +3446,8 @@ var ts; return node === parent.expression; case 169 /* TemplateSpan */: return node === parent.expression; + case 122 /* ComputedPropertyName */: + return node === parent.expression; default: if (isExpression(parent)) { return true; @@ -4563,7 +4666,7 @@ var ts; return canFollowModifier(); } function canFollowModifier() { - return token === 18 /* OpenBracketToken */ || token === 35 /* AsteriskToken */ || isLiteralPropertyName(); + return token === 18 /* OpenBracketToken */ || token === 14 /* OpenBraceToken */ || token === 35 /* AsteriskToken */ || isLiteralPropertyName(); } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -6892,7 +6995,7 @@ var ts; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; function getModuleInstanceState(node) { - if (node.kind === 192 /* InterfaceDeclaration */) { + if (node.kind === 192 /* InterfaceDeclaration */ || node.kind === 193 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { @@ -6925,10 +7028,10 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; - function hasComputedNameButNotSymbol(declaration) { + function hasDynamicName(declaration) { return declaration.name && declaration.name.kind === 122 /* ComputedPropertyName */; } - ts.hasComputedNameButNotSymbol = hasComputedNameButNotSymbol; + ts.hasDynamicName = hasDynamicName; function bindSourceFile(file) { var parent; var container; @@ -6964,7 +7067,7 @@ var ts; if (node.kind === 195 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { return '"' + node.name.text + '"'; } - ts.Debug.assert(!hasComputedNameButNotSymbol(node)); + ts.Debug.assert(!hasDynamicName(node)); return node.name.text; } switch (node.kind) { @@ -6984,9 +7087,7 @@ var ts; return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); } function declareSymbol(symbols, parent, node, includes, excludes) { - if (hasComputedNameButNotSymbol(node)) { - return undefined; - } + ts.Debug.assert(!hasDynamicName(node)); var name = getDeclarationName(node); if (name !== undefined) { var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); @@ -7205,14 +7306,14 @@ var ts; break; case 126 /* PropertyDeclaration */: case 125 /* PropertySignature */: - bindDeclaration(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0), 107455 /* PropertyExcludes */, false); + bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0), 107455 /* PropertyExcludes */, false); break; case 204 /* PropertyAssignment */: case 205 /* ShorthandPropertyAssignment */: - bindDeclaration(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); + bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); break; case 206 /* EnumMember */: - bindDeclaration(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); + bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); break; case 132 /* CallSignature */: case 133 /* ConstructSignature */: @@ -7221,7 +7322,7 @@ var ts; break; case 128 /* MethodDeclaration */: case 127 /* MethodSignature */: - bindDeclaration(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); + bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); break; case 190 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); @@ -7230,10 +7331,10 @@ var ts; bindDeclaration(node, 16384 /* Constructor */, 0, true); break; case 130 /* GetAccessor */: - bindDeclaration(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); + bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); break; case 131 /* SetAccessor */: - bindDeclaration(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); + bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); break; case 136 /* FunctionType */: case 137 /* ConstructorType */: @@ -7306,6 +7407,14 @@ var ts; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); } } + function bindPropertyOrMethodOrAccessor(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + if (hasDynamicName(node)) { + bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); + } + else { + bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer); + } + } } ts.bindSourceFile = bindSourceFile; })(ts || (ts = {})); @@ -7322,6 +7431,7 @@ var ts; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; var emitResolver = createResolver(); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, @@ -7367,8 +7477,8 @@ var ts; var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 131072 /* Unwidened */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 131072 /* Unwidened */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -7398,6 +7508,20 @@ var ts; var potentialThisCollisions = []; var diagnostics = []; var diagnosticsModified = false; + var primitiveTypeInfo = { + "string": { + type: stringType, + flags: 258 /* StringLike */ + }, + "number": { + type: numberType, + flags: 132 /* NumberLike */ + }, + "boolean": { + type: booleanType, + flags: 8 /* Boolean */ + } + }; function addDiagnostic(diagnostic) { diagnostics.push(diagnostic); diagnosticsModified = true; @@ -7614,6 +7738,15 @@ var ts; break loop; } break; + case 122 /* ComputedPropertyName */: + var grandparent = location.parent.parent; + if (grandparent.kind === 191 /* ClassDeclaration */ || grandparent.kind === 192 /* InterfaceDeclaration */) { + if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + return undefined; + } + } + break; case 128 /* MethodDeclaration */: case 127 /* MethodSignature */: case 129 /* Constructor */: @@ -8648,7 +8781,7 @@ var ts; } if (pattern.kind === 144 /* ObjectBindingPattern */) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericName(name.text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); + var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; @@ -8685,7 +8818,7 @@ var ts; } if (declaration.kind === 124 /* Parameter */) { var func = declaration.parent; - if (func.kind === 131 /* SetAccessor */ && !ts.hasComputedNameButNotSymbol(func)) { + if (func.kind === 131 /* SetAccessor */ && !ts.hasDynamicName(func)) { var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 130 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); @@ -9466,7 +9599,7 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 130 /* GetAccessor */ && !ts.hasComputedNameButNotSymbol(declaration)) { + if (declaration.kind === 130 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { var setter = ts.getDeclarationOfKind(declaration.symbol, 131 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } @@ -9628,14 +9761,18 @@ var ts; return result; } } - function getUnwidenedFlagOfTypes(types) { - return ts.forEach(types, function (t) { return t.flags & 131072 /* Unwidened */; }) || 0; + function getWideningFlagsOfTypes(types) { + var result = 0; + for (var i = 0; i < types.length; i++) { + result |= types[i].flags; + } + return result & 786432 /* RequiresWidening */; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | getUnwidenedFlagOfTypes(typeArguments); + var flags = 4096 /* Reference */ | getWideningFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -9852,7 +9989,7 @@ var ts; var id = getTypeListId(sortedTypes); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getUnwidenedFlagOfTypes(sortedTypes)); + type = unionTypes[id] = createObjectType(16384 /* Union */ | getWideningFlagsOfTypes(sortedTypes)); type.types = sortedTypes; } return type; @@ -10079,6 +10216,8 @@ var ts; case 128 /* MethodDeclaration */: case 127 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); + case 155 /* ParenthesizedExpression */: + return isContextSensitive(node.expression); } return false; } @@ -10139,6 +10278,10 @@ var ts; error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { + if (errorInfo.next === undefined) { + errorInfo = undefined; + isRelatedTo(source, target, errorNode !== undefined, headMessage, true); + } if (containingMessageChain) { errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } @@ -10148,7 +10291,8 @@ var ts; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } - function isRelatedTo(source, target, reportErrors, headMessage) { + function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } var result; if (source === target) return -1 /* True */; @@ -10217,7 +10361,7 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 /* ObjectType */ && target.flags & 48128 /* ObjectType */ && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { + if (sourceOrApparentType.flags & 48128 /* ObjectType */ && target.flags & 48128 /* ObjectType */ && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -10298,14 +10442,17 @@ var ts; return 0 /* False */; } } - function objectTypeRelatedTo(source, target, reportErrors) { + function objectTypeRelatedTo(source, target, reportErrors, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } if (overflow) { return 0 /* False */; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { - return related ? -1 /* True */ : 0 /* False */; + if (!elaborateErrors || (related === 3 /* FailedAndReported */)) { + return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; + } } if (depth > 0) { for (var i = 0; i < depth; i++) { @@ -10327,7 +10474,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; - maybeStack[depth][id] = true; + maybeStack[depth][id] = 1 /* Succeeded */; depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) @@ -10356,11 +10503,11 @@ var ts; depth--; if (result) { var maybeCache = maybeStack[depth]; - var destinationCache = result === -1 /* True */ || depth === 0 ? relation : maybeStack[depth - 1]; + var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { - relation[id] = false; + relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */; } return result; } @@ -10385,12 +10532,13 @@ var ts; } var result = -1 /* True */; var properties = getPropertiesOfObjectType(target); + var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072 /* ObjectLiteral */); for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (relation === subtypeRelation || !(targetProp.flags & 536870912 /* Optional */)) { + if (!(targetProp.flags & 536870912 /* Optional */) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } @@ -10735,9 +10883,6 @@ var ts; } checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); } - function isTypeOfObjectLiteral(type) { - return (type.flags & 32768 /* Anonymous */) && type.symbol && (type.symbol.flags & 4096 /* ObjectLiteral */) ? true : false; - } function isArrayType(type) { return type.flags & 4096 /* Reference */ && type.target === globalArrayType; } @@ -10748,14 +10893,19 @@ var ts; var properties = getPropertiesOfObjectType(type); var members = {}; ts.forEach(properties, function (p) { - var symbol = createSymbol(p.flags | 67108864 /* Transient */, p.name); - symbol.declarations = p.declarations; - symbol.parent = p.parent; - symbol.type = getWidenedType(getTypeOfSymbol(p)); - symbol.target = p; - if (p.valueDeclaration) - symbol.valueDeclaration = p.valueDeclaration; - members[symbol.name] = symbol; + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + var symbol = createSymbol(p.flags | 67108864 /* Transient */, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedType; + symbol.target = p; + if (p.valueDeclaration) + symbol.valueDeclaration = p.valueDeclaration; + p = symbol; + } + members[p.name] = p; }); var stringIndexType = getIndexTypeOfType(type, 0 /* String */); var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); @@ -10766,16 +10916,16 @@ var ts; return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); } function getWidenedType(type) { - if (type.flags & 131072 /* Unwidened */) { + if (type.flags & 786432 /* RequiresWidening */) { if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { return anyType; } + if (type.flags & 131072 /* ObjectLiteral */) { + return getWidenedTypeOfObjectLiteral(type); + } if (type.flags & 16384 /* Union */) { return getUnionType(ts.map(type.types, getWidenedType)); } - if (isTypeOfObjectLiteral(type)) { - return getWidenedTypeOfObjectLiteral(type); - } if (isArrayType(type)) { return createArrayType(getWidenedType(type.typeArguments[0])); } @@ -10795,11 +10945,11 @@ var ts; if (isArrayType(type)) { return reportWideningErrorsInType(type.typeArguments[0]); } - if (isTypeOfObjectLiteral(type)) { + if (type.flags & 131072 /* ObjectLiteral */) { var errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); - if (t.flags & 131072 /* Unwidened */) { + if (t.flags & 262144 /* ContainsUndefinedOrNull */) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -10839,7 +10989,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 131072 /* Unwidened */) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 262144 /* ContainsUndefinedOrNull */) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -11063,11 +11213,14 @@ var ts; } ts.Debug.fail("should not get here"); } - function subtractPrimitiveTypes(type, subtractMask) { + function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { if (type.flags & 16384 /* Union */) { var types = type.types; - if (ts.forEach(types, function (t) { return t.flags & subtractMask; })) { - return getUnionType(ts.filter(types, function (t) { return !(t.flags & subtractMask); })); + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); + if (narrowedType !== emptyObjectType) { + return narrowedType; + } } } return type; @@ -11212,7 +11365,7 @@ var ts; case 129 /* Constructor */: break loop; } - if (narrowedType !== type && isTypeSubtypeOf(narrowedType, type)) { + if (narrowedType !== type) { if (isVariableAssignedWithin(symbol, node)) { break; } @@ -11230,16 +11383,24 @@ var ts; if (left.expression.kind !== 64 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { return type; } - var t = right.text; - var checkType = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; + var typeInfo = primitiveTypeInfo[right.text]; if (expr.operator === 31 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } if (assumeTrue) { - return checkType === emptyObjectType ? subtractPrimitiveTypes(type, 2 /* String */ | 4 /* Number */ | 8 /* Boolean */) : checkType; + if (!typeInfo) { + return removeTypesFromUnionType(type, 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */, true); + } + if (isTypeSubtypeOf(typeInfo.type, type)) { + return typeInfo.type; + } + return removeTypesFromUnionType(type, typeInfo.flags, false); } else { - return checkType === emptyObjectType ? type : subtractPrimitiveTypes(type, checkType.flags); + if (typeInfo) { + return removeTypesFromUnionType(type, typeInfo.flags, true); + } + return type; } } function narrowTypeByAnd(type, expr, assumeTrue) { @@ -11276,8 +11437,14 @@ var ts; if (!prototypeProperty) { return type; } - var prototypeType = getTypeOfSymbol(prototypeProperty); - return isTypeSubtypeOf(prototypeType, type) ? prototypeType : type; + var targetType = getTypeOfSymbol(prototypeProperty); + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 16384 /* Union */) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } + return type; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { @@ -11375,6 +11542,9 @@ var ts; error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; + case 122 /* ComputedPropertyName */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); @@ -11386,26 +11556,6 @@ var ts; } return anyType; } - function getSuperContainer(node) { - while (true) { - node = node.parent; - if (!node) - return node; - switch (node.kind) { - case 190 /* FunctionDeclaration */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - return node; - } - } - } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { if (n.kind === 124 /* Parameter */) { @@ -11426,7 +11576,7 @@ var ts; error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); return unknownType; } - var container = getSuperContainer(node); + var container = ts.getSuperContainer(node, true); if (container) { var canUseSuperExpression = false; if (isCallExpression) { @@ -11435,7 +11585,7 @@ var ts; else { var needToCaptureLexicalThis = false; while (container && container.kind === 157 /* ArrowFunction */) { - container = getSuperContainer(container); + container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } if (container && container.parent && container.parent.kind === 191 /* ClassDeclaration */) { @@ -11467,7 +11617,10 @@ var ts; return returnType; } } - if (isCallExpression) { + if (container.kind === 122 /* ComputedPropertyName */) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + } + else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } else { @@ -11606,9 +11759,15 @@ var ts; function getContextualTypeForObjectLiteralElement(element) { var objectLiteral = element.parent; var type = getContextualType(objectLiteral); - var name = element.name.text; - if (type && name) { - return getTypeOfPropertyOfContextualType(type, name) || isNumericName(name) && getIndexTypeOfContextualType(type, 1 /* Number */) || getIndexTypeOfContextualType(type, 0 /* String */); + if (type) { + if (!ts.hasDynamicName(element)) { + var symbolName = getSymbolOfNode(element).name; + var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); + if (propertyType) { + return propertyType; + } + } + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1 /* Number */) || getIndexTypeOfContextualType(type, 0 /* String */); } return undefined; } @@ -11659,6 +11818,8 @@ var ts; case 169 /* TemplateSpan */: ts.Debug.assert(parent.parent.kind === 165 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 155 /* ParenthesizedExpression */: + return getContextualType(parent); } return undefined; } @@ -11763,72 +11924,84 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { + return name.kind === 122 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + } + function isNumericComputedName(name) { + return isTypeOfKind(checkComputedPropertyName(name), 1 /* Any */ | 132 /* NumberLike */); + } + function isNumericLiteralName(name) { return (+name).toString() === name; } + function checkComputedPropertyName(node) { + var links = getNodeLinks(node.expression); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node.expression); + if (!isTypeOfKind(links.resolvedType, 1 /* Any */ | 132 /* NumberLike */ | 258 /* StringLike */)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + } + } + return links.resolvedType; + } function checkObjectLiteral(node, contextualMapper) { checkGrammarObjectLiteralExpression(node); - var members = node.symbol.members; - var properties = {}; + var propertiesTable = {}; + var propertiesArray = []; var contextualType = getContextualType(node); var typeFlags; - for (var id in members) { - if (ts.hasProperty(members, id)) { - var member = members[id]; - if (member.flags & 4 /* Property */ || ts.isObjectLiteralMethod(member.declarations[0])) { - var memberDecl = member.declarations[0]; - if (memberDecl.kind === 204 /* PropertyAssignment */) { - var type = checkExpression(memberDecl.initializer, contextualMapper); - } - else if (memberDecl.kind === 128 /* MethodDeclaration */) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); - } - else { - ts.Debug.assert(memberDecl.kind === 205 /* ShorthandPropertyAssignment */); - var type = memberDecl.name.kind === 122 /* ComputedPropertyName */ ? unknownType : checkExpression(memberDecl.name, contextualMapper); - } - typeFlags |= type.flags; - var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); - prop.declarations = member.declarations; - prop.parent = member.parent; - if (member.valueDeclaration) { - prop.valueDeclaration = member.valueDeclaration; - } - prop.type = type; - prop.target = member; - member = prop; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; + var member = memberDecl.symbol; + if (memberDecl.kind === 204 /* PropertyAssignment */ || memberDecl.kind === 205 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 204 /* PropertyAssignment */) { + var type = checkPropertyAssignment(memberDecl, contextualMapper); + } + else if (memberDecl.kind === 128 /* MethodDeclaration */) { + var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - var getAccessor = ts.getDeclarationOfKind(member, 130 /* GetAccessor */); - if (getAccessor) { - checkAccessorDeclaration(getAccessor); - } - var setAccessor = ts.getDeclarationOfKind(member, 131 /* SetAccessor */); - if (setAccessor) { - checkAccessorDeclaration(setAccessor); - } + ts.Debug.assert(memberDecl.kind === 205 /* ShorthandPropertyAssignment */); + var type = memberDecl.name.kind === 122 /* ComputedPropertyName */ ? unknownType : checkExpression(memberDecl.name, contextualMapper); } - properties[member.name] = member; + typeFlags |= type.flags; + var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); + prop.declarations = member.declarations; + prop.parent = member.parent; + if (member.valueDeclaration) { + prop.valueDeclaration = member.valueDeclaration; + } + prop.type = type; + prop.target = member; + member = prop; } + else { + ts.Debug.assert(memberDecl.kind === 130 /* GetAccessor */ || memberDecl.kind === 131 /* SetAccessor */); + checkAccessorDeclaration(memberDecl); + } + if (!ts.hasDynamicName(memberDecl)) { + propertiesTable[member.name] = member; + } + propertiesArray.push(member); } var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); - var result = createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= (typeFlags & 131072 /* Unwidened */); + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + result.flags |= 131072 /* ObjectLiteral */ | 524288 /* ContainsObjectLiteral */ | (typeFlags & 262144 /* ContainsUndefinedOrNull */); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { var propTypes = []; - for (var id in properties) { - if (ts.hasProperty(properties, id)) { - if (kind === 0 /* String */ || isNumericName(id)) { - var type = getTypeOfSymbol(properties[id]); - if (!ts.contains(propTypes, type)) { - propTypes.push(type); - } + for (var i = 0; i < propertiesArray.length; i++) { + var propertyDecl = node.properties[i]; + if (kind === 0 /* String */ || isNumericName(propertyDecl.name)) { + var type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, type)) { + propTypes.push(type); } } } - return propTypes.length ? getUnionType(propTypes) : undefinedType; + var result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= result.flags; + return result; } return undefined; } @@ -11939,8 +12112,10 @@ var ts; if (objectType === unknownType) { return unknownType; } - if (isConstEnumObjectType(objectType) && node.argumentExpression && node.argumentExpression.kind !== 8 /* StringLiteral */) { - error(node.argumentExpression, ts.Diagnostics.Index_expression_arguments_in_const_enums_must_be_of_type_string); + var isConstEnum = isConstEnumObjectType(objectType); + if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8 /* StringLiteral */)) { + error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + return unknownType; } if (node.argumentExpression) { if (node.argumentExpression.kind === 8 /* StringLiteral */ || node.argumentExpression.kind === 7 /* NumericLiteral */) { @@ -11950,10 +12125,14 @@ var ts; getNodeLinks(node).resolvedSymbol = prop; return getTypeOfSymbol(prop); } + else if (isConstEnum) { + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + return unknownType; + } } } - if (indexType.flags & (1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { - if (indexType.flags & (1 /* Any */ | 132 /* NumberLike */)) { + if (isTypeOfKind(indexType, 1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { + if (isTypeOfKind(indexType, 1 /* Any */ | 132 /* NumberLike */)) { var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); if (numberIndexType) { return numberIndexType; @@ -12137,10 +12316,25 @@ var ts; } return args; } + function getEffectiveTypeArguments(callExpression) { + if (callExpression.expression.kind === 90 /* SuperKeyword */) { + var containingClass = ts.getAncestor(callExpression, 191 /* ClassDeclaration */); + var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + return baseClassTypeNode && baseClassTypeNode.typeArguments; + } + else { + return callExpression.typeArguments; + } + } function resolveCall(node, signatures, candidatesOutArray) { var isTaggedTemplate = node.kind === 153 /* TaggedTemplateExpression */; - var typeArguments = isTaggedTemplate ? undefined : node.typeArguments; - ts.forEach(typeArguments, checkSourceElement); + var typeArguments; + if (!isTaggedTemplate) { + typeArguments = getEffectiveTypeArguments(node); + if (node.expression.kind !== 90 /* SuperKeyword */) { + ts.forEach(typeArguments, checkSourceElement); + } + } var candidates = candidatesOutArray || []; collectCandidates(); if (!candidates.length) { @@ -12257,8 +12451,10 @@ var ts; var result = candidates; var lastParent; var lastSymbol; - var cutoffPos = 0; - var pos; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; ts.Debug.assert(!result.length); for (var i = 0; i < signatures.length; i++) { var signature = signatures[i]; @@ -12266,22 +12462,27 @@ var ts; var parent = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { if (lastParent && parent === lastParent) { - pos++; + index++; } else { lastParent = parent; - pos = cutoffPos; + index = cutoffIndex; } } else { - pos = cutoffPos = result.length; + index = cutoffIndex = result.length; lastParent = parent; } lastSymbol = symbol; - for (var j = result.length; j > pos; j--) { - result[j] = result[j - 1]; + if (signature.hasStringLiterals) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; } - result[pos] = signature; + else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, signature); } } } @@ -12397,7 +12598,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { grammarErrorOnFirstToken(node.template, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); } return getReturnTypeOfSignature(getResolvedSignature(node)); @@ -12546,7 +12747,7 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic) { - if (!(type.flags & (1 /* Any */ | 132 /* NumberLike */))) { + if (!isTypeOfKind(type, 1 /* Any */ | 132 /* NumberLike */)) { error(operand, diagnostic); return false; } @@ -12650,11 +12851,20 @@ var ts; } return numberType; } - function isStructuredType(type) { - if (type.flags & 16384 /* Union */) { - return !ts.forEach(type.types, function (t) { return !isStructuredType(t); }); + function isTypeOfKind(type, kind) { + if (type.flags & kind) { + return true; } - return (type.flags & (48128 /* ObjectType */ | 512 /* TypeParameter */)) !== 0; + if (type.flags & 16384 /* Union */) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (!(types[i].flags & kind)) { + return false; + } + } + return true; + } + return false; } function isConstEnumObjectType(type) { return type.flags & (48128 /* ObjectType */ | 32768 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); @@ -12663,7 +12873,7 @@ var ts; return (symbol.flags & 128 /* ConstEnum */) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (!(leftType.flags & 1 /* Any */ || isStructuredType(leftType))) { + if (isTypeOfKind(leftType, 510 /* Primitive */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(rightType.flags & 1 /* Any */ || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -12672,10 +12882,10 @@ var ts; return booleanType; } function checkInExpression(node, leftType, rightType) { - if (leftType !== anyType && leftType !== stringType && leftType !== numberType) { + if (!isTypeOfKind(leftType, 1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); } - if (!(rightType.flags & 1 /* Any */ || isStructuredType(rightType))) { + if (!isTypeOfKind(rightType, 1 /* Any */ | 48128 /* ObjectType */ | 512 /* TypeParameter */)) { error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -12686,7 +12896,7 @@ var ts; var p = properties[i]; if (p.kind === 204 /* PropertyAssignment */ || p.kind === 205 /* ShorthandPropertyAssignment */) { var name = p.name; - var type = sourceType.flags & 1 /* Any */ ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericName(name.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); + var type = sourceType.flags & 1 /* Any */ ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -12805,13 +13015,13 @@ var ts; if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) rightType = leftType; var resultType; - if (leftType.flags & 132 /* NumberLike */ && rightType.flags & 132 /* NumberLike */) { + if (isTypeOfKind(leftType, 132 /* NumberLike */) && isTypeOfKind(rightType, 132 /* NumberLike */)) { resultType = numberType; } - else if (leftType.flags & 258 /* StringLike */ || rightType.flags & 258 /* StringLike */) { + else if (isTypeOfKind(leftType, 258 /* StringLike */) || isTypeOfKind(rightType, 258 /* StringLike */)) { resultType = stringType; } - else if (leftType.flags & 1 /* Any */ || leftType === unknownType || rightType.flags & 1 /* Any */ || rightType === unknownType) { + else if (leftType.flags & 1 /* Any */ || rightType.flags & 1 /* Any */) { resultType = anyType; } if (!resultType) { @@ -12909,8 +13119,17 @@ var ts; } return links.resolvedType; } + function checkPropertyAssignment(node, contextualMapper) { + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } + return checkExpression(node.initializer, contextualMapper); + } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } @@ -13033,12 +13252,15 @@ var ts; checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */)) { + if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); if (!(func.kind === 129 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } + if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { + error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); + } if (node.dotDotDotToken) { if (!isArrayType(getTypeOfSymbol(node.symbol))) { error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); @@ -13183,7 +13405,7 @@ var ts; error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } - if (!ts.hasComputedNameButNotSymbol(node)) { + if (!ts.hasDynamicName(node)) { var otherKind = node.kind === 130 /* GetAccessor */ ? 131 /* SetAccessor */ : 130 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { @@ -13198,8 +13420,8 @@ var ts; } } } - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); } + checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); } @@ -13507,7 +13729,10 @@ var ts; } function checkFunctionLikeDeclaration(node) { checkSignatureDeclaration(node); - if (!ts.hasComputedNameButNotSymbol(node)) { + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } + else { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); @@ -13661,7 +13886,8 @@ var ts; } function checkVariableLikeDeclaration(node) { checkSourceElement(node.type); - if (ts.hasComputedNameButNotSymbol(node)) { + if (ts.hasDynamicName(node)) { + checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } @@ -13805,7 +14031,7 @@ var ts; } } var exprType = checkExpression(node.expression); - if (!(exprType.flags & 1 /* Any */ || isStructuredType(exprType))) { + if (!isTypeOfKind(exprType, 1 /* Any */ | 48128 /* ObjectType */ | 512 /* TypeParameter */)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -13925,29 +14151,6 @@ var ts; checkBlock(node.finallyBlock); } function checkIndexConstraints(type) { - function checkIndexConstraintForProperty(prop, propertyType, indexDeclaration, indexType, indexKind) { - if (!indexType) { - return; - } - if (indexKind === 1 /* Number */ && !isNumericName(prop.name)) { - return; - } - var errorNode; - if (prop.parent === type.symbol) { - errorNode = prop.valueDeclaration; - } - else if (indexDeclaration) { - errorNode = indexDeclaration; - } - else if (type.flags & 2048 /* Interface */) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(type.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); - errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : type.symbol.declarations[0]; - } - if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 /* String */ ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); - } - } var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1 /* Number */); var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0 /* String */); var stringIndexType = getIndexTypeOfType(type, 0 /* String */); @@ -13955,9 +14158,20 @@ var ts; if (stringIndexType || numberIndexType) { ts.forEach(getPropertiesOfObjectType(type), function (prop) { var propType = getTypeOfSymbol(prop); - checkIndexConstraintForProperty(prop, propType, declaredStringIndexer, stringIndexType, 0 /* String */); - checkIndexConstraintForProperty(prop, propType, declaredNumberIndexer, numberIndexType, 1 /* Number */); + checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); + checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); }); + if (type.flags & 1024 /* Class */ && type.symbol.valueDeclaration.kind === 191 /* ClassDeclaration */) { + var classDeclaration = type.symbol.valueDeclaration; + for (var i = 0; i < classDeclaration.members.length; i++) { + var member = classDeclaration.members[i]; + if (!(member.flags & 128 /* Static */) && ts.hasDynamicName(member)) { + var propType = getTypeOfSymbol(member.symbol); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); + } + } + } } var errorNode; if (stringIndexType && numberIndexType) { @@ -13970,6 +14184,29 @@ var ts; if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) { error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)); } + function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) { + if (!indexType) { + return; + } + if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) { + return; + } + var errorNode; + if (prop.valueDeclaration.name.kind === 122 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + errorNode = prop.valueDeclaration; + } + else if (indexDeclaration) { + errorNode = indexDeclaration; + } + else if (containingType.flags & 2048 /* Interface */) { + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + } + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 /* String */ ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + } + } } function checkTypeNameIsReserved(name, message) { switch (name.text) { @@ -14198,7 +14435,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (isNumericName(member.name.text)) { + if (member.name.kind !== 122 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -15162,8 +15399,8 @@ var ts; if (symbol && (symbol.flags & 8 /* EnumMember */)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 206 /* EnumMember */ && (constantValue = getNodeLinks(declaration).enumMemberValue) !== undefined) { - return constantValue; + if (declaration.kind === 206 /* EnumMember */) { + return getEnumMemberValue(declaration); } } return undefined; @@ -15222,7 +15459,7 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTemplateStringsArrayType = compilerOptions.target >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; + globalTemplateStringsArrayType = languageVersion >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; anyArrayType = createArrayType(anyType); } function checkGrammarModifiers(node) { @@ -15346,6 +15583,9 @@ var ts; else if (node.kind === 192 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } + else if (node.kind === 124 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); + } } function checkGrammarForDisallowedTrailingComma(list) { if (list && list.hasTrailingComma) { @@ -15530,16 +15770,14 @@ var ts; } function checkGrammarComputedPropertyName(node) { if (node.kind !== 122 /* ComputedPropertyName */) { - return; + return false; } - grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_not_currently_supported); - return; var computedPropertyName = node; - if (compilerOptions.target < 2 /* ES6 */) { - grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); + if (languageVersion < 2 /* ES6 */) { + return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); } else if (computedPropertyName.expression.kind === 163 /* BinaryExpression */ && computedPropertyName.expression.operator === 23 /* CommaToken */) { - grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { @@ -15615,7 +15853,7 @@ var ts; } function checkGrammarAccessor(accessor) { var kind = accessor.kind; - if (compilerOptions.target < 1 /* ES5 */) { + if (languageVersion < 1 /* ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } else if (ts.isInAmbientContext(accessor)) { @@ -15780,7 +16018,7 @@ var ts; if (!declarationList.declarations.length) { return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); } - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { if (ts.isLet(declarationList)) { return grammarErrorOnFirstToken(declarationList, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); } @@ -15863,7 +16101,7 @@ var ts; function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var scanner = ts.createScanner(compilerOptions.target, true, sourceFile.text); + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); var start = scanToken(scanner, node.pos); diagnostics.push(ts.createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); return true; @@ -15963,7 +16201,7 @@ var ts; if (node.parserContextFlags & 1 /* StrictMode */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } - else if (compilerOptions.target >= 1 /* ES5 */) { + else if (languageVersion >= 1 /* ES5 */) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -15971,7 +16209,7 @@ var ts; function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var scanner = ts.createScanner(compilerOptions.target, true, sourceFile.text); + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); scanToken(scanner, node.pos); diagnostics.push(ts.createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); return true; @@ -16098,9 +16336,10 @@ var ts; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos); + var lastLine = currentSourceFile.getLineStarts().length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, 1); + var nextLineStart = currentLine === lastLine ? (comment.end + 1) : currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, 1); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { firstCommentLineIndent = calculateIndent(currentSourceFile.getPositionFromLineAndCharacter(firstCommentLineAndCharacter.line, 1), comment.pos); @@ -16220,6 +16459,7 @@ var ts; function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; var write; var writeLine; var increaseIndent; @@ -16712,6 +16952,9 @@ var ts; } } function emitPropertyDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } emitJsDocComments(node); emitClassMemberDeclarationFlags(node); emitVariableDeclaration(node); @@ -16780,6 +17023,9 @@ var ts; } } function emitAccessorDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } var accessors = getAllAccessorDeclarations(node.parent, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); @@ -16837,6 +17083,9 @@ var ts; } } function emitFunctionDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } if ((node.kind !== 190 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); if (node.kind === 190 /* FunctionDeclaration */) { @@ -17088,6 +17337,7 @@ var ts; ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitFiles(resolver, host, targetSourceFile) { var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0 /* ES3 */; var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; var diagnostics = []; var newLine = host.getNewLine(); @@ -17244,7 +17494,11 @@ var ts; if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - scopeName = sourceMapData.sourceMapNames[parentIndex] + "." + scopeName; + var name = node.name; + if (!name || name.kind !== 122 /* ComputedPropertyName */) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; } scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); if (scopeNameIndex === undefined) { @@ -17260,7 +17514,8 @@ var ts; } else if (node.kind === 190 /* FunctionDeclaration */ || node.kind === 156 /* FunctionExpression */ || node.kind === 128 /* MethodDeclaration */ || node.kind === 127 /* MethodSignature */ || node.kind === 130 /* GetAccessor */ || node.kind === 131 /* SetAccessor */ || node.kind === 195 /* ModuleDeclaration */ || node.kind === 191 /* ClassDeclaration */ || node.kind === 194 /* EnumDeclaration */) { if (node.name) { - scopeName = node.name.text; + var name = node.name; + scopeName = name.kind === 122 /* ComputedPropertyName */ ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -17480,11 +17735,11 @@ var ts; return false; } function emitLiteral(node) { - var text = compilerOptions.target < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; + var text = languageVersion < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; if (compilerOptions.sourceMap && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } - else if (compilerOptions.target < 2 /* ES6 */ && node.kind === 7 /* NumericLiteral */ && isBinaryOrOctalIntegerLiteral(text)) { + else if (languageVersion < 2 /* ES6 */ && node.kind === 7 /* NumericLiteral */ && isBinaryOrOctalIntegerLiteral(text)) { write(node.text); } else { @@ -17495,7 +17750,7 @@ var ts; return '"' + ts.escapeString(node.text) + '"'; } function emitTemplateExpression(node) { - if (compilerOptions.target >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES6 */) { ts.forEachChild(node, emit); return; } @@ -17542,7 +17797,7 @@ var ts; } } function comparePrecedenceToBinaryPlus(expression) { - ts.Debug.assert(compilerOptions.target <= 1 /* ES5 */); + ts.Debug.assert(languageVersion < 2 /* ES6 */); switch (expression.kind) { case 163 /* BinaryExpression */: switch (expression.operator) { @@ -17708,7 +17963,7 @@ var ts; write("[]"); return; } - if (compilerOptions.target >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES6 */) { write("["); emitList(elements, 0, elements.length, (node.flags & 256 /* MultiLine */) !== 0, elements.hasTrailingComma); write("]"); @@ -17753,7 +18008,7 @@ var ts; if (!multiLine) { write(" "); } - emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && compilerOptions.target >= 1 /* ES5 */); + emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && languageVersion >= 1 /* ES5 */); if (!multiLine) { write(" "); } @@ -17766,32 +18021,23 @@ var ts; write("]"); } function emitMethod(node) { - if (!ts.isObjectLiteralMethod(node)) { - return; - } - emitLeadingComments(node); emit(node.name); - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { write(": function "); } emitSignatureAndBody(node); - emitTrailingComments(node); } function emitPropertyAssignment(node) { - emitLeadingComments(node); emit(node.name); write(": "); emit(node.initializer); - emitTrailingComments(node); } function emitShorthandPropertyAssignment(node) { - emitLeadingComments(node); emit(node.name); - if (compilerOptions.target < 2 /* ES6 */ || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion < 2 /* ES6 */ || resolver.getExpressionNamePrefix(node.name)) { write(": "); emitExpressionIdentifier(node.name); } - emitTrailingComments(node); } function tryEmitConstantValue(node) { var constantValue = resolver.getConstantValue(node); @@ -17859,7 +18105,7 @@ var ts; } } function emitTaggedTemplateExpression(node) { - ts.Debug.assert(compilerOptions.target >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); + ts.Debug.assert(languageVersion >= 2 /* ES6 */, "Trying to emit a tagged template in pre-ES6 mode."); emit(node.tag); write(" "); emit(node.template); @@ -17912,7 +18158,7 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (compilerOptions.target < 2 /* ES6 */ && node.operator === 52 /* EqualsToken */ && (node.left.kind === 148 /* ObjectLiteralExpression */ || node.left.kind === 147 /* ArrayLiteralExpression */)) { + if (languageVersion < 2 /* ES6 */ && node.operator === 52 /* EqualsToken */ && (node.left.kind === 148 /* ObjectLiteralExpression */ || node.left.kind === 147 /* ArrayLiteralExpression */)) { emitDestructuring(node); } else { @@ -17961,13 +18207,10 @@ var ts; } } function emitExpressionStatement(node) { - emitLeadingComments(node); emitParenthesized(node.expression, node.expression.kind === 157 /* ArrowFunction */); write(";"); - emitTrailingComments(node); } function emitIfStatement(node) { - emitLeadingComments(node); var endPos = emitToken(83 /* IfKeyword */, node.pos); write(" "); endPos = emitToken(16 /* OpenParenToken */, endPos); @@ -17985,7 +18228,6 @@ var ts; emitEmbeddedStatement(node.elseStatement); } } - emitTrailingComments(node); } function emitDoStatement(node) { write("do"); @@ -18067,11 +18309,9 @@ var ts; write(";"); } function emitReturnStatement(node) { - emitLeadingComments(node); emitToken(89 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); - emitTrailingComments(node); } function emitWithStatement(node) { write("with ("); @@ -18352,9 +18592,8 @@ var ts; } } function emitVariableDeclaration(node) { - emitLeadingComments(node); if (ts.isBindingPattern(node.name)) { - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { emitDestructuring(node); } else { @@ -18366,10 +18605,8 @@ var ts; emitModuleMemberName(node); emitOptional(" = ", node.initializer); } - emitTrailingComments(node); } function emitVariableStatement(node) { - emitLeadingComments(node); if (!(node.flags & 1 /* Export */)) { if (ts.isLet(node.declarationList)) { write("let "); @@ -18383,11 +18620,9 @@ var ts; } emitCommaList(node.declarationList.declarations); write(";"); - emitTrailingComments(node); } function emitParameter(node) { - emitLeadingComments(node); - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { if (ts.isBindingPattern(node.name)) { var name = createTempVariable(node); if (!tempParameters) { @@ -18407,10 +18642,9 @@ var ts; emit(node.name); emitOptional(" = ", node.initializer); } - emitTrailingComments(node); } function emitDefaultValueAssignments(node) { - if (compilerOptions.target < 2 /* ES6 */) { + if (languageVersion < 2 /* ES6 */) { var tempIndex = 0; ts.forEach(node.parameters, function (p) { if (ts.isBindingPattern(p.name)) { @@ -18439,7 +18673,7 @@ var ts; } } function emitRestParameter(node) { - if (compilerOptions.target < 2 /* ES6 */ && ts.hasRestParameters(node)) { + if (languageVersion < 2 /* ES6 */ && ts.hasRestParameters(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; var tempName = createTempVariable(node, true).text; @@ -18477,11 +18711,9 @@ var ts; } } function emitAccessor(node) { - emitLeadingComments(node); write(node.kind === 130 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); - emitTrailingComments(node); } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { @@ -18512,7 +18744,7 @@ var ts; write("("); if (node) { var parameters = node.parameters; - var omitCount = compilerOptions.target < 2 /* ES6 */ && ts.hasRestParameters(node) ? 1 : 0; + var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameters(node) ? 1 : 0; emitList(parameters, 0, parameters.length - omitCount, false, false); } write(")"); @@ -18543,7 +18775,7 @@ var ts; write(" "); emitStart(node.body); write("return "); - emitNode(node.body); + emitNode(node.body, true); emitEnd(node.body); write(";"); emitTempDeclarations(false); @@ -18560,7 +18792,7 @@ var ts; writeLine(); emitLeadingComments(node.body); write("return "); - emit(node.body); + emit(node.body, true); write(";"); emitTrailingComments(node.body); } @@ -18734,7 +18966,6 @@ var ts; }); } function emitClassDeclaration(node) { - emitLeadingComments(node); write("var "); emit(node.name); write(" = (function ("); @@ -18784,7 +19015,6 @@ var ts; emitEnd(node); write(";"); } - emitTrailingComments(node); function emitConstructorOfClass() { var saveTempCount = tempCount; var saveTempVariables = tempVariables; @@ -18859,12 +19089,14 @@ var ts; function emitInterfaceDeclaration(node) { emitPinnedOrTripleSlashComments(node); } - function emitEnumDeclaration(node) { + function shouldEmitEnumDeclaration(node) { var isConstEnum = ts.isConst(node); - if (isConstEnum && !compilerOptions.preserveConstEnums) { + return !isConstEnum || compilerOptions.preserveConstEnums; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { return; } - emitLeadingComments(node); if (!(node.flags & 1 /* Export */)) { emitStart(node); write("var "); @@ -18881,7 +19113,7 @@ var ts; write(") {"); increaseIndent(); scopeEmitStart(node); - emitEnumMemberDeclarations(isConstEnum); + emitLines(node.members); decreaseIndent(); writeLine(); emitToken(15 /* CloseBraceToken */, node.members.end); @@ -18902,31 +19134,26 @@ var ts; emitEnd(node); write(";"); } - emitTrailingComments(node); - function emitEnumMemberDeclarations(isConstEnum) { - ts.forEach(node.members, function (member) { - writeLine(); - emitLeadingComments(member); - emitStart(member); - write(resolver.getLocalNameOfContainer(node)); - write("["); - write(resolver.getLocalNameOfContainer(node)); - write("["); - emitExpressionForPropertyName(member.name); - write("] = "); - if (member.initializer && !isConstEnum) { - emit(member.initializer); - } - else { - write(resolver.getEnumMemberValue(member).toString()); - } - write("] = "); - emitExpressionForPropertyName(member.name); - emitEnd(member); - write(";"); - emitTrailingComments(member); - }); + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + if (node.initializer && !ts.isConst(enumParent)) { + emit(node.initializer); } + else { + write(resolver.getEnumMemberValue(node).toString()); + } + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { if (moduleDeclaration.body.kind === 195 /* ModuleDeclaration */) { @@ -18934,12 +19161,14 @@ var ts; return recursiveInnerModule || moduleDeclaration.body; } } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + } function emitModuleDeclaration(node) { - var shouldEmit = ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { return emitPinnedOrTripleSlashComments(node); } - emitLeadingComments(node); emitStart(node); write("var "); emit(node.name); @@ -18984,7 +19213,6 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - emitTrailingComments(node); } function emitImportDeclaration(node) { var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); @@ -19157,13 +19385,38 @@ var ts; } emitLeadingComments(node.endOfFileToken); } - function emitNode(node) { + function emitNode(node, disableComments) { if (!node) { return; } if (node.flags & 2 /* Ambient */) { return emitPinnedOrTripleSlashComments(node); } + var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { + emitLeadingComments(node); + } + emitJavaScriptWorker(node); + if (emitComments) { + emitTrailingComments(node); + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 192 /* InterfaceDeclaration */: + case 190 /* FunctionDeclaration */: + case 197 /* ImportDeclaration */: + case 193 /* TypeAliasDeclaration */: + case 198 /* ExportAssignment */: + return false; + case 195 /* ModuleDeclaration */: + return shouldEmitModuleDeclaration(node); + case 194 /* EnumDeclaration */: + return shouldEmitEnumDeclaration(node); + } + return true; + } + function emitJavaScriptWorker(node) { switch (node.kind) { case 64 /* Identifier */: return emitIdentifier(node); @@ -19300,6 +19553,8 @@ var ts; return emitInterfaceDeclaration(node); case 194 /* EnumDeclaration */: return emitEnumDeclaration(node); + case 206 /* EnumMember */: + return emitEnumMember(node); case 195 /* ModuleDeclaration */: return emitModuleDeclaration(node); case 197 /* ImportDeclaration */: @@ -19322,15 +19577,17 @@ var ts; return leadingComments; } function getLeadingCommentsToEmit(node) { - if (node.parent.kind === 207 /* SourceFile */ || node.pos !== node.parent.pos) { - var leadingComments; - if (hasDetachedComments(node.pos)) { - leadingComments = getLeadingCommentsWithoutDetachedComments(); + if (node.parent) { + if (node.parent.kind === 207 /* SourceFile */ || node.pos !== node.parent.pos) { + var leadingComments; + if (hasDetachedComments(node.pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + return leadingComments; } - else { - leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); - } - return leadingComments; } } function emitLeadingDeclarationComments(node) { @@ -19339,9 +19596,11 @@ var ts; emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); } function emitTrailingDeclarationComments(node) { - if (node.parent.kind === 207 /* SourceFile */ || node.end !== node.parent.end) { - var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); - emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + if (node.parent) { + if (node.parent.kind === 207 /* SourceFile */ || node.end !== node.parent.end) { + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } } } function emitLeadingCommentsOfLocalPosition(pos) { @@ -19779,7 +20038,7 @@ var ts; return; } var firstExternalModule = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); - if (firstExternalModule && options.module === 0 /* None */) { + if (firstExternalModule && !options.module) { var externalModuleErrorSpan = ts.getErrorSpanForNode(firstExternalModule.externalModuleIndicator); var errorStart = ts.skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); var errorLength = externalModuleErrorSpan.end - errorStart; @@ -19859,6 +20118,10 @@ var ts; type: "boolean", description: ts.Diagnostics.Print_this_message }, + { + name: "listFiles", + type: "boolean" + }, { name: "locale", type: "string" @@ -19866,6 +20129,7 @@ var ts; { name: "mapRoot", type: "string", + isFilePath: true, description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, paramType: ts.Diagnostics.LOCATION }, @@ -19916,6 +20180,7 @@ var ts; { name: "outDir", type: "string", + isFilePath: true, description: ts.Diagnostics.Redirect_output_structure_to_the_directory, paramType: ts.Diagnostics.DIRECTORY }, @@ -19924,6 +20189,14 @@ var ts; type: "boolean", description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Compile_the_project_in_the_given_directory, + paramType: ts.Diagnostics.DIRECTORY + }, { name: "removeComments", type: "boolean", @@ -19937,6 +20210,7 @@ var ts; { name: "sourceRoot", type: "string", + isFilePath: true, description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, paramType: ts.Diagnostics.LOCATION }, @@ -19966,21 +20240,18 @@ var ts; description: ts.Diagnostics.Watch_input_files } ]; - var shortOptionNames = {}; - var optionNameMap = {}; - ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap[option.name.toLowerCase()] = option; - if (option.shortName) { - shortOptionNames[option.shortName] = option.name; - } - }); function parseCommandLine(commandLine) { - var options = { - target: 0 /* ES3 */, - module: 0 /* None */ - }; + var options = {}; var filenames = []; var errors = []; + var shortOptionNames = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name.toLowerCase()] = option; + if (option.shortName) { + shortOptionNames[option.shortName] = option.name; + } + }); parseStrings(commandLine); return { options: options, @@ -20070,6 +20341,83 @@ var ts; } } ts.parseCommandLine = parseCommandLine; + function readConfigFile(filename) { + try { + var text = ts.sys.readFile(filename); + return /\S/.test(text) ? JSON.parse(text) : {}; + } + catch (e) { + } + } + ts.readConfigFile = readConfigFile; + function parseConfigFile(json, basePath) { + var errors = []; + return { + options: getCompilerOptions(), + filenames: getFiles(), + errors: errors + }; + function getCompilerOptions() { + var options = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name] = option; + }); + var jsonOptions = json["compilerOptions"]; + if (jsonOptions) { + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + var optType = opt.type; + var value = jsonOptions[id]; + var expectedType = typeof optType === "string" ? optType : "string"; + if (typeof value === expectedType) { + if (typeof optType !== "string") { + var key = value.toLowerCase(); + if (ts.hasProperty(optType, key)) { + value = optType[key]; + } + else { + errors.push(ts.createCompilerDiagnostic(opt.error)); + value = 0; + } + } + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + } + options[opt.name] = value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); + } + } + } + return options; + } + function getFiles() { + var files = []; + if (ts.hasProperty(json, "files")) { + if (json["files"] instanceof Array) { + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + } + } + else { + var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + for (var i = 0; i < sysFiles.length; i++) { + var name = sysFiles[i]; + if (!ts.fileExtensionIs(name, ".d.ts") || !ts.contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { + files.push(name); + } + } + } + return files; + } + } + ts.parseConfigFile = parseConfigFile; })(ts || (ts = {})); var ts; (function (ts) { @@ -20205,8 +20553,9 @@ var ts; case 145 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; + case 146 /* BindingElement */: case 188 /* VariableDeclaration */: - if (ts.isBindingPattern(node)) { + if (ts.isBindingPattern(node.name)) { visit(node.name); break; } @@ -20353,17 +20702,30 @@ var ts; case 190 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); case 188 /* VariableDeclaration */: - if (ts.isBindingPattern(node.name)) { - break; - } - if (ts.isConst(node)) { - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.constElement); - } - else if (ts.isLet(node)) { - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.letElement); + case 146 /* BindingElement */: + var variableDeclarationNode; + var name; + if (node.kind === 146 /* BindingElement */) { + name = node.name; + variableDeclarationNode = node; + while (variableDeclarationNode && variableDeclarationNode.kind !== 188 /* VariableDeclaration */) { + variableDeclarationNode = variableDeclarationNode.parent; + } + ts.Debug.assert(variableDeclarationNode !== undefined); } else { - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.variableElement); + ts.Debug.assert(!ts.isBindingPattern(node.name)); + variableDeclarationNode = node; + name = node.name; + } + if (ts.isConst(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement); + } + else if (ts.isLet(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement); + } + else { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); } case 129 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); @@ -21281,6 +21643,9 @@ var ts; end: scanner.getTextPos(), kind: currentToken }; + if (trailingTrivia) { + trailingTrivia = undefined; + } while (scanner.getStartPos() < endPos) { currentToken = scanner.scan(); if (!ts.isTrivia(currentToken)) { @@ -22227,7 +22592,9 @@ var ts; })(Constants || (Constants = {})); function formatOnEnter(position, sourceFile, rulesProvider, options) { var line = sourceFile.getLineAndCharacterFromPosition(position).line; - ts.Debug.assert(line >= 2); + if (line === 1) { + return []; + } var span = { pos: ts.getStartPositionOfLine(line - 1, sourceFile), end: ts.getEndLinePosition(line, sourceFile) + 1 @@ -22345,7 +22712,13 @@ var ts; return start; } var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile); - return precedingToken ? precedingToken.end : enclosingNode.pos; + if (!precedingToken) { + return enclosingNode.pos; + } + if (precedingToken.end >= originalRange.pos) { + return enclosingNode.pos; + } + return precedingToken.end; } function getOwnOrInheritedDelta(n, options, sourceFile) { var previousLine = -1 /* Unknown */; @@ -22556,7 +22929,7 @@ var ts; if (listEndToken !== 0 /* Unknown */) { if (formattingScanner.isOnToken()) { var tokenInfo = formattingScanner.readTokenInfo(parent); - if (tokenInfo.token.kind === listEndToken) { + if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); } } @@ -22908,7 +23281,8 @@ var ts; if (!precedingToken) { return 0; } - if ((precedingToken.kind === 8 /* StringLiteral */ || precedingToken.kind === 9 /* RegularExpressionLiteral */) && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { + var precedingTokenIsLiteral = precedingToken.kind === 8 /* StringLiteral */ || precedingToken.kind === 9 /* RegularExpressionLiteral */ || precedingToken.kind === 10 /* NoSubstitutionTemplateLiteral */ || precedingToken.kind === 11 /* TemplateHead */ || precedingToken.kind === 12 /* TemplateMiddle */ || precedingToken.kind === 13 /* TemplateTail */; + if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; @@ -23243,7 +23617,7 @@ var __extends = this.__extends || function (d, b) { }; var ts; (function (ts) { - ts.servicesVersion = "0.4"; + ts.servicesVersion = "0.5"; var ScriptSnapshot; (function (ScriptSnapshot) { var StringScriptSnapshot = (function () { @@ -23440,28 +23814,30 @@ var ts; function getJsDocCommentsSeparatedByNewLines() { var paramTag = "@param"; var jsDocCommentParts = []; - ts.forEach(declarations, function (declaration) { - var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 124 /* Parameter */) { - ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); - if (cleanedParamJsDocComment) { - jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); + ts.forEach(declarations, function (declaration, indexOfDeclaration) { + if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { + var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); + if (canUseParsedParamTagComments && declaration.kind === 124 /* Parameter */) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedParamJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); + } + }); + } + if (declaration.kind === 195 /* ModuleDeclaration */ && declaration.body.kind === 195 /* ModuleDeclaration */) { + return; + } + while (declaration.kind === 195 /* ModuleDeclaration */ && declaration.parent.kind === 195 /* ModuleDeclaration */) { + declaration = declaration.parent; + } + ts.forEach(getJsDocCommentTextRange(declaration.kind === 188 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); } }); } - if (declaration.kind === 195 /* ModuleDeclaration */ && declaration.body.kind === 195 /* ModuleDeclaration */) { - return; - } - while (declaration.kind === 195 /* ModuleDeclaration */ && declaration.parent.kind === 195 /* ModuleDeclaration */) { - declaration = declaration.parent; - } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 188 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { - var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); - if (cleanedJsDocComment) { - jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); - } - }); }); return jsDocCommentParts; function getJsDocCommentTextRange(node, sourceFile) { @@ -24087,6 +24463,7 @@ var ts; function createLanguageServiceSourceFile(filename, scriptSnapshot, scriptTarget, version, isOpen, setNodeParents) { var sourceFile = ts.createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version, isOpen); + sourceFile.nameTable = sourceFile.identifiers; return sourceFile; } ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; @@ -24110,6 +24487,7 @@ var ts; if (!ts.disableIncrementalParsing) { var newSourceFile = sourceFile.update(scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange); setSourceFileFields(newSourceFile, scriptSnapshot, version, isOpen); + newSourceFile.nameTable = undefined; return newSourceFile; } } @@ -24409,7 +24787,9 @@ var ts; getCancellationToken: function () { return cancellationToken; }, getCanonicalFileName: function (filename) { return useCaseSensitivefilenames ? filename : filename.toLowerCase(); }, useCaseSensitiveFileNames: function () { return useCaseSensitivefilenames; }, - getNewLine: function () { return "\r\n"; }, + getNewLine: function () { + return host.getNewLine ? host.getNewLine() : "\r\n"; + }, getDefaultLibFilename: function (options) { return host.getDefaultLibFilename(options); }, @@ -25395,7 +25775,7 @@ var ts; return undefined; } if (node.kind === 64 /* Identifier */ || node.kind === 92 /* ThisKeyword */ || node.kind === 90 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - return getReferencesForNode(node, [sourceFile], false, false); + return getReferencesForNode(node, [sourceFile], true, false, false); } switch (node.kind) { case 83 /* IfKeyword */: @@ -25817,9 +26197,27 @@ var ts; return undefined; } ts.Debug.assert(node.kind === 64 /* Identifier */ || node.kind === 7 /* NumericLiteral */ || node.kind === 8 /* StringLiteral */); - return getReferencesForNode(node, program.getSourceFiles(), findInStrings, findInComments); + return getReferencesForNode(node, program.getSourceFiles(), false, findInStrings, findInComments); } - function getReferencesForNode(node, sourceFiles, findInStrings, findInComments) { + function initializeNameTable(sourceFile) { + var nameTable = {}; + walk(sourceFile); + sourceFile.nameTable = nameTable; + function walk(node) { + switch (node.kind) { + case 64 /* Identifier */: + nameTable[node.text] = node.text; + break; + case 8 /* StringLiteral */: + case 7 /* NumericLiteral */: + nameTable[node.text] = node.text; + break; + default: + ts.forEachChild(node, walk); + } + } + } + function getReferencesForNode(node, sourceFiles, searchOnlyInCurrentFile, findInStrings, findInComments) { if (isLabelName(node)) { if (isJumpStatementTarget(node)) { var labelDefinition = getTargetLabel(node.parent, node.text); @@ -25852,14 +26250,25 @@ var ts; getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); } else { - var internedName = getInternedName(symbol, declarations); - ts.forEach(sourceFiles, function (sourceFile) { - cancellationToken.throwIfCancellationRequested(); - if (ts.lookUp(sourceFile.identifiers, internedName)) { - result = result || []; - getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); - } - }); + if (searchOnlyInCurrentFile) { + ts.Debug.assert(sourceFiles.length === 1); + result = []; + getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + else { + var internedName = getInternedName(symbol, declarations); + ts.forEach(sourceFiles, function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + if (!sourceFile.nameTable) { + initializeNameTable(sourceFile); + } + ts.Debug.assert(sourceFile.nameTable !== undefined); + if (ts.lookUp(sourceFile.nameTable, internedName)) { + result = result || []; + getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + }); + } } return result; function getDeclaredName(symbol) { @@ -25891,7 +26300,7 @@ var ts; return ts.getAncestor(privateDeclaration, 191 /* ClassDeclaration */); } } - if (symbol.parent) { + if (symbol.parent || (symbol.getFlags() & 268435456 /* UnionProperty */)) { return undefined; } var scope = undefined; @@ -26026,7 +26435,7 @@ var ts; } } function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword); + var searchSpaceNode = ts.getSuperContainer(superKeyword, false); if (!searchSpaceNode) { return undefined; } @@ -26054,7 +26463,7 @@ var ts; if (!node || node.kind !== 90 /* SuperKeyword */) { return; } - var container = ts.getSuperContainer(node); + var container = ts.getSuperContainer(node, false); if (container && (128 /* Static */ & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { result.push(getReferenceEntryFromNode(node)); } diff --git a/bin/typescriptServices_internal.d.ts b/bin/typescriptServices_internal.d.ts index 5731d6959de..82f5e606758 100644 --- a/bin/typescriptServices_internal.d.ts +++ b/bin/typescriptServices_internal.d.ts @@ -44,6 +44,7 @@ declare module ts { function getProperty(map: Map, key: string): T; function isEmpty(map: Map): boolean; function clone(object: T): T; + function extend(first: Map, second: Map): Map; function forEachValue(map: Map, callback: (value: T) => U): U; function forEachKey(map: Map, callback: (key: string) => U): U; function lookUp(map: Map, key: string): T; @@ -125,6 +126,7 @@ declare module ts { createDirectory(directoryName: string): void; getExecutingFilePath(): string; getCurrentDirectory(): string; + readDirectory(path: string, extension?: string): string[]; getMemoryUsage?(): number; exit(exitCode?: number): void; } @@ -186,7 +188,7 @@ declare module ts { function isObjectLiteralMethod(node: Node): boolean; function getContainingFunction(node: Node): FunctionLikeDeclaration; function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; - function getSuperContainer(node: Node): Node; + function getSuperContainer(node: Node, includeFunctions: boolean): Node; function getInvokedExpression(node: CallLikeExpression): Expression; function isExpression(node: Node): boolean; function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean; @@ -244,6 +246,8 @@ declare module ts { declare module ts { var optionDeclarations: CommandLineOption[]; function parseCommandLine(commandLine: string[]): ParsedCommandLine; + function readConfigFile(filename: string): any; + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; } declare module ts { interface ListItemInfo { diff --git a/bin/typescript_internal.d.ts b/bin/typescript_internal.d.ts index e9bff0d37f9..2758ab3c212 100644 --- a/bin/typescript_internal.d.ts +++ b/bin/typescript_internal.d.ts @@ -44,6 +44,7 @@ declare module "typescript" { function getProperty(map: Map, key: string): T; function isEmpty(map: Map): boolean; function clone(object: T): T; + function extend(first: Map, second: Map): Map; function forEachValue(map: Map, callback: (value: T) => U): U; function forEachKey(map: Map, callback: (key: string) => U): U; function lookUp(map: Map, key: string): T; @@ -125,6 +126,7 @@ declare module "typescript" { createDirectory(directoryName: string): void; getExecutingFilePath(): string; getCurrentDirectory(): string; + readDirectory(path: string, extension?: string): string[]; getMemoryUsage?(): number; exit(exitCode?: number): void; } @@ -186,7 +188,7 @@ declare module "typescript" { function isObjectLiteralMethod(node: Node): boolean; function getContainingFunction(node: Node): FunctionLikeDeclaration; function getThisContainer(node: Node, includeArrowFunctions: boolean): Node; - function getSuperContainer(node: Node): Node; + function getSuperContainer(node: Node, includeFunctions: boolean): Node; function getInvokedExpression(node: CallLikeExpression): Expression; function isExpression(node: Node): boolean; function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean; @@ -244,6 +246,8 @@ declare module "typescript" { declare module "typescript" { var optionDeclarations: CommandLineOption[]; function parseCommandLine(commandLine: string[]): ParsedCommandLine; + function readConfigFile(filename: string): any; + function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; } declare module "typescript" { interface ListItemInfo { diff --git a/doc/TypeScript Language Specification (Change Markup).docx b/doc/TypeScript Language Specification (Change Markup).docx index 7846303e15b..bc996cae590 100644 Binary files a/doc/TypeScript Language Specification (Change Markup).docx and b/doc/TypeScript Language Specification (Change Markup).docx differ diff --git a/doc/TypeScript Language Specification (Change Markup).pdf b/doc/TypeScript Language Specification (Change Markup).pdf index ea7cede20f8..7cb0009047b 100644 Binary files a/doc/TypeScript Language Specification (Change Markup).pdf and b/doc/TypeScript Language Specification (Change Markup).pdf differ diff --git a/doc/TypeScript Language Specification.docx b/doc/TypeScript Language Specification.docx index c7b95764525..6858fa905df 100644 Binary files a/doc/TypeScript Language Specification.docx and b/doc/TypeScript Language Specification.docx differ diff --git a/doc/TypeScript Language Specification.pdf b/doc/TypeScript Language Specification.pdf index 9a165b56df6..e28d6f2d7f4 100644 Binary files a/doc/TypeScript Language Specification.pdf and b/doc/TypeScript Language Specification.pdf differ diff --git a/doc/spec.md b/doc/spec.md index 62d27e0a808..66a622d9e73 100644 --- a/doc/spec.md +++ b/doc/spec.md @@ -1,8 +1,8 @@ # TypeScript Language Specification -Version 1.4 +Version 1.5 -October, 2014 +February, 2015
@@ -120,11 +120,15 @@ TypeScript is a trademark of Microsoft Corporation. * [4.15.7 The || operator](#4.15.7) * [4.16 The Conditional Operator](#4.16) * [4.17 Assignment Operators](#4.17) + * [4.17.1 Destructuring Assignment](#4.17.1) * [4.18 The Comma Operator](#4.18) * [4.19 Contextually Typed Expressions](#4.19) * [4.20 Type Guards](#4.20) * [5 Statements](#5) * [5.1 Variable Statements](#5.1) + * [5.1.1 Simple Variable Declarations](#5.1.1) + * [5.1.2 Destructuring Variable Declarations](#5.1.2) + * [5.1.3 Implied Type](#5.1.3) * [5.2 If, Do, and While Statements](#5.2) * [5.3 For Statements](#5.3) * [5.4 For-In Statements](#5.4) @@ -139,8 +143,9 @@ TypeScript is a trademark of Microsoft Corporation. * [6.1 Function Declarations](#6.1) * [6.2 Function Overloads](#6.2) * [6.3 Function Implementations](#6.3) - * [6.4 Generic Functions](#6.4) - * [6.5 Code Generation](#6.5) + * [6.4 Destructuring Parameter Declarations](#6.4) + * [6.5 Generic Functions](#6.5) + * [6.6 Code Generation](#6.6) * [7 Interfaces](#7) * [7.1 Interface Declarations](#7.1) * [7.2 Declaration Merging](#7.2) @@ -172,7 +177,8 @@ TypeScript is a trademark of Microsoft Corporation. * [9.1 Enum Declarations](#9.1) * [9.2 Enum Members](#9.2) * [9.3 Declaration Merging](#9.3) - * [9.4 Code Generation](#9.4) + * [9.4 Constant Enum Declarations](#9.4) + * [9.5 Code Generation](#9.5) * [10 Internal Modules](#10) * [10.1 Module Declarations](#10.1) * [10.2 Module Body](#10.2) @@ -420,7 +426,7 @@ getX({ x: 0, y: 0, color: "red" }); // Extra fields Ok getX({ x: 0 }); // Error: supplied parameter does not match ``` -See section [0](#0) for more information about type comparisons. +See section [3.10](#3.10) for more information about type comparisons. ## 1.5 Contextual Typing @@ -812,7 +818,7 @@ Declarations introduce names in the ***declaration spaces*** to which they belon * Each class declaration has a declaration space for instance members, a declaration space for static members, and a declaration space for type parameters. * Each interface declaration has a declaration space for members and a declaration space for type parameters. An interface's declaration space is shared with other interfaces that have the same root module and the same qualified name starting from that root module. * Each enum declaration has a declaration space for its enum members. An enum's declaration space is shared with other enums that have the same root module and the same qualified name starting from that root module. -* Each function declaration (including constructor, member function, and member accessor declarations) and each function expression has a declaration space for variables (parameters, local variables, and local functions) and a declaration space for type parameters. +* Each function declaration (including constructor, member function, and member accessor declarations) and each function expression has a declaration space for locals (introduced by parameter, variable, and function declarations) and a declaration space for type parameters. * Each object literal has a declaration space for its properties. * Each object type literal has a declaration space for its members. @@ -868,7 +874,7 @@ The ***scope*** of a name is the region of program text within which it is possi * The scope of a type parameter declared in a class or interface declaration is that entire declaration, including constraints, extends clause, implements clause, and declaration body, but not including static member declarations. * The scope of a member declared in an enum declaration is the body of that declaration and every enum declaration with the same root and the same qualified name relative to that root. * The scope of a type parameter declared in a call or construct signature is that entire signature declaration, including constraints, parameter list, and return type. If the signature is part of a function implementation, the scope includes the function body. -* The scope of a parameter, local variable, or local function declared within a function declaration (including a constructor, member function, or member accessor declaration) or function expression is the body of that function declaration or function expression. +* The scope of a local entity (parameter, variable, or function) declared within a function declaration (including a constructor, member function, or member accessor declaration) or function expression is the body of that function declaration or function expression. Scopes may overlap, for example through nesting of modules and functions. When the scopes of two entities with the same name overlap, the entity with the innermost declaration takes precedence and access to the outer entity is either not possible or only possible by qualifying its name. @@ -955,7 +961,7 @@ The Number primitive type corresponds to the similarly named JavaScript primitiv The `number` keyword references the Number primitive type and numeric literals may be used to write values of the Number primitive type. -For purposes of determining type relationships (section [0](#0)) and accessing properties (section [4.10](#4.10)), the Number primitive type behaves as an object type with the same properties as the global interface type 'Number'. +For purposes of determining type relationships (section [3.10](#3.10)) and accessing properties (section [4.10](#4.10)), the Number primitive type behaves as an object type with the same properties as the global interface type 'Number'. Some examples: @@ -972,7 +978,7 @@ The Boolean primitive type corresponds to the similarly named JavaScript primiti The `boolean` keyword references the Boolean primitive type and the `true` and `false` literals reference the two Boolean truth values. -For purposes of determining type relationships (section [0](#0)) and accessing properties (section [4.10](#4.10)), the Boolean primitive type behaves as an object type with the same properties as the global interface type 'Boolean'. +For purposes of determining type relationships (section [3.10](#3.10)) and accessing properties (section [4.10](#4.10)), the Boolean primitive type behaves as an object type with the same properties as the global interface type 'Boolean'. Some examples: @@ -988,7 +994,7 @@ The String primitive type corresponds to the similarly named JavaScript primitiv The `string` keyword references the String primitive type and string literals may be used to write values of the String primitive type. -For purposes of determining type relationships (section [0](#0)) and accessing properties (section [4.10](#4.10)), the String primitive type behaves as an object type with the same properties as the global interface type 'String'. +For purposes of determining type relationships (section [3.10](#3.10)) and accessing properties (section [4.10](#4.10)), the String primitive type behaves as an object type with the same properties as the global interface type 'String'. Some examples: @@ -1092,6 +1098,8 @@ Array literals (section [4.6](#4.6)) may be used to create values of array types var a: string[] = ["hello", "world"]; ``` +A type is said to be an ***array-like type*** if it is assignable (section [3.10.4](#3.10.4)) to the type `any[]`. + ### 3.3.3 Tuple Types ***Tuple types*** represent JavaScript arrays with individually tracked element types. Tuple types are written using tuple type literals (section [3.7.5](#3.7.5)). A tuple type combines a set of numerically named properties with the members of an array type. Specifically, a tuple type @@ -1131,6 +1139,8 @@ interface KeyValuePair extends Array { 0: K; 1: V; } var x: KeyValuePair = [10, "ten"]; ``` +A type is said to be a ***tuple-like type*** if it has a property with the numeric name '0'. + ### 3.3.4 Function Types An object type containing one or more call signatures is said to be a ***function type***. Function types may be written using function type literals (section [3.7.7](#3.7.7)) or by including call signatures in object type literals. @@ -1150,7 +1160,7 @@ Every object type is composed from zero or more of the following kinds of member Properties are either ***public***, ***private***, or ***protected*** and are either ***required*** or ***optional***: -* Properties in a class declaration may be designated public, private, or protected, while properties declared in other contexts are always considered public. Private members are only accessible within their declaring class, as described in section [8.2.2](#8.2.2), and private properties match only themselves in subtype and assignment compatibility checks, as described in section [0](#0). Protected members are only accessible within their declaring class and classes derived from it, as described in section [8.2.2](#8.2.2), and protected properties match only themselves and overrides in subtype and assignment compatibility checks, as described in section [0](#0). +* Properties in a class declaration may be designated public, private, or protected, while properties declared in other contexts are always considered public. Private members are only accessible within their declaring class, as described in section [8.2.2](#8.2.2), and private properties match only themselves in subtype and assignment compatibility checks, as described in section [3.10](#3.10). Protected members are only accessible within their declaring class and classes derived from it, as described in section [8.2.2](#8.2.2), and protected properties match only themselves and overrides in subtype and assignment compatibility checks, as described in section [3.10](#3.10). * Properties in an object type literal or interface declaration may be designated required or optional, while properties declared in other contexts are always considered required. Properties that are optional in the target type of an assignment may be omitted from source objects, as described in section [3.10.4](#3.10.4). Call and construct signatures may be ***specialized*** (section [3.8.2.4](#3.8.2.4)) by including parameters with string literal types. Specialized signatures are used to express patterns where specific string values for some parameters cause the types of other parameters or the function result to become further specialized. @@ -1193,7 +1203,7 @@ x = test ? 5 : "five"; // Ok x = test ? 0 : false; // Error, number | boolean not asssignable ``` -it is possible to assign 'x' a value of type string, number, or the union type string | number, but not any other type. To access a value in 'x', a type guard can be used to first narrow the type of 'x' to either string or number: +it is possible to assign 'x' a value of type `string`, `number`, or the union type `string | number`, but not any other type. To access a value in 'x', a type guard can be used to first narrow the type of 'x' to either `string` or `number`: ```TypeScript var n = typeof x === "string" ? x.length : x; // Type of n is number @@ -1276,7 +1286,7 @@ interface G { the base constraint of 'T' is the empty object type, and the base constraint of 'U' and 'V' is 'Function'. -For purposes of determining type relationships (section [0](#0)), type parameters appear to be subtypes of their base constraint. Likewise, in property accesses (section [4.10](#4.10)), `new` operations (section [4.11](#4.11)), and function calls (section [4.12](#4.12)), type parameters appear to have the members of their base constraint, but no other members. +For purposes of determining type relationships (section [3.10](#3.10)), type parameters appear to be subtypes of their base constraint. Likewise, in property accesses (section [4.10](#4.10)), `new` operations (section [4.11](#4.11)), and function calls (section [4.12](#4.12)), type parameters appear to have the members of their base constraint, but no other members. ### 3.5.2 Type Argument Lists @@ -1376,7 +1386,7 @@ Parentheses are required around union, function, or constructor types when they ```TypeScript (string | number)[] -((x: string) => string) | (x: number) => number) +((x: string) => string) | ((x: number) => number) ``` The different forms of type notations are described in the following sections. @@ -1598,7 +1608,7 @@ var a = { x: 10, y: 20 }; var b: typeof a; ``` -Above, 'b' is given the same type as 'a', namely '{ x: number; y: number; }'. +Above, 'b' is given the same type as 'a', namely `{ x: number; y: number; }`. If a declaration includes a type annotation that references the entity being declared through a circular path of type queries or type references containing type queries, the resulting type is the Any type. For example, all of the following variables are given the type Any: @@ -1705,7 +1715,7 @@ A signature's parameter list consists of zero or more required parameters, follo    *RequiredParameterList* `,` *RequiredParameter*   *RequiredParameter:* -   *AccessibilityModifieropt* *Identifier* *TypeAnnotationopt* +   *AccessibilityModifieropt* *IdentifierOrPattern* *TypeAnnotationopt*    *Identifier* `:` *StringLiteral*   *AccessibilityModifier:* @@ -1713,29 +1723,39 @@ A signature's parameter list consists of zero or more required parameters, follo    `private`    `protected` +  *IdentifierOrPattern:* +   *Identifier* +   *BindingPattern* +   *OptionalParameterList:*    *OptionalParameter*    *OptionalParameterList* `,` *OptionalParameter*   *OptionalParameter:* -   *AccessibilityModifieropt* *Identifier* `?` *TypeAnnotationopt* -   *AccessibilityModifieropt* *Identifier* *TypeAnnotationopt* *Initialiser* +   *AccessibilityModifieropt* *IdentifierOrPattern* `?` *TypeAnnotationopt* +   *AccessibilityModifieropt* *IdentifierOrPattern* *TypeAnnotationopt* *Initialiser*    *Identifier* `?` `:` *StringLiteral*   *RestParameter:*    `...` *Identifier* *TypeAnnotationopt* -Parameter names must be unique. A compile-time error occurs if two or more parameters have the same name. +A parameter declaration may specify either an identifier or a binding pattern ([5.1.2](#5.1.2)). The identifiers specified in parameter declarations and binding patterns in a parameter list must be unique within that parameter list. -A parameter is permitted to include a `public`, `private`, or `protected` modifier only if it occurs in the parameter list of a *ConstructorImplementation* (section [8.3.1](#8.3.1)). +The type of a parameter in a signature is determined as follows: -A parameter with a type annotation is considered to be of that type. A type annotation for a rest parameter must denote an array type. +* If the declaration includes a type annotation, the parameter is of that type. +* Otherwise, if the declaration includes an initializer expression (which is permitted only when the parameter list occurs in conjunction with a function body), the parameter type is the widened form (section [3.11](#3.11)) of the type of the initializer expression. +* Otherwise, if the declaration specifies a binding pattern, the parameter type is the implied type of that binding pattern (section [5.1.3](#5.1.3)). +* Otherwise, if the parameter is a rest parameter, the parameter type is `any[]`. +* Otherwise, the parameter type is `any`. -A parameter with no type annotation or initializer is considered to be of type `any`, unless it is a rest parameter, in which case it is considered to be of type `any[]`. +A parameter is permitted to include a `public`, `private`, or `protected` modifier only if it occurs in the parameter list of a *ConstructorImplementation* (section [8.3.1](#8.3.1)) and only if it doesn't specify a *BindingPattern*. -When a parameter type annotation specifies a string literal type, the containing signature is a specialized signature (section [3.8.2.4](#3.8.2.4)). Specialized signatures are not permitted in conjunction with a function body, i.e. the *FunctionExpression*, *FunctionImplementation*, *MemberFunctionImplementation*, and *ConstructorImplementation* grammar productions do not permit parameters with string literal types. +A type annotation for a rest parameter must denote an array type. -A parameter can be marked optional by following its name with a question mark (`?`) or by including an initializer. The form that includes an initializer is permitted only in conjunction with a function body, i.e. only in a *FunctionExpression*, *FunctionImplementation*, *MemberFunctionImplementation*, or *ConstructorImplementation* grammar production. +When a parameter type annotation specifies a string literal type, the containing signature is a specialized signature (section [3.8.2.4](#3.8.2.4)). Specialized signatures are not permitted in conjunction with a function body, i.e. the *FunctionExpression*, *FunctionImplementation*, *MemberFunctionImplementation*, and *ConstructorImplementation* grammar productions do not permit parameters with string literal types. + +A parameter can be marked optional by following its name or binding pattern with a question mark (`?`) or by including an initializer. Initializers (including binding property or element initializers) are permitted only when the parameter list occurs in conjunction with a function body, i.e. only in a *FunctionExpression*, *FunctionImplementation*, *MemberFunctionImplementation*, or *ConstructorImplementation* grammar production. #### 3.8.2.3 Return Type @@ -1917,7 +1937,6 @@ However, doing so means the following capabilities are lost: * An interface can be named in an extends or implements clause, but a type alias for an object type literal cannot. * An interface can have multiple merged declarations, but a type alias for an object type literal cannot. * An interface can have type parameters, but a type alias for an object type literal cannot. -* An interface is referenced by its name in error messages and tooling, but a type alias is always expanded to its structural representation. ## 3.10 Type Relationships @@ -2263,7 +2282,18 @@ If a get accessor is declared for a property, the return type of the get accesso When an object literal is contextually typed by a type that includes a string index signature, the resulting type of the object literal includes a string index signature with the union type of the types of the properties declared in the object literal, or the Undefined type if the object literal is empty. Likewise, when an object literal is contextually typed by a type that includes a numeric index signature, the resulting type of the object literal includes a numeric index signature with the union type of the types of the numerically named properties (section [3.8.4](#3.8.4)) declared in the object literal, or the Undefined type if the object literal declares no numerically named properties. -## 4.6 Array Literals +## 4.6 Array Literals + +Array literals are extended to support the spread (`...`) operator. + +  *ElementList:* *( Modified )* +   *Elisionopt* *AssignmentExpression* +   *Elisionopt* *SpreadElement* +   *ElementList* `,` *Elisionopt* *AssignmentExpression* +   *ElementList* `,` *Elisionopt* *SpreadElement* + +  *SpreadElement:* +   `...` *AssignmentExpression* An array literal @@ -2275,17 +2305,20 @@ denotes a value of an array type (section [3.3.2](#3.3.2)) or a tuple type (sect Each element expression in a non-empty array literal is processed as follows: -* If the array literal is contextually typed (section [4.19](#4.19)) by a type *T* and *T* has a property with the numeric name *N*, where *N* is the index of the element expression in the array literal, the element expression is contextually typed by the type of that property. +* If the array literal contains no spread elements, and if the array literal is contextually typed (section [4.19](#4.19)) by a type *T* and *T* has a property with the numeric name *N*, where *N* is the index of the element expression in the array literal, the element expression is contextually typed by the type of that property. * Otherwise, if the array literal is contextually typed by a type *T* with a numeric index signature, the element expression is contextually typed by the type of the numeric index signature. * Otherwise, the element expression is not contextually typed. The resulting type an array literal expression is determined as follows: * If the array literal is empty, the resulting type is an array type with the element type Undefined. -* Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name '0', the resulting type is a tuple type constructed from the types of the element expressions. -* Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. +* Otherwise, if the array literal contains no spread elements and is contextually typed by a tuple-like type (section [3.3.3](#3.3.3)), the resulting type is a tuple type constructed from the types of the element expressions. +* Otherwise, if the array literal contains no spread elements and is an array assignment pattern in a destructuring assignment (section [4.17.1](#4.17.1)), the resulting type is a tuple type constructed from the types of the element expressions. +* Otherwise, the resulting type is an array type with an element type that is the union of the types of the non-spread element expressions and the numeric index signature types of the spread element expressions. -The rules above mean that an array literal is always of an array type, unless it is contextually typed by a type with numerically named properties (such as a tuple type). For example +A spread element must specify an expression of an array-like type (section [3.3.2](#3.3.2)), or otherwise an error occurs. + +The rules above mean that an array literal is always of an array type, unless it is contextually typed by a tuple-like type. For example ```TypeScript var a = [1, 2]; // number[] @@ -2293,6 +2326,20 @@ var b = ["hello", true]; // (string | boolean)[] var c: [number, string] = [3, "three"]; // [number, string] ``` +When the output target is ECMAScript 3 or 5, array literals containing spread elements are rewritten to invocations of the `concat` method. For example, the assignments + +```TypeScript +var a = [2, 3, 4]; +var b = [0, 1, ...a, 5, 6]; +``` + +are rewritten to + +```TypeScript +var a = [2, 3, 4]; +var b = [0, 1].concat(a, [5, 6]); +``` + ## 4.7 Parentheses A parenthesized expression @@ -2364,7 +2411,7 @@ The descriptions of function declarations provided in section [6.1](#6.1) apply Standard function expressions are function expressions written with the `function` keyword. The type of `this` in a standard function expression is the Any type. -Standard function expressions are transformed to JavaScript in the same manner as function declarations (see section [6.5](#6.5)). +Standard function expressions are transformed to JavaScript in the same manner as function declarations (see section [6.6](#6.6)). ### 4.9.2 Arrow Function Expressions @@ -2452,11 +2499,23 @@ could be parsed as an arrow function expression with a type parameter or a type ### 4.9.3 Contextually Typed Function Expressions -Function expressions with no type parameters and no parameter type annotations (but possibly with optional parameters and default parameter values) are contextually typed in certain circumstances, as described in section [4.19](#4.19). +When a function expression with no type parameters and no parameter type annotations is contextually typed (section [4.19](#4.19)) by a type *T* and a contextual signature *S* can be extracted from *T*, the function expression is processed as if it had explicitly specified parameter type annotations as they exist in *S*. Parameters are matched by position and need not have matching names. If the function expression has fewer parameters than *S*, the additional parameters in *S* are ignored. If the function expression has more parameters than *S*, the additional parameters are all considered to have type Any. -When a function expression is contextually typed by a function type *T*, the function expression is processed as if it had explicitly specified parameter type annotations as they exist in *T*. Parameters are matched by position and need not have matching names. If the function expression has fewer parameters than *T*, the additional parameters in *T* are ignored. If the function expression has more parameters than *T*, the additional parameters are all considered to have type Any. +Likewise, when a function expression with no return type annotation is contextually typed (section [4.19](#4.19)) by a function type *T* and a contextual signature *S* can be extracted from *T*, expressions in contained return statements (section [5.7](#5.7)) are contextually typed by the return type of *S*. -Furthermore, when a function expression has no return type annotation and is contextually typed by a function type *T*, expressions in contained return statements (section [5.7](#5.7)) are contextually typed by *T*'s return type. +A contextual signature *S* is extracted from a function type *T* as follows: + +* If *T* is a function type with exactly one call signature, and if that call signature is non-generic, *S* is that signature. +* If *T* is a union type, let *U* be the set of element types in *T* that have call signatures. If each type in *U* has exactly one call signature and that call signature is non-generic, and if all of the signatures are identical ignoring return types, then *S* is a signature with the same parameters and a union of the return types. +* Otherwise, no contextual signature can be extracted from *T* and *S* is undefined. + +In the example + +```TypeScript +var f: (s: string) => string = s => s.toLowerCase(); +``` + +the function expression is contextually typed by the type of 'f', and since the function expression has no type parameters or type annotations its parameter type information is extracted from the contextual type, thus inferring the type of 's' to be the String primitive type. ## 4.10 Property Access @@ -2687,7 +2746,7 @@ TypeScript extends the JavaScript expression grammar with the ability to assert A type assertion expression consists of a type enclosed in `<` and `>` followed by a unary expression. Type assertion expressions are purely a compile-time construct. Type assertions are *not* checked at run-time and have no impact on the emitted JavaScript (and therefore no run-time cost). The type and the enclosing `<` and `>` are simply removed from the generated code. -In a type assertion expression of the form `<` *T* `>` *e*, *e* is contextually typed (section [4.19](#4.19)) by *T* and the resulting type of* e* is required to be assignable to *T*, or *T* is required to be assignable to the widened form of the resulting type of *e*, or otherwise a compile-time error occurs. The type of the result is *T*. +In a type assertion expression of the form < *T* > *e*, *e* is contextually typed (section [4.19](#4.19)) by *T* and the resulting type of* e* is required to be assignable to *T*, or *T* is required to be assignable to the widened form of the resulting type of *e*, or otherwise a compile-time error occurs. The type of the result is *T*. Type assertions check for assignment compatibility in both directions. Thus, type assertions allow type conversions that *might* be correct, but aren't *known* to be correct. In the example @@ -2882,7 +2941,7 @@ An assignment of the form v = expr ``` -requires *v* to be classified as a reference (section [4.1](#4.1)). The *expr* expression is contextually typed (section [4.19](#4.19)) by the type of *v*, and the type of *expr* must be assignable to (section [3.10.4](#3.10.4)) the type of *v*, or otherwise a compile-time error occurs. The result is a value with the type of *expr*. +requires *v* to be classified as a reference (section [4.1](#4.1)) or as an assignment pattern (section [4.17.1](#4.17.1)). The *expr* expression is contextually typed (section [4.19](#4.19)) by the type of *v*, and the type of *expr* must be assignable to (section [3.10.4](#3.10.4)) the type of *v*, or otherwise a compile-time error occurs. The result is a value with the type of *expr*. A compound assignment of the form @@ -2896,7 +2955,78 @@ where ??= is one of the compound assignment operators *= /= %= += -= <<= >>= >>>= &= ^= |= ``` -is subject to the same requirements, and produces a value of the same type, as the corresponding non-compound operation. A compound assignment furthermore requires *v* to be classified as a reference (section [4.1](#4.1)) and the type of the non-compound operation to be assignable to the type of *v*. +is subject to the same requirements, and produces a value of the same type, as the corresponding non-compound operation. A compound assignment furthermore requires *v* to be classified as a reference (section [4.1](#4.1)) and the type of the non-compound operation to be assignable to the type of *v*. Note that *v* is not permitted to be an assignment pattern in a compound assignment. + +### 4.17.1 Destructuring Assignment + +A ***destructuring assignment*** is an assignment operation in which the left hand operand is a destructuring assignment pattern. + +  *AssignmentPattern:* +   *ObjectAssignmentPattern* +   *ArrayAssignmentPattern* + +  *ObjectBindingPattern:* +   `{` `}` +   `{` *AssignmentPropertyList* `,`*opt* `}` + +  *AssignmentPropertyList:* +   *AssignmentProperty* +   *AssignmentPropertyList* `,` *AssignmentProperty* + +  *AssignmentProperty:* +   *Identifier* *Initialiseropt* +   *PropertyName* `:` *LeftHandSideExpression* *Initialiseropt* +   *PropertyName* `:` *AssignmentPattern* *Initialiseropt* + +  *ArrayAssignmentPattern:* +   `[` *Elisionopt* *AssignmentRestElementopt* `]` +   `[` *AssignmentElementList* `]` +   `[` *AssignmentElementList* `,` *Elisionopt* *AssignmentRestElementopt* `]` + +  *AssignmentElementList:* +   *Elisionopt* *AssignmentElement* +   *AssignmentElementList* `,` *Elisionopt* *AssignmentElement* + +  *AssignmentElement:* +   *LeftHandSideExpression* *Initialiseropt* +   *AssignmentPattern* *Initialiseropt* + +  *AssignmentRestElement:* +   `...` *LeftHandSideExpression* + +In a destructuring assignment expression, the type of the expression on the right must be assignable to the assignment target on the left. An expression of type *S* is considered assignable to an assignment target *V* if one of the following is true: + +* *V* is variable and *S* is assignable to the type of *V*. +* *V* is an object assignment pattern and, for each assignment property *P* in *V*, + * *S* is the type Any, or + * *S* has an apparent property with the property name specified in *P* of a type that is assignable to the target given in *P*, or + * *P* specifies a numeric property name and *S* has a numeric index signature of a type that is assignable to the target given in *P*, or + * *S* has a string index signature of a type that is assignable to the target given in *P*. +* *V* is an array assignment pattern, *S* is the type Any or an array-like type (section [3.3.2](#3.3.2)), and, for each assignment element *E* in *V*, + * *S* is the type Any, or + * *S* is a tuple-like type (section [3.3.3](#3.3.3)) with a property named *N* of a type that is assignable to the target given in *E*, where *N* is the numeric index of *E* in the array assignment pattern, or + * *S* is not a tuple-like type and the numeric index signature type of *S* is assignable to the target given in *E*. + +In an assignment property or element that includes a default value, the type of the default value must be assignable to the target given in the assignment property or element. + +When the output target is ECMAScript 6 or higher, destructuring variable assignments remain unchanged in the emitted JavaScript code. + +When the output target is ECMAScript 3 or 5, destructuring variable assignments are rewritten to series of simple assignments. For example, the destructuring assignment + +```TypeScript +var x = 1; +var y = 2; +[x, y] = [y, x]; +``` + +is rewritten to the simple variable assignments + +```TypeScript +var x = 1; +var y = 2; +_a = [y, x], x = _a[0], y = _a[1]; +var _a; +``` ## 4.18 The Comma Operator @@ -2904,53 +3034,30 @@ The comma operator permits the operands to be of any type and produces a result ## 4.19 Contextually Typed Expressions -In certain situations, parameter and return types of function expressions are automatically inferred from the contexts in which the function expressions occur. For example, given the declaration +Type checking of an expression is improved in several contexts by factoring in the type of the destination of the value computed by the expression. In such situations, the expression is said to be ***contextually typed*** by the type of the destination. An expression is contextually typed in the following circumstances: -```TypeScript -var f: (s: string) => string; -``` - -the assignment - -```TypeScript -f = function(s) { return s.toLowerCase(); } -``` - -infers the type of the 's' parameter to be the String primitive type even though there is no type annotation to that effect. The function expression is said to be ***contextually typed*** by the variable to which it is being assigned. Contextual typing occurs in the following situations: - -* In variable, parameter, and member declarations with a type annotation and an initializer, the initializer expression is contextually typed by the type of the variable, parameter, or property. -* In return statements, if the containing function includes a return type annotation, return expressions are contextually typed by that return type. Otherwise, if the containing function is contextually typed by a type *T*, return expressions are contextually typed by *T*'s return type. -* In typed function calls, argument expressions are contextually typed by their parameter types. -* In type assertions, the expression is contextually typed by the indicated type. -* In || operator expressions without a contextual type, the right hand expression is contextually typed by the type of the left hand expression. -* In assignment expressions, the right hand expression is contextually typed by the type of the left hand expression. -* In contextually typed object literals, property assignments are contextually typed by their property types. -* In contextually typed array literals, element expressions are contextually typed by the array element type. -* In contextually typed || operator expressions, the operands are contextually typed as well. -* In contextually typed conditional operator expressions, the operands are contextually typed as well. - -Contextual typing of an expression *e* by a type *T* proceeds as follows: - -* If *e* is an *ObjectLiteral* and *T* is an object type, *e* is processed with the contextual type *T*, as described in section [4.5](#4.5). -* If *e* is an *ArrayLiteral* and *T* is an object type with a numeric index signature, *e* is processed with the contextual type *T*, as described in section [4.6](#4.6). -* If *e* is a *FunctionExpression* or *ArrowFunctionExpression* with no type parameters and no parameter type annotations, *T* is a function type with exactly one call signature and *T*'s call signature is non-generic, then any inferences made for type parameters referenced by the parameters of *T*'s call signature are fixed (section [4.12.2](#4.12.2)) and *e* is processed with the contextual type *T*, as described in section [4.9.3](#4.9.3). -* If *e* is a || operator expression and *T* is an object type, *e* is processed with the contextual type *T*, as described in section [4.15.7](#4.15.7). -* If *e* is a conditional operator expression and *T* is an object type, *e* is processed with the contextual type *T*, as described in section [4.16](#4.16). -* Otherwise, *e* is processed without a contextual type. - -The rules above require expressions be of the exact syntactic forms specified in order to be processed as contextually typed constructs. For example, given the declaration of the variable 'f' above, the assignment - -```TypeScript -f = s => s.toLowerCase(); -``` - -causes the function expression to be contextually typed, inferring the String primitive type for 's'. However, simply enclosing the construct in parentheses - -```TypeScript -f = (s => s.toLowerCase()); -``` - -causes the function expression to be processed without a contextual type, now inferring 's' and the result of the function to be of type Any as no type annotations are present. +* In a variable, parameter, binding property, binding element, or member declaration, an initializer expression is contextually typed by + * the type given in the declaration's type annotation, if any, or otherwise + * for a parameter, the contextual type for the declaration (section [4.9.3](#4.9.3)), if any, or otherwise + * the type implied by the binding pattern in the declaration (section [5.1.3](#5.1.3)), if any. +* In the body of a function declaration, function expression, arrow function, method declaration, or get accessor declaration that has a return type annotation, return expressions are contextually typed by the type given in the return type annotation. +* In the body of a function expression or arrow function that has no return type annotation, if the function expression or arrow function is contextually typed by a function type with exactly one call signature, and if that call signature is non-generic, return expressions are contextually typed by the return type of that call signature. +* In the body of a constructor declaration, return expressions are contextually typed by the containing class type. +* In the body of a get accessor with no return type annotation, if a matching set accessor exists and that set accessor has a parameter type annotation, return expressions are contextually typed by the type given in the set accessor's parameter type annotation. +* In a typed function call, argument expressions are contextually typed by their corresponding parameter types. +* In a contextually typed object literal, each property value expression is contextually typed by + * the type of the property with a matching name in the contextual type, if any, or otherwise + * for a numerically named property, the numeric index type of the contextual type, if any, or otherwise + * the string index type of the contextual type, if any. +* In a contextually typed array literal expression containing no spread elements, an element expression at index *N* is contextually typed by + * the type of the property with the numeric name *N* in the contextual type, if any, or otherwise + * the numeric index type of the contextual type, if any. +* In a contextually typed array literal expression containing one or more spread elements, an element expression at index *N* is contextually typed by the numeric index type of the contextual type, if any. +* In a contextually typed parenthesized expression, the contained expression is contextually typed by the same type. +* In a type assertion, the expression is contextually typed by the indicated type. +* In a || operator expression, if the expression is contextually typed, the operands are contextually typed by the same type. Otherwise, the right expression is contextually typed by the type of the left expression. +* In a contextually typed conditional operator expression, the operands are contextually typed by the same type. +* In an assignment expression, the right hand expression is contextually typed by the type of the left hand expression. In the following example @@ -2993,23 +3100,23 @@ function foo(x: number | string) { The type of a variable or parameter is narrowed in the following situations: -* In the true branch statement of an 'if' statement, the type of a variable or parameter is *narrowed* by any type guard in the 'if' condition *when true*, provided the true branch statement contains no assignments to the variable or parameter. -* In the false branch statement of an 'if' statement, the type of a variable or parameter is *narrowed* by any type guard in the 'if' condition *when false*, provided the false branch statement contains no assignments to the variable or parameter. -* In the true expression of a conditional expression, the type of a variable or parameter is *narrowed* by any type guard in the condition *when true*, provided the true expression contains no assignments to the variable or parameter. -* In the false expression of a conditional expression, the type of a variable or parameter is *narrowed* by any type guard in the condition *when false*, provided the false expression contains no assignments to the variable or parameter. -* In the right operand of a && operation, the type of a variable or parameter is *narrowed* by any type guard in the left operand *when true*, provided the right operand contains no assignments to the variable or parameter. -* In the right operand of a || operation, the type of a variable or parameter is *narrowed* by any type guard in the left operand *when false*, provided the right operand contains no assignments to the variable or parameter. +* In the true branch statement of an 'if' statement, the type of a variable or parameter is *narrowed* by a type guard in the 'if' condition *when true*, provided the true branch statement contains no assignments to the variable or parameter. +* In the false branch statement of an 'if' statement, the type of a variable or parameter is *narrowed* by a type guard in the 'if' condition *when false*, provided the false branch statement contains no assignments to the variable or parameter. +* In the true expression of a conditional expression, the type of a variable or parameter is *narrowed* by a type guard in the condition *when true*, provided the true expression contains no assignments to the variable or parameter. +* In the false expression of a conditional expression, the type of a variable or parameter is *narrowed* by a type guard in the condition *when false*, provided the false expression contains no assignments to the variable or parameter. +* In the right operand of a && operation, the type of a variable or parameter is *narrowed* by a type guard in the left operand *when true*, provided the right operand contains no assignments to the variable or parameter. +* In the right operand of a || operation, the type of a variable or parameter is *narrowed* by a type guard in the left operand *when false*, provided the right operand contains no assignments to the variable or parameter. A type guard is simply an expression that follows a particular pattern. The process of narrowing the type of a variable *x* by a type guard *when true* or *when false* depends on the type guard as follows: -* A type guard of the form `x instanceof C`, where *C* is of a subtype of the global type 'Function' and *C* has a property named 'prototype' - * *when true*, narrows the type of *x* to the type of the 'prototype' property in *C* provided it is a subtype of the type of *x*, or +* A type guard of the form `x instanceof C`, where *x* is not of type Any, *C* is of a subtype of the global type 'Function', and *C* has a property named 'prototype' + * *when true*, narrows the type of *x* to the type of the 'prototype' property in *C* provided it is a subtype of the type of *x*, or, if the type of *x* is a union type, removes from the type of *x* all constituent types that aren't subtypes of the type of the 'prototype' property in *C*, or * *when false*, has no effect on the type of *x*. * A type guard of the form `typeof x === s`, where *s* is a string literal with the value 'string', 'number', or 'boolean', - * *when true*, narrows the type of *x* to the given primitive type, or + * *when true*, narrows the type of *x* to the given primitive type provided it is a subtype of the type of *x*, or, if the type of *x* is a union type, removes from the type of *x* all constituent types that aren't subtypes of the given primitive type, or * *when false*, removes the primitive type from the type of *x*. * A type guard of the form `typeof x === s`, where *s* is a string literal with any value but 'string', 'number', or 'boolean', - * *when true*, removes the primitive types string, number, and boolean from the type of *x*, or + * *when true*, if *x* is a union type, removes from the type of *x* all constituent types that are subtypes of the string, number, or boolean primitive type, or * *when false*, has no effect on the type of *x*. * A type guard of the form `typeof x !== s`, where *s* is a string literal, * *when true*, narrows the type of x by `typeof x === s` *when false*, or @@ -3025,10 +3132,7 @@ A type guard is simply an expression that follows a particular pattern. The proc * *when false*, narrows the type of *x* by *expr1* *when false* and then by *expr2* *when false*. * A type guard of any other form has no effect on the type of *x*. -A primitive type *P* is removed from a type *T* as follows: - -* If *T* is a union type *P* | *T1* | *T2* | … | *Tn*, the result is the type *T1* | *T2* | … | *Tn*. -* Otherwise, the result is *T*. +In the rules above, when a narrowing operation would remove all constituent types from a union type, the operation has no effect on the union type. Note that type guards affect types of variables and parameters only and have no effect on members of objects such as properties. Also note that it is possible to defeat a type guard by calling a function that changes the type of the guarded variable. @@ -3040,7 +3144,18 @@ function isLongString(obj: any) { } ``` -the 'obj' parameter has type string in the right operand of the && operator. +the `obj` parameter has type `string` in the right operand of the && operator. + +In the example + +```TypeScript +function processValue(value: number | (() => number)) { + var x = typeof value !== "number" ? value() : value; + // Process number in x +} +``` + +the value parameter has type `() => number` in the first conditional expression and type `number` in the second conditional expression, and the inferred type of x is `number`. In the example @@ -3055,18 +3170,21 @@ function f(x: string | number | boolean) { } ``` -the type of 'x' is string | number | boolean in left operand of the || operator, number | boolean in the right operand of the || operator, string | number in the first branch of the 'if' statement, and boolean in the second branch of the 'if' statement. +the type of x is `string | number | boolean` in the left operand of the || operator, `number | boolean` in the right operand of the || operator, `string | number` in the first branch of the if statement, and `boolean` in the second branch of the if statement. In the example ```TypeScript -function processData(data: string | { (): string }) { - var d = typeof data !== "string" ? data() : data; - // Process string in d +class C { + data: string | string[]; + getData() { + var data = this.data; + return typeof data === "string" ? data : data.join(" "); + } } ``` -the inferred type of 'd' is string. +the type of the `data` variable is `string` in the first conditional expression and `string[]` in the second conditional expression, and the inferred type of `getData` is `string`. Note that the `data` property must be copied to a local variable for the type guard to have an effect. In the example @@ -3075,12 +3193,12 @@ class NamedItem { name: string; } -function getName(obj: any) { +function getName(obj: Object) { return obj instanceof NamedItem ? obj.name : "unknown"; } ``` -the inferred type of the 'getName' function is string. +the type of `obj` is narrowed to `NamedItem` in the first condtional expression, and the inferred type of the `getName` function is `string`.
@@ -3090,26 +3208,37 @@ This chapter describes the static type checking TypeScript provides for JavaScri ##
5.1 Variable Statements -Variable statements are extended to include optional type annotations. +Variable statements are extended to include optional type annotations and ECMAScript 6 destructuring declarations.   *VariableDeclaration:* *( Modified )* -   *Identifier* *TypeAnnotationopt* *Initialiseropt* +   *SimpleVariableDeclaration* +   *DestructuringVariableDeclaration* -  *VariableDeclarationNoIn:* *( Modified )* -   *Identifier* *TypeAnnotationopt* *InitialiserNoInopt* +A variable declaration is either a simple variable declaration or a destructuring variable declaration. + +### 5.1.1 Simple Variable Declarations + +A ***simple variable declaration*** introduces a single named variable and optionally assigns it an initial value. + +  *SimpleVariableDeclaration:* +   *Identifier* *TypeAnnotationopt* *Initialiseropt*   *TypeAnnotation:*    `:` *Type* -A variable declaration introduces a variable with the given name in the containing declaration space. The type associated with a variable is determined as follows: +The type *T* of a variable introduced by a simple variable declaration is determined as follows: -* If the declaration includes a type annotation, the stated type becomes the type of the variable. If an initializer is present, the initializer expression is contextually typed (section [4.19](#4.19)) by the stated type and must be assignable to the stated type, or otherwise a compile-time error occurs. -* If the declaration includes an initializer but no type annotation, and if the initializer doesn't directly or indirectly reference the variable, the widened type (section [3.11](#3.11)) of the initializer expression becomes the type of the variable. If the initializer directly or indirectly references the variable, the type of the variable becomes the Any type. -* If the declaration includes neither a type annotation nor an initializer, the type of the variable becomes the Any type. +* If the declaration includes a type annotation, *T* is that type. +* Otherwise, if the declaration includes an initializer expression, *T* is the widened form (section [3.11](#3.11)) of the type of the initializer expression. +* Otherwise, *T* is the Any type. + +When a variable declaration specifies both a type annotation and an initializer expression, the type of the initializer expression is required to be assignable to (section [3.10.4](#3.10.4)) the type given in the type annotation. Multiple declarations for the same variable name in the same declaration space are permitted, provided that each declaration associates the same type with the variable. -Below are some examples of variable declarations and their associated types. +When a variable declaration has a type annotation, it is an error for that type annotation to use the `typeof` operator to reference the variable being declared. + +Below are some examples of simple variable declarations and their associated types. ```TypeScript var a; // any @@ -3141,6 +3270,167 @@ var d: { x: number; y: number; } = { x: 0, y: undefined }; var e = <{ x: number; y: number; }> { x: 0, y: undefined }; ``` +### 5.1.2 Destructuring Variable Declarations + +A ***destructuring variable declaration*** introduces zero or more named variables and initializes them with values extracted from properties of an object or elements of an array. + +  *DestructuringVariableDeclaration:* +   *BindingPattern* *TypeAnnotationopt* *Initialiser* + +  *BindingPattern:* +   *ObjectBindingPattern* +   *ArrayBindingPattern* + +  *ObjectBindingPattern:* +   `{` `}` +   `{` *BindingPropertyList* `,`*opt* `}` + +  *BindingPropertyList:* +   *BindingProperty* +   *BindingPropertyList* `,` *BindingProperty* + +  *BindingProperty:* +   *Identifier* *Initialiseropt* +   *PropertyName* `:` *Identifier* *Initialiseropt* +   *PropertyName* `:` *BindingPattern* *Initialiseropt* + +  *ArrayBindingPattern:* +   `[` *Elisionopt* *BindingRestElementopt* `]` +   `[` *BindingElementList* `]` +   `[` *BindingElementList* `,` *Elisionopt* *BindingRestElementopt* `]` + +  *BindingElementList:* +   *Elisionopt* *BindingElement* +   *BindingElementList* `,` *Elisionopt* *BindingElement* + +  *BindingElement:* +   *Identifier* *Initialiseropt* +   *BindingPattern* *Initialiseropt* + +  *BindingRestElement:* +   `...` *Identifier* + +Each binding property or element that specifies an identifier introduces a variable by that name. The type of the variable is the widened form (section [3.11](#3.11)) of the type associated with the binding property or element, as defined in the following. + +The type *T* associated with a destructuring variable declaration is determined as follows: + +* If the declaration includes a type annotation, *T* is that type. +* Otherwise, if the declaration includes an initializer expression, *T* is the type of that initializer expression. +* Otherwise, *T* is the Any type. + +The type *T* associated with a binding property is determined as follows: + +* Let *S* be the type associated with the immediately containing destructuring variable declaration, binding property, or binding element. +* If *S* is the Any type: + * If the binding property specifies an initializer expression, *T* is the type of that initializer expression. + * Otherwise, *T* is the Any type. +* Let *P* be the property name specified in the binding property. +* If *S* has an apparent property with the name *P*, *T* is the type of that property. +* Otherwise, if *S* has a numeric index signature and *P* is a numerical name, *T* is the type of the numeric index signature. +* Otherwise, if *S* has a string index signature, *T* is the type of the string index signature. +* Otherwise, no type is associated with the binding property and an error occurs. + +The type *T* associated with a binding element is determined as follows: + +* Let *S* be the type associated with the immediately containing destructuring variable declaration, binding property, or binding element. +* If *S* is the Any type: + * If the binding element specifies an initializer expression, *T* is the type of that initializer expression. + * Otherwise, *T* is the Any type. +* If *S* is not an array-like type (section [3.3.2](#3.3.2)), no type is associated with the binding property and an error occurs. +* If the binding element is a rest element, *T* is an array type with an element type *E*, where *E* is the type of the numeric index signature of *S*. +* Otherwise, if *S* is a tuple-like type (section [3.3.3](#3.3.3)): + * Let *N* be the zero-based index of the binding element in the array binding pattern. + * If *S* has a property with the numerical name *N*, *T* is the type of that property. + * Otherwise, no type is associated with the binding element and an error occurs. +* Otherwise, if *S* has a numeric index signature, *T* is the type of the numeric index signature. +* Otherwise, no type is associated with the binding element and an error occurs. + +When a destructuring variable declaration, binding property, or binding element specifies an initializer expression, the type of the initializer expression is required to be assignable to the widened form of the type associated with the destructuring variable declaration, binding property, or binding element. + +When the output target is ECMAScript 6 or higher, except for removing the optional type annotation, destructuring variable declarations remain unchanged in the emitted JavaScript code. + +When the output target is ECMAScript 3 or 5, destructuring variable declarations are rewritten to simple variable declarations. For example, an object destructuring declaration of the form + +```TypeScript +var { x, p: y, q: z = false } = getSomeObject(); +``` + +is rewritten to the simple variable declarations + +```TypeScript +var _a = getSomeObject(), + x = _a.x, + y = _a.p, + _b = _a.q, + z = _b === void 0 ? false : _b; +``` + +The '_a' and '_b' temporary variables exist to ensure the assigned expression is evaluated only once, and the expression 'void 0' simply denotes the JavaScript value 'undefined'. + +Similarly, an array destructuring declaration of the form + +```TypeScript +var [x, y, z = 10] = getSomeArray(); +``` + +is rewritten to the simple variable declarations + +```TypeScript +var _a = getSomeArray(), + x = _a[0], + y = _a[1], + _b = _a[2], + z = _b === void 0 ? 10 : _b; +``` + +Combining both forms of destructuring, the example + +```TypeScript +var { x, p: [y, z = 10] = getSomeArray() } = getSomeObject(); +``` + +is rewritten to + +```TypeScript +var _a = getSomeObject(), + x = _a.x, + _b = _a.p, + _c = _b === void 0 ? getSomeArray() : _b, + y = _c[0], + _d = _c[1], + z = _d === void 0 ? 10 : _d; +``` + +### 5.1.3 Implied Type + +A variable, parameter, binding property, or binding element declaration that specifies a binding pattern has an ***implied type*** which is determined as follows: + +* If the declaration specifies an object binding pattern, the implied type is an object type with a set of properties corresponding to the specified binding property declarations. The type of each property is the type implied by its binding property declaration, and a property is optional when its binding property declaration specifies an initializer expression. +* If the declaration specifies an array binding pattern without a rest element, the implied type is a tuple type with elements corresponding to the specified binding element declarations. The type of each element is the type implied by its binding element declaration. +* If the declaration specifies an array binding pattern with a rest element, the implied type is an array type with an element type of Any. + +The implied type of a binding property or binding element declaration is + +* the type of the declaration's initializer expression, if any, or otherwise +* the implied type of the binding pattern specified in the declaration, if any, or otherwise +* the type Any. + +In the example + +```TypeScript +function f({ a, b = "hello", c = 1 }) { ... } +``` + +the implied type of the binding pattern in the function's parameter is '{ a: any; b?: string; c?: number; }'. Since the parameter has no type annotation, this becomes the type of the parameter. + +In the example + +```TypeScript +var [a, b, c] = [1, "hello", true]; +``` + +the array literal initializer expression is contextually typed by the implied type of the binding pattern, specifically the tuple type '[any, any, any]'. Because the contextual type is a tuple type, the resulting type of the array literal is the tuple type '[number, string, boolean]', and the destructuring declaration thus gives the types number, string, and boolean to a, b, and c respectively. + ## 5.2 If, Do, and While Statements Expressions controlling 'if', 'do', and 'while' statements can be of any type (and not just type Boolean). @@ -3304,7 +3594,7 @@ In the signature of a function implementation, a parameter can be marked optiona Initializer expressions are evaluated in the scope of the function body but are not permitted to reference local variables and are only permitted to access parameters that are declared to the left of the parameter they initialize, unless the parameter reference occurs in a nested function expression. -For each parameter with an initializer, a statement that substitutes the default value for an omitted argument is included in the generated JavaScript, as described in section [6.5](#6.5). The example +For each parameter with an initializer, a statement that substitutes the default value for an omitted argument is included in the generated JavaScript, as described in section [6.6](#6.6). The example ```TypeScript function strange(x: number, y = x * 2, z = x + y) { @@ -3333,7 +3623,65 @@ function f(a = x) { the local variable 'x' is in scope in the parameter initializer (thus hiding the outer 'x'), but it is an error to reference it because it will always be uninitialized at the time the parameter initializer is evaluated. -## 6.4 Generic Functions +## 6.4 Destructuring Parameter Declarations + +Parameter declarations can specify binding patterns (section [3.8.2.2](#3.8.2.2)) and are then called ***destructuring parameter declarations***. Similar to a destructuring variable declaration (section [5.1.2](#5.1.2)), a destructuring parameter declaration introduces zero or more named locals and initializes them with values extracted from properties or elements of the object or array passed as an argument for the parameter. + +The type of local introduced in a destructuring parameter declaration is determined in the same manner as a local introduced by a destructuring variable declaration, except the type *T* associated with a destructuring parameter declaration is determined as follows: + +* If the declaration includes a type annotation, *T* is that type. +* Otherwise, if the declaration includes an initializer expression, *T* is the widened form (section [3.11](#3.11)) of the type of the initializer expression. +* Otherwise, if the declaration specifies a binding pattern, *T* is the implied type of that binding pattern (section [5.1.3](#5.1.3)). +* Otherwise, if the parameter is a rest parameter, *T* is `any[]`. +* Otherwise, *T* is `any`. + +When the output target is ECMAScript 6 or higher, except for removing the optional type annotation, destructuring parameter declarations remain unchanged in the emitted JavaScript code. When the output target is ECMAScript 3 or 5, destructuring parameter declarations are rewritten to local variable declarations. + +The example + +```TypeScript +function drawText({ text = "", location: [x, y] = [0, 0], bold = false }) { + // Draw text +} +``` + +declares a function `drawText` that takes a single parameter of the type + +```TypeScript +{ text?: string; location?: [number, number]; bold?: boolean; } +``` + +When the output target is ECMAScript 3 or 5, the function is rewritten to + +```TypeScript +function drawText(_a) { + var _b = _a.text, + text = _b === void 0 ? "" : _b, + _c = _a.location, + _d = _c === void 0 ? [0, 0] : _c, + x = _d[0], + y = _d[1], + _e = _a.bold, + bold = _e === void 0 ? false : _e; + // Draw text +} +``` + +Destructuring parameter declarations do not permit type annotations on the individual binding patterns, as such annotations would conflict with the already established meaning of colons in object literals. Type annotations must instead be written on the top-level parameter declaration. For example + +```TypeScript +interface DrawTextInfo { + text?: string; + location?: [number, number]; + bold?: boolean; +} + +function drawText({ text, location: [x, y], bold }: DrawTextInfo) { + // Draw text +} +``` + +## 6.5 Generic Functions A function implementation may include type parameters in its signature (section [3.8.2.1](#3.8.2.1)) and is then called a ***generic function***. Type parameters provide a mechanism for expressing relationships between parameter and return types in call operations. Type parameters have no run-time representation—they are purely a compile-time construct. @@ -3368,7 +3716,7 @@ class Person { the type argument to 'compare' is automatically inferred to be the String type because the two arguments are strings. -## 6.5 Code Generation +## 6.6 Code Generation A function declaration generates JavaScript code that is equivalent to: @@ -3543,7 +3891,7 @@ class Location { } ``` -In the above example, 'SelectableControl' contains all of the members of 'Control', including the private 'state' property. Since 'state' is a private member it is only possible for descendants of 'Control' to implement 'SelectableControl'. This is because only descendants of 'Control' will have a 'state' private member that originates in the same declaration, which is a requirement for private members to be compatible (section [0](#0)). +In the above example, 'SelectableControl' contains all of the members of 'Control', including the private 'state' property. Since 'state' is a private member it is only possible for descendants of 'Control' to implement 'SelectableControl'. This is because only descendants of 'Control' will have a 'state' private member that originates in the same declaration, which is a requirement for private members to be compatible (section [3.10](#3.10)). Within the 'Control' class it is possible to access the 'state' private member through an instance of 'SelectableControl'. Effectively, a 'SelectableControl' acts like a 'Control' that is known to have a 'select' method. The 'Button' and 'TextBox' classes are subtypes of 'SelectableControl' (because they both inherit from 'Control' and have a 'select' method), but the 'Image' and 'Location' classes are not. @@ -4183,7 +4531,7 @@ var = (function () { *ConstructorParameters* is a comma separated list of the constructor's parameter names. -*DefaultValueAssignments* is a sequence of default property value assignments corresponding to those generated for a regular function declaration, as described in section [6.5](#6.5). +*DefaultValueAssignments* is a sequence of default property value assignments corresponding to those generated for a regular function declaration, as described in section [6.6](#6.6). *ParameterPropertyAssignments* is a sequence of assignments, one for each parameter property declaration in the constructor, in order they are declared, of the form @@ -4223,7 +4571,7 @@ and static member function declaration generates a statement of the form } ``` -where *MemberName* is the name of the member function, and *FunctionParameters*, *DefaultValueAssignments*, and *FunctionStatements* correspond to those generated for a regular function declaration, as described in section [6.5](#6.5). +where *MemberName* is the name of the member function, and *FunctionParameters*, *DefaultValueAssignments*, and *FunctionStatements* correspond to those generated for a regular function declaration, as described in section [6.6](#6.6). A get or set instance member accessor declaration, or a pair of get and set instance member accessor declarations with the same name, generates a statement of the form @@ -4351,12 +4699,14 @@ An enum type is a distinct subtype of the Number primitive type with an associat An enum declaration declares an ***enum type*** and an ***enum object*** in the containing module.   *EnumDeclaration:* -   `enum` *Identifier* `{` *EnumBodyopt* `}` +   `const`*opt* `enum` *Identifier* `{` *EnumBodyopt* `}` The enum type and enum object declared by an *EnumDeclaration* both have the name given by the *Identifier* of the declaration. The enum type is a distinct subtype of the Number primitive type. The enum object is a variable of an anonymous object type containing a set of properties, all of the enum type, corresponding to the values declared for the enum type in the body of the declaration. The enum object's type furthermore includes a numeric index signature with the signature '[x: number]: string'. The *Identifier* of an enum declaration may not be one of the predefined type names (section [3.7.1](#3.7.1)). +When an enum declaration includes a `const` modifier it is said to be a constant enum declaration. The members of a constant enum declaration must all have constant values that can be computed at compile time. Constant enum declarations are discussed in section [9.4](#9.4). + The example ```TypeScript @@ -4374,7 +4724,7 @@ var Color: { }; ``` -The numeric index signature reflects a "reverse mapping" that is automatically generated in every enum object, as described in section [9.4](#9.4). The reverse mapping provides a convenient way to obtain the string representation of an enum value. For example +The numeric index signature reflects a "reverse mapping" that is automatically generated in every enum object, as described in section [9.5](#9.5). The reverse mapping provides a convenient way to obtain the string representation of an enum value. For example ```TypeScript var c = Color.Red; @@ -4385,43 +4735,37 @@ console.log(Color[c]); // Outputs "Red" The body of an enum declaration defines zero or more enum members which are the named values of the enum type. Each enum member has an associated numeric value of the primitive type introduced by the enum declaration. -  *EnumBody*: -   *ConstantEnumMembers* `,`*opt* -   *ConstantEnumMembers* `,` *EnumMemberSections* `,`*opt* -   *EnumMemberSections* `,`*opt* +  *EnumBody:* +   *EnumMemberList* `,`*opt* -  *ConstantEnumMembers:* +  *EnumMemberList:* +   *EnumMember* +   *EnumMemberList* `,` *EnumMember* + +  *EnumMember:*    *PropertyName* -   *ConstantEnumMembers* `,` *PropertyName* +   *PropertyName* = *EnumValue* -  *EnumMemberSections:* -   *EnumMemberSection* -   *EnumMemberSections* `,` *EnumMemberSection* - -  *EnumMemberSection:* -   *ConstantEnumMemberSection* -   *ComputedEnumMember* - -  *ConstantEnumMemberSection:* -   *PropertyName* `=` *ConstantEnumValue* -   *PropertyName* `=` *ConstantEnumValue* `,` *ConstantEnumMembers* - -  *ConstantEnumValue:* -   *SignedInteger* -   *HexIntegerLiteral* - -  *ComputedEnumMember:* -   *PropertyName* `=` *AssignmentExpression* +  *EnumValue:* +   *AssignmentExpression* Enum members are either ***constant members*** or ***computed members***. Constant members have known constant values that are substituted in place of references to the members in the generated JavaScript code. Computed members have values that are computed at run-time and not known at compile-time. No substitution is performed for references to computed members. -The body of an enum declaration consists of an optional *ConstantEnumMembers* production followed by any number of *ConstantEnumMemberSection* or *ComputedEnumMember* productions. +An enum member is classified as follows: -* If present, the initial *ConstantEnumMembers* production introduces a series of constant members with consecutive integral values starting at the value zero. -* A *ConstantEnumMemberSection* introduces one or more constant members with consecutive integral values starting at the specified constant value. -* A *ComputedEnumMember* introduces a computed member with a value computed by an expression. +* If the member declaration specifies no value, the member is considered a constant enum member. If the member is the first member in the enum declaration, it is assigned the value zero. Otherwise, it is assigned the value of the immediately preceding member plus one, and an error occurs if the immediately preceding member is not a constant enum member. +* If the member declaration specifies a value that can be classified as a constant enum expression (as defined below), the member is considered a constant enum member. +* Otherwise, the member is considered a computed enum member. -Expressions specified for computed members must produce values of type Any, the Number primitive type, or the enum type itself. +Enum value expressions must be of type Any, the Number primitive type, or the enum type itself. + +A ***constant enum expression*** is a subset of the expression grammar that can be evaluated fully at compile time. An expression is considered a constant enum expression if it is one of the following: + +* A numeric literal. +* An identifier or property access that denotes a previously declared member in the same constant enum declaration. +* A parenthesized constant enum expression. +* A +, –, or ~ unary operator applied to a constant enum expression. +* A +, –, *, /, %, <<, >>, >>>, &, ^, or | operator applied to two constant enum expressions. In the example @@ -4450,7 +4794,7 @@ enum Style { } ``` -the first four members are constant members and the last two are computed members. Note that computed member declarations can reference other enum members without qualification. Also, because enums are subtypes of the Number primitive type, numeric operators, such as the bitwise OR operator, can be used to compute enum values. +all members are constant members. Note that enum member declarations can reference other enum members without qualification. Also, because enums are subtypes of the Number primitive type, numeric operators, such as the bitwise OR operator, can be used to compute enum values. ## 9.3 Declaration Merging @@ -4458,7 +4802,29 @@ Enums are "open-ended" and enum declarations with the same qualified name relati It isn't possible for one enum declaration to continue the automatic numbering sequence of another, and when an enum type has multiple declarations, only one declaration is permitted to omit a value for the first member. -## 9.4 Code Generation +When enum declarations are merged, they must either all specify a `const` modifier or all specify no `const` modifier. + +## 9.4 Constant Enum Declarations + +An enum declaration that specifies a `const` modifier is a ***constant enum declaration***. In a constant enum declaration, all members must have constant values and it is an error for a member declaration to specify an expression that isn't classified as a constant enum expression. + +Unlike regular enum declarations, constant enum declarations are completely erased in the emitted JavaScript code. For this reason, it is an error to reference a constant enum object in any other context than a property access that selects one of the enum's members. For example: + +```TypeScript +const enum Comparison { + LessThan = -1, + EqualTo = 0, + GreaterThan = 1 +} + +var x = Comparison.EqualTo; // Ok, replaced with 0 in emitted code +var y = Comparison[Comparison.EqualTo]; // Error +var z = Comparison; // Error +``` + +The entire const enum declaration is erased in the emitted JavaScript code. Thus, the only permitted references to the enum object are those that are replaced with an enum member value. + +## 9.5 Code Generation An enum declaration generates JavaScript equivalent to the following: @@ -5119,23 +5485,17 @@ An ambient class declaration declares a class instance type and a constructor fu ### 12.1.4 Ambient Enum Declarations -An ambient enum declaration declares an enum type and an enum object in the containing module. +An ambient enum is grammatically equivalent to a non-ambient enum declaration.   *AmbientEnumDeclaration:* -   `enum` *Identifier* `{` *AmbientEnumBodyopt* `}` +   *EnumDeclaration* -  *AmbientEnumBody:* -   *AmbientEnumMemberList* `,`*opt* +Ambient enum declarations differ from non-ambient enum declarations in two ways: -  *AmbientEnumMemberList:* -   *AmbientEnumMember* -   *AmbientEnumMemberList* `,` *AmbientEnumMember* +* In ambient enum declarations, all values specified in enum member declarations must be classified as constant enum expressions. +* In ambient enum declarations that specify no `const` modifier, enum member declarations that omit a value are considered computed members (as opposed to having auto-incremented values assigned). -  *AmbientEnumMember:* -   *PropertyName* -   *PropertyName* = *ConstantEnumValue* - -An *AmbientEnumMember* that includes a *ConstantEnumValue* value is considered a constant member. An *AmbientEnumMember* with no *ConstantEnumValue* value is considered a computed member. +Ambient enum declarations are otherwise processed in the same manner as non-ambient enum declarations. ### 12.1.5 Ambient Module Declarations @@ -5167,7 +5527,7 @@ Except for *ImportDeclarations*, *AmbientModuleElements* always declare exported An *AmbientExternalModuleDeclaration* declares an external module. This type of declaration is permitted only at the top level in a source file that contributes to the global module (section [11.1](#11.1)). The *StringLiteral* must specify a top-level external module name. Relative external module names are not permitted.   *AmbientExternalModuleDeclaration:* -   `module` *StringLiteral* `{`  *AmbientExternalModuleBody* `}` +   `declare` `module` *StringLiteral* `{`  *AmbientExternalModuleBody* `}`   *AmbientExternalModuleBody:*    *AmbientExternalModuleElementsopt* @@ -5394,6 +5754,15 @@ This appendix contains a summary of the grammar found in the main document. As d   *SetAccessor:*    `set` *PropertyName* `(` *Identifier* *TypeAnnotationopt* `)` `{` *FunctionBody* `}` +  *ElementList:* *( Modified )* +   *Elisionopt* *AssignmentExpression* +   *Elisionopt* *SpreadElement* +   *ElementList* `,` *Elisionopt* *AssignmentExpression* +   *ElementList* `,` *Elisionopt* *SpreadElement* + +  *SpreadElement:* +   `...` *AssignmentExpression* +   *CallExpression:* *( Modified )*    …    `super` `(` *ArgumentListopt* `)` @@ -5424,14 +5793,51 @@ This appendix contains a summary of the grammar found in the main document. As d ## A.3 Statements   *VariableDeclaration:* *( Modified )* -   *Identifier* *TypeAnnotationopt* *Initialiseropt* +   *SimpleVariableDeclaration* +   *DestructuringVariableDeclaration* -  *VariableDeclarationNoIn:* *( Modified )* -   *Identifier* *TypeAnnotationopt* *InitialiserNoInopt* +  *SimpleVariableDeclaration:* +   *Identifier* *TypeAnnotationopt* *Initialiseropt*   *TypeAnnotation:*    `:` *Type* +  *DestructuringVariableDeclaration:* +   *BindingPattern* *TypeAnnotationopt* *Initialiser* + +  *BindingPattern:* +   *ObjectBindingPattern* +   *ArrayBindingPattern* + +  *ObjectBindingPattern:* +   `{` `}` +   `{` *BindingPropertyList* `,`*opt* `}` + +  *BindingPropertyList:* +   *BindingProperty* +   *BindingPropertyList* `,` *BindingProperty* + +  *BindingProperty:* +   *Identifier* *Initialiseropt* +   *PropertyName* `:` *Identifier* *Initialiseropt* +   *PropertyName* `:` *BindingPattern* *Initialiseropt* + +  *ArrayBindingPattern:* +   `[` *Elisionopt* *BindingRestElementopt* `]` +   `[` *BindingElementList* `]` +   `[` *BindingElementList* `,` *Elisionopt* *BindingRestElementopt* `]` + +  *BindingElementList:* +   *Elisionopt* *BindingElement* +   *BindingElementList* `,` *Elisionopt* *BindingElement* + +  *BindingElement:* +   *Identifier* *Initialiseropt* +   *BindingPattern* *Initialiseropt* + +  *BindingRestElement:* +   `...` *Identifier* + ## A.4 Functions   *FunctionDeclaration:* *( Modified )* @@ -5535,35 +5941,21 @@ This appendix contains a summary of the grammar found in the main document. As d ## A.7 Enums   *EnumDeclaration:* -   `enum` *Identifier* `{` *EnumBodyopt* `}` +   `const`*opt* `enum` *Identifier* `{` *EnumBodyopt* `}` -  *EnumBody*: -   *ConstantEnumMembers* `,`*opt* -   *ConstantEnumMembers* `,` *EnumMemberSections* `,`*opt* -   *EnumMemberSections* `,`*opt* +  *EnumBody:* +   *EnumMemberList* `,`*opt* -  *ConstantEnumMembers:* +  *EnumMemberList:* +   *EnumMember* +   *EnumMemberList* `,` *EnumMember* + +  *EnumMember:*    *PropertyName* -   *ConstantEnumMembers* `,` *PropertyName* +   *PropertyName* = *EnumValue* -  *EnumMemberSections:* -   *EnumMemberSection* -   *EnumMemberSections* `,` *EnumMemberSection* - -  *EnumMemberSection:* -   *ConstantEnumMemberSection* -   *ComputedEnumMember* - -  *ConstantEnumMemberSection:* -   *PropertyName* `=` *ConstantEnumValue* -   *PropertyName* `=` *ConstantEnumValue* `,` *ConstantEnumMembers* - -  *ConstantEnumValue:* -   *SignedInteger* -   *HexIntegerLiteral* - -  *ComputedEnumMember:* -   *PropertyName* `=` *AssignmentExpression* +  *EnumValue:* +   *AssignmentExpression* ## A.8 Internal Modules @@ -5682,18 +6074,7 @@ This appendix contains a summary of the grammar found in the main document. As d    *AccessibilityModifieropt* `static`*opt* *PropertyName* *CallSignature* `;`   *AmbientEnumDeclaration:* -   `enum` *Identifier* `{` *AmbientEnumBodyopt* `}` - -  *AmbientEnumBody:* -   *AmbientEnumMemberList* `,`*opt* - -  *AmbientEnumMemberList:* -   *AmbientEnumMember* -   *AmbientEnumMemberList* `,` *AmbientEnumMember* - -  *AmbientEnumMember:* -   *PropertyName* -   *PropertyName* = *ConstantEnumValue* +   *EnumDeclaration*   *AmbientModuleDeclaration:*    `module` *IdentifierPath* `{` *AmbientModuleBody* `}` @@ -5715,7 +6096,7 @@ This appendix contains a summary of the grammar found in the main document. As d    `export`*opt* *ImportDeclaration*   *AmbientExternalModuleDeclaration:* -   `module` *StringLiteral* `{`  *AmbientExternalModuleBody* `}` +   `declare` `module` *StringLiteral* `{`  *AmbientExternalModuleBody* `}`   *AmbientExternalModuleBody:*    *AmbientExternalModuleElementsopt* diff --git a/package.json b/package.json index a52067a3d08..2bd89706606 100644 --- a/package.json +++ b/package.json @@ -1,46 +1,46 @@ { - "name": "typescript", - "author": "Microsoft Corp.", - "homepage": "http://typescriptlang.org/", - "version": "1.4.0", - "licenses": [ - { - "type": "Apache License 2.0", - "url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt" - } - ], - "description": "TypeScript is a language for application scale JavaScript development", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript" - ], - "bugs": { - "url" : "https://github.com/Microsoft/TypeScript/issues" - }, - "repository" : { - "type" : "git", - "url" : "https://github.com/Microsoft/TypeScript.git" - }, - "preferGlobal" : true, - "main" : "./bin/typescriptServices.js", - "bin" : { - "tsc" : "./bin/tsc" - }, - "engines" : { - "node" : ">=0.8.0" - }, - "devDependencies": { - "jake" : "latest", - "mocha" : "latest", - "chai" : "latest", - "browserify" : "latest", - "istanbul": "latest", - "codeclimate-test-reporter": "latest" - }, - "scripts": { - "test": "jake generate-code-coverage" - } + "name": "typescript", + "author": "Microsoft Corp.", + "homepage": "http://typescriptlang.org/", + "version": "1.5.0", + "licenses": [ + { + "type": "Apache License 2.0", + "url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt" + } + ], + "description": "TypeScript is a language for application scale JavaScript development", + "keywords": [ + "TypeScript", + "Microsoft", + "compiler", + "language", + "javascript" + ], + "bugs": { + "url": "https://github.com/Microsoft/TypeScript/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/TypeScript.git" + }, + "preferGlobal": true, + "main": "./bin/typescriptServices.js", + "bin": { + "tsc": "./bin/tsc" + }, + "engines": { + "node": ">=0.8.0" + }, + "devDependencies": { + "jake": "latest", + "mocha": "latest", + "chai": "latest", + "browserify": "latest", + "istanbul": "latest", + "codeclimate-test-reporter": "latest" + }, + "scripts": { + "test": "jake generate-code-coverage" + } } diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1d299e8ee5d..bf9df6f0a80 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,6 +1,8 @@ /// module ts { + /* @internal */ export var bindTime = 0; + export const enum ModuleInstanceState { NonInstantiated = 0, Instantiated = 1, @@ -50,17 +52,23 @@ module ts { } /** - * Returns false if any of the following are true: - * 1. declaration has no name - * 2. declaration has a literal name (not computed) - * 3. declaration has a computed property name that is a known symbol + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. */ - export function hasComputedNameButNotSymbol(declaration: Declaration): boolean { + export function hasDynamicName(declaration: Declaration): boolean { return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName; } - export function bindSourceFile(file: SourceFile) { + export function bindSourceFile(file: SourceFile): void { + var start = new Date().getTime(); + bindSourceFileWorker(file); + bindTime += new Date().getTime() - start; + } + function bindSourceFileWorker(file: SourceFile): void { var parent: Node; var container: Node; var blockScopeContainer: Node; @@ -96,7 +104,7 @@ module ts { if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) { return '"' + (node.name).text + '"'; } - Debug.assert(!hasComputedNameButNotSymbol(node)); + Debug.assert(!hasDynamicName(node)); return (node.name).text; } switch (node.kind) { @@ -118,11 +126,7 @@ module ts { } function declareSymbol(symbols: SymbolTable, parent: Symbol, node: Declaration, includes: SymbolFlags, excludes: SymbolFlags): Symbol { - // Nodes with computed property names will not get symbols, because the type checker - // does not make properties for them. - if (hasComputedNameButNotSymbol(node)) { - return undefined; - } + Debug.assert(!hasDynamicName(node)); var name = getDeclarationName(node); if (name !== undefined) { @@ -139,9 +143,9 @@ module ts { : Diagnostics.Duplicate_identifier_0; forEach(symbol.declarations, declaration => { - file.semanticDiagnostics.push(createDiagnosticForNode(declaration.name, message, getDisplayName(declaration))); + file.bindDiagnostics.push(createDiagnosticForNode(declaration.name, message, getDisplayName(declaration))); }); - file.semanticDiagnostics.push(createDiagnosticForNode(node.name, message, getDisplayName(node))); + file.bindDiagnostics.push(createDiagnosticForNode(node.name, message, getDisplayName(node))); symbol = createSymbol(0, name); } @@ -162,7 +166,7 @@ module ts { if (node.name) { node.name.parent = node; } - file.semanticDiagnostics.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], + file.bindDiagnostics.push(createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); } symbol.exports[prototypeSymbol.name] = prototypeSymbol; @@ -396,14 +400,14 @@ module ts { break; case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: - bindDeclaration(node, SymbolFlags.Property | ((node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false); + bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property | ((node).questionToken ? SymbolFlags.Optional : 0), SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false); break; case SyntaxKind.PropertyAssignment: case SyntaxKind.ShorthandPropertyAssignment: - bindDeclaration(node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false); + bindPropertyOrMethodOrAccessor(node, SymbolFlags.Property, SymbolFlags.PropertyExcludes, /*isBlockScopeContainer*/ false); break; case SyntaxKind.EnumMember: - bindDeclaration(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false); + bindPropertyOrMethodOrAccessor(node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes, /*isBlockScopeContainer*/ false); break; case SyntaxKind.CallSignature: case SyntaxKind.ConstructSignature: @@ -416,7 +420,7 @@ module ts { // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. - bindDeclaration(node, SymbolFlags.Method | ((node).questionToken ? SymbolFlags.Optional : 0), + bindPropertyOrMethodOrAccessor(node, SymbolFlags.Method | ((node).questionToken ? SymbolFlags.Optional : 0), isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes, /*isBlockScopeContainer*/ true); break; case SyntaxKind.FunctionDeclaration: @@ -426,10 +430,10 @@ module ts { bindDeclaration(node, SymbolFlags.Constructor, /*symbolExcludes:*/ 0, /*isBlockScopeContainer:*/ true); break; case SyntaxKind.GetAccessor: - bindDeclaration(node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true); + bindPropertyOrMethodOrAccessor(node, SymbolFlags.GetAccessor, SymbolFlags.GetAccessorExcludes, /*isBlockScopeContainer*/ true); break; case SyntaxKind.SetAccessor: - bindDeclaration(node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true); + bindPropertyOrMethodOrAccessor(node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes, /*isBlockScopeContainer*/ true); break; case SyntaxKind.FunctionType: @@ -475,7 +479,7 @@ module ts { break; case SyntaxKind.SourceFile: if (isExternalModule(node)) { - bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((node).filename) + '"', /*isBlockScopeContainer*/ true); + bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((node).fileName) + '"', /*isBlockScopeContainer*/ true); break; } case SyntaxKind.Block: @@ -511,5 +515,14 @@ module ts { declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes); } } + + function bindPropertyOrMethodOrAccessor(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags, isBlockScopeContainer: boolean) { + if (hasDynamicName(node)) { + bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); + } + else { + bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer); + } + } } } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d85c8bdb065..e358fd3909b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5,6 +5,8 @@ module ts { var nextNodeId = 1; var nextMergeId = 1; + /* @internal */ export var checkTime = 0; + export function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker { var Symbol = objectAllocator.getSymbolConstructor(); var Type = objectAllocator.getTypeConstructor(); @@ -48,12 +50,12 @@ module ts { getContextualType, getFullyQualifiedName, getResolvedSignature, - getEnumMemberValue, + getConstantValue, isValidPropertyAccess, getSignatureFromDeclaration, isImplementationOfOverload, getAliasedSymbol: resolveImport, - getEmitResolver: () => emitResolver, + getEmitResolver, }; var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined"); @@ -66,8 +68,8 @@ module ts { var numberType = createIntrinsicType(TypeFlags.Number, "number"); var booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); var voidType = createIntrinsicType(TypeFlags.Void, "void"); - var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.Unwidened, "undefined"); - var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.Unwidened, "null"); + var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); + var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); var unknownType = createIntrinsicType(TypeFlags.Any, "unknown"); var resolvingType = createIntrinsicType(TypeFlags.Any, "__resolving__"); @@ -104,19 +106,35 @@ module ts { var nodeLinks: NodeLinks[] = []; var potentialThisCollisions: Node[] = []; - var diagnostics: Diagnostic[] = []; - var diagnosticsModified: boolean = false; + var diagnostics = createDiagnosticCollection(); - function addDiagnostic(diagnostic: Diagnostic) { - diagnostics.push(diagnostic); - diagnosticsModified = true; + var primitiveTypeInfo: Map<{ type: Type; flags: TypeFlags }> = { + "string": { + type: stringType, + flags: TypeFlags.StringLike + }, + "number": { + type: numberType, + flags: TypeFlags.NumberLike + }, + "boolean": { + type: booleanType, + flags: TypeFlags.Boolean + } + }; + + function getEmitResolver(sourceFile?: SourceFile) { + // Ensure we have all the type information in place for this file so that all the + // emitter questions of this resolver will return the right information. + getDiagnostics(sourceFile); + return emitResolver; } function error(location: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { var diagnostic = location ? createDiagnosticForNode(location, message, arg0, arg1, arg2) : createCompilerDiagnostic(message, arg0, arg1, arg2); - addDiagnostic(diagnostic); + diagnostics.add(diagnostic); } function createSymbol(flags: SymbolFlags, name: string): Symbol { @@ -337,6 +355,25 @@ module ts { break loop; } break; + + // It is not legal to reference a class's own type parameters from a computed property name that + // belongs to the class. For example: + // + // function foo() { return '' } + // class C { // <-- Class's own type parameter T + // [foo()]() { } // <-- Reference to T from class's own computed property + // } + // + case SyntaxKind.ComputedPropertyName: + var grandparent = location.parent.parent; + if (grandparent.kind === SyntaxKind.ClassDeclaration || grandparent.kind === SyntaxKind.InterfaceDeclaration) { + // A reference to this grandparent's type parameters would be an error + if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & SymbolFlags.Type)) { + error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + return undefined; + } + } + break; case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: case SyntaxKind.Constructor: @@ -504,7 +541,7 @@ module ts { } var moduleReferenceLiteral = moduleReferenceExpression; - var searchPath = getDirectoryPath(getSourceFile(location).filename); + var searchPath = getDirectoryPath(getSourceFile(location).fileName); // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. @@ -519,8 +556,8 @@ module ts { } } while (true) { - var filename = normalizePath(combinePaths(searchPath, moduleName)); - var sourceFile = host.getSourceFile(filename + ".ts") || host.getSourceFile(filename + ".d.ts"); + var fileName = normalizePath(combinePaths(searchPath, moduleName)); + var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); if (sourceFile || isRelative) break; var parentPath = getDirectoryPath(searchPath); if (parentPath === searchPath) break; @@ -530,7 +567,7 @@ module ts { if (sourceFile.symbol) { return getResolvedExportSymbol(sourceFile.symbol); } - error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.filename); + error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); return; } error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName); @@ -1035,7 +1072,7 @@ module ts { * Enclosing declaration is optional when we don't want to get qualified name in the enclosing declaration scope * Meaning needs to be specified if the enclosing declaration is given */ - function buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void { + function buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags, typeFlags?: TypeFormatFlags): void { var parentSymbol: Symbol; function appendParentTypeArgumentsAndSymbolName(symbol: Symbol): void { if (parentSymbol) { @@ -1097,11 +1134,12 @@ module ts { } } - // Get qualified name - if (enclosingDeclaration && - // TypeParameters do not need qualification - !(symbol.flags & SymbolFlags.TypeParameter)) { - + // Get qualified name if the symbol is not a type parameter + // and there is an enclosing declaration or we specifically + // asked for it + var isTypeParameter = symbol.flags & SymbolFlags.TypeParameter; + var typeFormatFlag = TypeFormatFlags.UseFullyQualifiedType & typeFlags; + if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) { walkSymbol(symbol, meaning); return; } @@ -1124,7 +1162,8 @@ module ts { writeTypeReference(type, flags); } else if (type.flags & (TypeFlags.Class | TypeFlags.Interface | TypeFlags.Enum | TypeFlags.TypeParameter)) { - buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type); + // The specified symbol flags need to be reinterpreted as type flags + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, flags); } else if (type.flags & TypeFlags.Tuple) { writeTupleType(type); @@ -1195,17 +1234,18 @@ module ts { function writeAnonymousType(type: ObjectType, flags: TypeFormatFlags) { // Always use 'typeof T' for type of class, enum, and module objects if (type.symbol && type.symbol.flags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)) { - writeTypeofSymbol(type); + writeTypeofSymbol(type, flags); } // Use 'typeof T' for types of functions and methods that circularly reference themselves else if (shouldWriteTypeOfFunctionSymbol()) { - writeTypeofSymbol(type); + writeTypeofSymbol(type, flags); } else if (typeStack && contains(typeStack, type)) { // If type is an anonymous type literal in a type alias declaration, use type alias name var typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { - buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, SymbolFlags.Type); + // The specified symbol flags need to be reinterpreted as type flags + buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, SymbolFlags.Type, SymbolFormatFlags.None, flags); } else { // Recursive usage, use any @@ -1239,10 +1279,10 @@ module ts { } } - function writeTypeofSymbol(type: ObjectType) { + function writeTypeofSymbol(type: ObjectType, typeFormatFlags?: TypeFormatFlags) { writeKeyword(writer, SyntaxKind.TypeOfKeyword); writeSpace(writer); - buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value); + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, SymbolFlags.Value, SymbolFormatFlags.None, typeFormatFlags); } function getIndexerParameterName(type: ObjectType, indexKind: IndexKind, fallbackName: string): string { @@ -1660,7 +1700,7 @@ module ts { // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, // or otherwise the type of the string index signature. var type = getTypeOfPropertyOfType(parentType, name.text) || - isNumericName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) || + isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) || getIndexTypeOfType(parentType, IndexKind.String); if (!type) { error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), declarationNameToString(name)); @@ -1706,7 +1746,7 @@ module ts { if (declaration.kind === SyntaxKind.Parameter) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === SyntaxKind.SetAccessor && !hasComputedNameButNotSymbol(func)) { + if (func.kind === SyntaxKind.SetAccessor && !hasDynamicName(func)) { var getter = getDeclarationOfKind(declaration.parent.symbol, SyntaxKind.GetAccessor); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); @@ -2622,7 +2662,7 @@ module ts { else { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === SyntaxKind.GetAccessor && !hasComputedNameButNotSymbol(declaration)) { + if (declaration.kind === SyntaxKind.GetAccessor && !hasDynamicName(declaration)) { var setter = getDeclarationOfKind(declaration.symbol, SyntaxKind.SetAccessor); returnType = getAnnotatedAccessorType(setter); } @@ -2807,15 +2847,22 @@ module ts { } } - function getUnwidenedFlagOfTypes(types: Type[]): TypeFlags { - return forEach(types, t => t.flags & TypeFlags.Unwidened) || 0; + // This function is used to propagate widening flags when creating new object types references and union types. + // It is only necessary to do so if a constituent type might be the undefined type, the null type, or the type + // of an object literal (since those types have widening related information we need to track). + function getWideningFlagsOfTypes(types: Type[]): TypeFlags { + var result: TypeFlags = 0; + for (var i = 0; i < types.length; i++) { + result |= types[i].flags; + } + return result & TypeFlags.RequiresWidening; } function createTypeReference(target: GenericType, typeArguments: Type[]): TypeReference { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = TypeFlags.Reference | getUnwidenedFlagOfTypes(typeArguments); + var flags = TypeFlags.Reference | getWideningFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -3076,7 +3123,7 @@ module ts { var id = getTypeListId(sortedTypes); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(TypeFlags.Union | getUnwidenedFlagOfTypes(sortedTypes)); + type = unionTypes[id] = createObjectType(TypeFlags.Union | getWideningFlagsOfTypes(sortedTypes)); type.types = sortedTypes; } return type; @@ -3367,9 +3414,9 @@ module ts { // TYPE CHECKING - var subtypeRelation: Map = {}; - var assignableRelation: Map = {}; - var identityRelation: Map = {}; + var subtypeRelation: Map = {}; + var assignableRelation: Map = {}; + var identityRelation: Map = {}; function isTypeIdenticalTo(source: Type, target: Type): boolean { return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined); @@ -3404,7 +3451,7 @@ module ts { function checkTypeRelatedTo( source: Type, target: Type, - relation: Map, + relation: Map, errorNode: Node, headMessage?: DiagnosticMessage, containingMessageChain?: DiagnosticMessageChain): boolean { @@ -3412,7 +3459,7 @@ module ts { var errorInfo: DiagnosticMessageChain; var sourceStack: ObjectType[]; var targetStack: ObjectType[]; - var maybeStack: Map[]; + var maybeStack: Map[]; var expandingFlags: number; var depth = 0; var overflow = false; @@ -3424,10 +3471,19 @@ module ts { error(errorNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); } else if (errorInfo) { + // If we already computed this relation, but in a context where we didn't want to report errors (e.g. overload resolution), + // then we'll only have a top-level error (e.g. 'Class X does not implement interface Y') without any details. If this happened, + // request a recompuation to get a complete error message. This will be skipped if we've already done this computation in a context + // where errors were being reported. + if (errorInfo.next === undefined) { + errorInfo = undefined; + isRelatedTo(source, target, errorNode !== undefined, headMessage, /* elaborateErrors */ true); + } if (containingMessageChain) { errorInfo = concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); } - addDiagnostic(createDiagnosticForNodeFromMessageChain(errorNode, errorInfo, host.getCompilerHost().getNewLine())); + + diagnostics.add(createDiagnosticForNodeFromMessageChain(errorNode, errorInfo)); } return result !== Ternary.False; @@ -3439,7 +3495,7 @@ module ts { // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or // Ternary.False if they are not related. - function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary { + function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage, elaborateErrors = false): Ternary { var result: Ternary; // both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases if (source === target) return Ternary.True; @@ -3506,14 +3562,20 @@ module ts { // identity relation does not use apparent type var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); if (sourceOrApparentType.flags & TypeFlags.ObjectType && target.flags & TypeFlags.ObjectType && - (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors))) { + (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } } if (reportErrors) { headMessage = headMessage || Diagnostics.Type_0_is_not_assignable_to_type_1; - reportError(headMessage, typeToString(source), typeToString(target)); + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); + targetType = typeToString(target, /*enclosingDeclaration*/ undefined, TypeFormatFlags.UseFullyQualifiedType); + } + reportError(headMessage, sourceType, targetType); } return Ternary.False; } @@ -3597,14 +3659,19 @@ module ts { // Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are // equal and infinitely expanding. Fourth, if we have reached a depth of 100 nested comparisons, assume we have runaway recursion // and issue an error. Otherwise, actually compare the structure of the two types. - function objectTypeRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean): Ternary { + function objectTypeRelatedTo(source: ObjectType, target: ObjectType, reportErrors: boolean, elaborateErrors = false): Ternary { if (overflow) { return Ternary.False; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; + //var related: RelationComparisonResult = undefined; // relation[id]; if (related !== undefined) { - return related ? Ternary.True : Ternary.False; + // If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate + // errors, we can use the cached value. Otherwise, recompute the relation + if (!elaborateErrors || (related === RelationComparisonResult.FailedAndReported)) { + return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False; + } } if (depth > 0) { for (var i = 0; i < depth; i++) { @@ -3627,7 +3694,7 @@ module ts { sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; - maybeStack[depth][id] = true; + maybeStack[depth][id] = RelationComparisonResult.Succeeded; depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) expandingFlags |= 1; @@ -3655,13 +3722,13 @@ module ts { if (result) { var maybeCache = maybeStack[depth]; // If result is definitely true, copy assumptions to global cache, else copy to next level up - var destinationCache = result === Ternary.True || depth === 0 ? relation : maybeStack[depth - 1]; - copyMap(/*source*/maybeCache, /*target*/destinationCache); + var destinationCache = (result === Ternary.True || depth === 0) ? relation : maybeStack[depth - 1]; + copyMap(maybeCache, destinationCache); } else { // A false result goes straight into global cache (when something is false under assumptions it // will also be false without assumptions) - relation[id] = false; + relation[id] = reportErrors ? RelationComparisonResult.FailedAndReported : RelationComparisonResult.Failed; } return result; } @@ -3692,12 +3759,13 @@ module ts { } var result = Ternary.True; var properties = getPropertiesOfObjectType(target); + var requireOptionalProperties = relation === subtypeRelation && !(source.flags & TypeFlags.ObjectLiteral); for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (relation === subtypeRelation || !(targetProp.flags & SymbolFlags.Optional)) { + if (!(targetProp.flags & SymbolFlags.Optional) || requireOptionalProperties) { if (reportErrors) { reportError(Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } @@ -4088,10 +4156,6 @@ module ts { errorMessageChainHead); } - function isTypeOfObjectLiteral(type: Type): boolean { - return (type.flags & TypeFlags.Anonymous) && type.symbol && (type.symbol.flags & SymbolFlags.ObjectLiteral) ? true : false; - } - function isArrayType(type: Type): boolean { return type.flags & TypeFlags.Reference && (type).target === globalArrayType; } @@ -4104,13 +4168,18 @@ module ts { var properties = getPropertiesOfObjectType(type); var members: SymbolTable = {}; forEach(properties, p => { - var symbol = createSymbol(p.flags | SymbolFlags.Transient, p.name); - symbol.declarations = p.declarations; - symbol.parent = p.parent; - symbol.type = getWidenedType(getTypeOfSymbol(p)); - symbol.target = p; - if (p.valueDeclaration) symbol.valueDeclaration = p.valueDeclaration; - members[symbol.name] = symbol; + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + var symbol = createSymbol(p.flags | SymbolFlags.Transient, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedType; + symbol.target = p; + if (p.valueDeclaration) symbol.valueDeclaration = p.valueDeclaration; + p = symbol; + } + members[p.name] = p; }); var stringIndexType = getIndexTypeOfType(type, IndexKind.String); var numberIndexType = getIndexTypeOfType(type, IndexKind.Number); @@ -4120,16 +4189,16 @@ module ts { } function getWidenedType(type: Type): Type { - if (type.flags & TypeFlags.Unwidened) { + if (type.flags & TypeFlags.RequiresWidening) { if (type.flags & (TypeFlags.Undefined | TypeFlags.Null)) { return anyType; } + if (type.flags & TypeFlags.ObjectLiteral) { + return getWidenedTypeOfObjectLiteral(type); + } if (type.flags & TypeFlags.Union) { return getUnionType(map((type).types, getWidenedType)); } - if (isTypeOfObjectLiteral(type)) { - return getWidenedTypeOfObjectLiteral(type); - } if (isArrayType(type)) { return createArrayType(getWidenedType((type).typeArguments[0])); } @@ -4150,11 +4219,11 @@ module ts { if (isArrayType(type)) { return reportWideningErrorsInType((type).typeArguments[0]); } - if (isTypeOfObjectLiteral(type)) { + if (type.flags & TypeFlags.ObjectLiteral) { var errorReported = false; forEach(getPropertiesOfObjectType(type), p => { var t = getTypeOfSymbol(p); - if (t.flags & TypeFlags.Unwidened) { + if (t.flags & TypeFlags.ContainsUndefinedOrNull) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -4198,7 +4267,7 @@ module ts { } function reportErrorsFromWidening(declaration: Declaration, type: Type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & TypeFlags.Unwidened) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & TypeFlags.ContainsUndefinedOrNull) { // Report implicit any error within type if possible, otherwise report error on declaration if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); @@ -4275,6 +4344,9 @@ module ts { } function inferFromTypes(source: Type, target: Type) { + if (source === anyFunctionType) { + return; + } if (target.flags & TypeFlags.TypeParameter) { // If target is a type parameter, make an inference var typeParameters = context.typeParameters; @@ -4454,12 +4526,17 @@ module ts { Debug.fail("should not get here"); } - // Remove one or more primitive types from a union type - function subtractPrimitiveTypes(type: Type, subtractMask: TypeFlags): Type { + // For a union type, remove all constituent types that are of the given type kind (when isOfTypeKind is true) + // or not of the given type kind (when isOfTypeKind is false) + function removeTypesFromUnionType(type: Type, typeKind: TypeFlags, isOfTypeKind: boolean): Type { if (type.flags & TypeFlags.Union) { var types = (type).types; - if (forEach(types, t => t.flags & subtractMask)) { - return getUnionType(filter(types, t => !(t.flags & subtractMask))); + if (forEach(types, t => !!(t.flags & typeKind) === isOfTypeKind)) { + // Above we checked if we have anything to remove, now use the opposite test to do the removal + var narrowedType = getUnionType(filter(types, t => !(t.flags & typeKind) === isOfTypeKind)); + if (narrowedType !== emptyObjectType) { + return narrowedType; + } } } return type; @@ -4635,8 +4712,8 @@ module ts { // Stop at the first containing function or module declaration break loop; } - // Use narrowed type if it is a subtype and construct contains no assignments to variable - if (narrowedType !== type && isTypeSubtypeOf(narrowedType, type)) { + // Use narrowed type if construct contains no assignments to variable + if (narrowedType !== type) { if (isVariableAssignedWithin(symbol, node)) { break; } @@ -4656,20 +4733,30 @@ module ts { if (left.expression.kind !== SyntaxKind.Identifier || getResolvedSymbol(left.expression) !== symbol) { return type; } - var t = right.text; - var checkType: Type = t === "string" ? stringType : t === "number" ? numberType : t === "boolean" ? booleanType : emptyObjectType; + var typeInfo = primitiveTypeInfo[right.text]; if (expr.operator === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } if (assumeTrue) { - // The assumed result is true. If check was for a primitive type, that type is the narrowed type. Otherwise we can - // remove the primitive types from the narrowed type. - return checkType === emptyObjectType ? subtractPrimitiveTypes(type, TypeFlags.String | TypeFlags.Number | TypeFlags.Boolean) : checkType; + // Assumed result is true. If check was not for a primitive type, remove all primitive types + if (!typeInfo) { + return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean, /*isOfTypeKind*/ true); + } + // Check was for a primitive type, return that primitive type if it is a subtype + if (isTypeSubtypeOf(typeInfo.type, type)) { + return typeInfo.type; + } + // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is + // union of enum types and other types. + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false); } else { - // The assumed result is false. If check was for a primitive type we can remove that type from the narrowed type. + // Assumed result is false. If check was for a primitive type, remove that primitive type + if (typeInfo) { + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true); + } // Otherwise we don't have enough information to do anything. - return checkType === emptyObjectType ? type : subtractPrimitiveTypes(type, checkType.flags); + return type; } } @@ -4730,7 +4817,8 @@ module ts { return type; } - // Narrow the given type based on the given expression having the assumed boolean value + // Narrow the given type based on the given expression having the assumed boolean value. The returned type + // will be a subtype or the same type as the argument. function narrowType(type: Type, expr: Expression, assumeTrue: boolean): Type { switch (expr.kind) { case SyntaxKind.ParenthesizedExpression: @@ -4759,6 +4847,7 @@ module ts { return type; } } + /*Transitively mark all linked imports as referenced*/ function markLinkedImportsAsReferenced(node: ImportDeclaration): void { var nodeLinks = getNodeLinks(node); @@ -4776,6 +4865,16 @@ module ts { function checkIdentifier(node: Identifier): Type { var symbol = getResolvedSymbol(node); + // As noted in ECMAScript 6 language spec, arrow functions never have an arguments objects. + // Although in down-level emit of arrow function, we emit it using function expression which means that + // arguments objects will be bound to the inner object; emitting arrow function natively in ES6, arguments objects + // will be bound to non-arrow function that contain this arrow function. This results in inconsistent behavior. + // To avoid that we will give an error to users if they use arguments objects in arrow function so that they + // can explicitly bound arguments objects + if (symbol === argumentsSymbol && getContainingFunction(node).kind === SyntaxKind.ArrowFunction) { + error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); + } + if (symbol.flags & SymbolFlags.Import) { var symbolLinks = getSymbolLinks(symbol); if (!symbolLinks.referenced) { @@ -4830,7 +4929,9 @@ module ts { // Now skip arrow functions to get the "real" owner of 'this'. if (container.kind === SyntaxKind.ArrowFunction) { container = getThisContainer(container, /* includeArrowFunctions */ false); - needToCaptureLexicalThis = true; + + // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code + needToCaptureLexicalThis = (languageVersion < ScriptTarget.ES6); } switch (container.kind) { @@ -4855,6 +4956,9 @@ module ts { // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; + case SyntaxKind.ComputedPropertyName: + error(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + break; } if (needToCaptureLexicalThis) { @@ -4869,26 +4973,6 @@ module ts { return anyType; } - function getSuperContainer(node: Node): Node { - while (true) { - node = node.parent; - if (!node) return node; - switch (node.kind) { - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.ArrowFunction: - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - case SyntaxKind.Constructor: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - return node; - } - } - } - function isInConstructorArgumentInitializer(node: Node, constructorDecl: Node): boolean { for (var n = node; n && n !== constructorDecl; n = n.parent) { if (n.kind === SyntaxKind.Parameter) { @@ -4912,7 +4996,7 @@ module ts { return unknownType; } - var container = getSuperContainer(node); + var container = getSuperContainer(node, /*includeFunctions*/ true); if (container) { var canUseSuperExpression = false; @@ -4930,7 +5014,7 @@ module ts { // super property access might appear in arrow functions with arbitrary deep nesting var needToCaptureLexicalThis = false; while (container && container.kind === SyntaxKind.ArrowFunction) { - container = getSuperContainer(container); + container = getSuperContainer(container, /*includeFunctions*/ true); needToCaptureLexicalThis = true; } @@ -4985,7 +5069,10 @@ module ts { } } - if (isCallExpression) { + if (container.kind === SyntaxKind.ComputedPropertyName) { + error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + } + else if (isCallExpression) { error(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } else { @@ -5167,13 +5254,22 @@ module ts { function getContextualTypeForObjectLiteralElement(element: ObjectLiteralElement) { var objectLiteral = element.parent; var type = getContextualType(objectLiteral); - // TODO(jfreeman): Handle this case for computed names and symbols - var name = (element.name).text; - if (type && name) { - return getTypeOfPropertyOfContextualType(type, name) || - isNumericName(name) && getIndexTypeOfContextualType(type, IndexKind.Number) || + if (type) { + if (!hasDynamicName(element)) { + // For a (non-symbol) computed property, there is no reason to look up the name + // in the type. It will just be "__computed", which does not appear in any + // SymbolTable. + var symbolName = getSymbolOfNode(element).name; + var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); + if (propertyType) { + return propertyType; + } + } + + return isNumericName(element.name) && getIndexTypeOfContextualType(type, IndexKind.Number) || getIndexTypeOfContextualType(type, IndexKind.String); } + return undefined; } @@ -5372,7 +5468,17 @@ module ts { return createArrayType(getUnionType(elementTypes)); } - function isNumericName(name: string) { + function isNumericName(name: DeclarationName): boolean { + return name.kind === SyntaxKind.ComputedPropertyName ? isNumericComputedName(name) : isNumericLiteralName((name).text); + } + + function isNumericComputedName(name: ComputedPropertyName): boolean { + // It seems odd to consider an expression of type Any to result in a numeric name, + // but this behavior is consistent with checkIndexedAccess + return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); + } + + function isNumericLiteralName(name: string) { // The intent of numeric names is that // - they are names with text in a numeric form, and that // - setting properties/indexing with them is always equivalent to doing so with the numeric literal 'numLit', @@ -5397,95 +5503,101 @@ module ts { return (+name).toString() === name; } + function checkComputedPropertyName(node: ComputedPropertyName): Type { + var links = getNodeLinks(node.expression); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node.expression); + + // This will allow types number, string, or any. It will also allow enums, the unknown + // type, and any union of these types (like string | number). + if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) { + error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + } + } + + return links.resolvedType; + } + function checkObjectLiteral(node: ObjectLiteralExpression, contextualMapper?: TypeMapper): Type { // Grammar checking checkGrammarObjectLiteralExpression(node); - var members = node.symbol.members; - var properties: SymbolTable = {}; + var propertiesTable: SymbolTable = {}; + var propertiesArray: Symbol[] = []; var contextualType = getContextualType(node); var typeFlags: TypeFlags; - for (var id in members) { - if (hasProperty(members, id)) { - var member = members[id]; - if (member.flags & SymbolFlags.Property || isObjectLiteralMethod(member.declarations[0])) { - var memberDecl = member.declarations[0]; - if (memberDecl.kind === SyntaxKind.PropertyAssignment) { - var type = checkExpression((memberDecl).initializer, contextualMapper); - } - else if (memberDecl.kind === SyntaxKind.MethodDeclaration) { - var type = checkObjectLiteralMethod(memberDecl, contextualMapper); - } - else { - Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment); - var type = memberDecl.name.kind === SyntaxKind.ComputedPropertyName - ? unknownType - : checkExpression(memberDecl.name, contextualMapper); - } - typeFlags |= type.flags; - var prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name); - prop.declarations = member.declarations; - prop.parent = member.parent; - if (member.valueDeclaration) { - prop.valueDeclaration = member.valueDeclaration; - } - - prop.type = type; - prop.target = member; - member = prop; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; + var member = memberDecl.symbol; + if (memberDecl.kind === SyntaxKind.PropertyAssignment || + memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment || + isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === SyntaxKind.PropertyAssignment) { + var type = checkPropertyAssignment(memberDecl, contextualMapper); + } + else if (memberDecl.kind === SyntaxKind.MethodDeclaration) { + var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - // TypeScript 1.0 spec (April 2014) - // A get accessor declaration is processed in the same manner as - // an ordinary function declaration(section 6.1) with no parameters. - // A set accessor declaration is processed in the same manner - // as an ordinary function declaration with a single parameter and a Void return type. - var getAccessor = getDeclarationOfKind(member, SyntaxKind.GetAccessor); - if (getAccessor) { - checkAccessorDeclaration(getAccessor); - } - - var setAccessor = getDeclarationOfKind(member, SyntaxKind.SetAccessor); - if (setAccessor) { - checkAccessorDeclaration(setAccessor); - } + Debug.assert(memberDecl.kind === SyntaxKind.ShorthandPropertyAssignment); + var type = memberDecl.name.kind === SyntaxKind.ComputedPropertyName + ? unknownType + : checkExpression(memberDecl.name, contextualMapper); } - properties[member.name] = member; + typeFlags |= type.flags; + var prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient | member.flags, member.name); + prop.declarations = member.declarations; + prop.parent = member.parent; + if (member.valueDeclaration) { + prop.valueDeclaration = member.valueDeclaration; + } + + prop.type = type; + prop.target = member; + member = prop; + } + else { + // TypeScript 1.0 spec (April 2014) + // A get accessor declaration is processed in the same manner as + // an ordinary function declaration(section 6.1) with no parameters. + // A set accessor declaration is processed in the same manner + // as an ordinary function declaration with a single parameter and a Void return type. + Debug.assert(memberDecl.kind === SyntaxKind.GetAccessor || memberDecl.kind === SyntaxKind.SetAccessor); + checkAccessorDeclaration(memberDecl); } - } - // If object literal is contextually (but not inferentially) typed, copy missing optional properties from - // the contextual type such that the resulting type becomes a subtype in cases where only optional properties - // were omitted. There is no need to create new property objects as nothing in them needs to change. - if (contextualType && !isInferentialContext(contextualMapper)) { - forEach(getPropertiesOfObjectType(contextualType), p => { - if (p.flags & SymbolFlags.Optional && !hasProperty(properties, p.name)) { - properties[p.name] = p; - } - }); + if (!hasDynamicName(memberDecl)) { + propertiesTable[member.name] = member; + } + propertiesArray.push(member); } var stringIndexType = getIndexType(IndexKind.String); var numberIndexType = getIndexType(IndexKind.Number); - var result = createAnonymousType(node.symbol, properties, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= (typeFlags & TypeFlags.Unwidened); + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + result.flags |= TypeFlags.ObjectLiteral | TypeFlags.ContainsObjectLiteral | (typeFlags & TypeFlags.ContainsUndefinedOrNull); return result; function getIndexType(kind: IndexKind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { var propTypes: Type[] = []; - for (var id in properties) { - if (hasProperty(properties, id)) { - if (kind === IndexKind.String || isNumericName(id)) { - var type = getTypeOfSymbol(properties[id]); - if (!contains(propTypes, type)) { - propTypes.push(type); - } + for (var i = 0; i < propertiesArray.length; i++) { + var propertyDecl = node.properties[i]; + if (kind === IndexKind.String || isNumericName(propertyDecl.name)) { + // Do not call getSymbolOfNode(propertyDecl), as that will get the + // original symbol for the node. We actually want to get the symbol + // created by checkObjectLiteral, since that will be appropriately + // contextually typed and resolved. + var type = getTypeOfSymbol(propertiesArray[i]); + if (!contains(propTypes, type)) { + propTypes.push(type); } } } - return propTypes.length ? getUnionType(propTypes) : undefinedType; + var result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= result.flags; + return result; } return undefined; } @@ -5597,9 +5709,9 @@ module ts { return false; } else { - var diagnosticsCount = diagnostics.length; + var modificationCount = diagnostics.getModificationCount(); checkClassPropertyAccess(node, left, type, prop); - return diagnostics.length === diagnosticsCount + return diagnostics.getModificationCount() === modificationCount; } } } @@ -5811,28 +5923,31 @@ module ts { return getSignatureInstantiation(signature, getInferredTypes(context)); } - function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument?: boolean[]): InferenceContext { + function inferTypeArguments(signature: Signature, args: Expression[], excludeArgument: boolean[]): InferenceContext { var typeParameters = signature.typeParameters; var context = createInferenceContext(typeParameters, /*inferUnionTypes*/ false); - var mapper = createInferenceMapper(context); - // First infer from arguments that are not context sensitive + var inferenceMapper = createInferenceMapper(context); + + // We perform two passes over the arguments. In the first pass we infer from all arguments, but use + // wildcards for all context sensitive function expressions. for (var i = 0; i < args.length; i++) { if (args[i].kind === SyntaxKind.OmittedExpression) { continue; } - if (!excludeArgument || excludeArgument[i] === undefined) { - var parameterType = getTypeAtPosition(signature, i); - - if (i === 0 && args[i].parent.kind === SyntaxKind.TaggedTemplateExpression) { - inferTypes(context, globalTemplateStringsArrayType, parameterType); - continue; - } - - inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); + var parameterType = getTypeAtPosition(signature, i); + if (i === 0 && args[i].parent.kind === SyntaxKind.TaggedTemplateExpression) { + inferTypes(context, globalTemplateStringsArrayType, parameterType); + continue; } + // For context sensitive arguments we pass the identityMapper, which is a signal to treat all + // context sensitive function expressions as wildcards + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; + inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); } - // Next, infer from those context sensitive arguments that are no longer excluded + // In the second pass we visit only context sensitive arguments, and only those that aren't excluded, this + // time treating function expressions normally (which may cause previously inferred type arguments to be fixed + // as we construct types for contextually typed parameters) if (excludeArgument) { for (var i = 0; i < args.length; i++) { if (args[i].kind === SyntaxKind.OmittedExpression) { @@ -5841,10 +5956,11 @@ module ts { // No need to special-case tagged templates; their excludeArgument value will be 'undefined'. if (excludeArgument[i] === false) { var parameterType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); + inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, inferenceMapper), parameterType); } } } + var inferredTypes = getInferredTypes(context); // Inference has failed if the inferenceFailureType type is in list of inferences context.failedTypeParameterIndex = indexOf(inferredTypes, inferenceFailureType); @@ -5878,7 +5994,7 @@ module ts { return typeArgumentsAreAssignable; } - function checkApplicableSignature(node: CallLikeExpression, args: Node[], signature: Signature, relation: Map, excludeArgument: boolean[], reportErrors: boolean) { + function checkApplicableSignature(node: CallLikeExpression, args: Node[], signature: Signature, relation: Map, excludeArgument: boolean[], reportErrors: boolean) { for (var i = 0; i < args.length; i++) { var arg = args[i]; var argType: Type; @@ -5938,11 +6054,41 @@ module ts { return args; } + /** + * In a 'super' call, type arguments are not provided within the CallExpression node itself. + * Instead, they must be fetched from the class declaration's base type node. + * + * If 'node' is a 'super' call (e.g. super(...), new super(...)), then we attempt to fetch + * the type arguments off the containing class's first heritage clause (if one exists). Note that if + * type arguments are supplied on the 'super' call, they are ignored (though this is syntactically incorrect). + * + * In all other cases, the call's explicit type arguments are returned. + */ + function getEffectiveTypeArguments(callExpression: CallExpression): TypeNode[] { + if (callExpression.expression.kind === SyntaxKind.SuperKeyword) { + var containingClass = getAncestor(callExpression, SyntaxKind.ClassDeclaration); + var baseClassTypeNode = containingClass && getClassBaseTypeNode(containingClass); + return baseClassTypeNode && baseClassTypeNode.typeArguments; + } + else { + // Ordinary case - simple function invocation. + return callExpression.typeArguments; + } + } + function resolveCall(node: CallLikeExpression, signatures: Signature[], candidatesOutArray: Signature[]): Signature { var isTaggedTemplate = node.kind === SyntaxKind.TaggedTemplateExpression; - var typeArguments = isTaggedTemplate ? undefined : (node).typeArguments; - forEach(typeArguments, checkSourceElement); + var typeArguments: TypeNode[]; + + if (!isTaggedTemplate) { + typeArguments = getEffectiveTypeArguments(node); + + // We already perform checking on the type arguments on the class declaration itself. + if ((node).expression.kind !== SyntaxKind.SuperKeyword) { + forEach(typeArguments, checkSourceElement); + } + } var candidates = candidatesOutArray || []; // collectCandidates fills up the candidates array directly @@ -6072,7 +6218,7 @@ module ts { return resolveErrorCall(node); - function chooseOverload(candidates: Signature[], relation: Map) { + function chooseOverload(candidates: Signature[], relation: Map) { for (var i = 0; i < candidates.length; i++) { if (!hasCorrectArity(node, args, candidates[i])) { continue; @@ -6208,7 +6354,7 @@ module ts { // Another error has already been reported return resolveErrorCall(node); } - + // Technically, this signatures list may be incomplete. We are taking the apparent type, // but we are not including call signatures that may have been added to the Object or // Function interface, since they have none by default. This is a bit of a leap of faith @@ -6406,6 +6552,9 @@ module ts { function getReturnTypeFromBody(func: FunctionLikeDeclaration, contextualMapper?: TypeMapper): Type { var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + if (!func.body) { + return unknownType; + } if (func.body.kind !== SyntaxKind.Block) { var type = checkExpressionCached(func.body, contextualMapper); } @@ -6503,7 +6652,7 @@ module ts { } // The identityMapper object is used to indicate that function expressions are wildcards - if (contextualMapper === identityMapper) { + if (contextualMapper === identityMapper && isContextSensitive(node)) { return anyFunctionType; } var links = getNodeLinks(node); @@ -6744,7 +6893,7 @@ module ts { // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (isTypeOfKind(leftType, TypeFlags.Primitive)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -6777,7 +6926,7 @@ module ts { var name = (p).name; var type = sourceType.flags & TypeFlags.Any ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || - isNumericName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) || + isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) || getIndexTypeOfType(sourceType, IndexKind.String); if (type) { checkDestructuringAssignment((p).initializer || name, type); @@ -7058,10 +7207,22 @@ module ts { return links.resolvedType; } + function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type { + if (hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } + + return checkExpression((node).initializer, contextualMapper); + } + function checkObjectLiteralMethod(node: MethodDeclaration, contextualMapper?: TypeMapper): Type { // Grammar checking checkGrammarMethod(node); + if (hasDynamicName(node)) { + checkComputedPropertyName(node.name); + } + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } @@ -7165,7 +7326,7 @@ module ts { case SyntaxKind.TypeAssertionExpression: return checkTypeAssertion(node); case SyntaxKind.ParenthesizedExpression: - return checkExpression((node).expression); + return checkExpression((node).expression, contextualMapper); case SyntaxKind.FunctionExpression: case SyntaxKind.ArrowFunction: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -7432,7 +7593,7 @@ module ts { } } - if (!hasComputedNameButNotSymbol(node)) { + if (!hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var otherKind = node.kind === SyntaxKind.GetAccessor ? SyntaxKind.SetAccessor : SyntaxKind.GetAccessor; @@ -7452,9 +7613,9 @@ module ts { } } } - - checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); } + + checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); } checkFunctionLikeDeclaration(node); @@ -7870,7 +8031,12 @@ module ts { function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void { checkSignatureDeclaration(node); - if (!hasComputedNameButNotSymbol(node)) { + if (hasDynamicName(node)) { + // This check will account for methods in class/interface declarations, + // as well as accessors in classes/object literals + checkComputedPropertyName(node.name); + } + else { // first we want to check the local symbol that contain this declaration // - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode @@ -8099,7 +8265,8 @@ module ts { function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { checkSourceElement(node.type); // For a computed property, just check the initializer and exit - if (hasComputedNameButNotSymbol(node)) { + if (hasDynamicName(node)) { + checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } @@ -8442,45 +8609,7 @@ module ts { if (node.finallyBlock) checkBlock(node.finallyBlock); } - function checkIndexConstraints(type: Type) { - - function checkIndexConstraintForProperty(prop: Symbol, propertyType: Type, indexDeclaration: Declaration, indexType: Type, indexKind: IndexKind): void { - if (!indexType) { - return; - } - - // index is numeric and property name is not valid numeric literal - if (indexKind === IndexKind.Number && !isNumericName(prop.name)) { - return; - } - - // perform property check if property or indexer is declared in 'type' - // this allows to rule out cases when both property and indexer are inherited from the base class - var errorNode: Node; - if (prop.parent === type.symbol) { - errorNode = prop.valueDeclaration; - } - else if (indexDeclaration) { - errorNode = indexDeclaration; - } - - else if (type.flags & TypeFlags.Interface) { - // for interfaces property and indexer might be inherited from different bases - // check if any base class already has both property and indexer. - // check should be performed only if 'type' is the first type that brings property\indexer together - var someBaseClassHasBothPropertyAndIndexer = forEach((type).baseTypes, base => getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind)); - errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : type.symbol.declarations[0]; - } - - if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = - indexKind === IndexKind.String - ? Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 - : Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; - error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); - } - } - + function checkIndexConstraints(type: Type) { var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.Number); var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, IndexKind.String); @@ -8490,9 +8619,24 @@ module ts { if (stringIndexType || numberIndexType) { forEach(getPropertiesOfObjectType(type), prop => { var propType = getTypeOfSymbol(prop); - checkIndexConstraintForProperty(prop, propType, declaredStringIndexer, stringIndexType, IndexKind.String); - checkIndexConstraintForProperty(prop, propType, declaredNumberIndexer, numberIndexType, IndexKind.Number); + checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); + checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); }); + + if (type.flags & TypeFlags.Class && type.symbol.valueDeclaration.kind === SyntaxKind.ClassDeclaration) { + var classDeclaration = type.symbol.valueDeclaration; + for (var i = 0; i < classDeclaration.members.length; i++) { + var member = classDeclaration.members[i]; + // Only process instance properties with computed names here. + // Static properties cannot be in conflict with indexers, + // and properties with literal names were already checked. + if (!(member.flags & NodeFlags.Static) && hasDynamicName(member)) { + var propType = getTypeOfSymbol(member.symbol); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, IndexKind.String); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, IndexKind.Number); + } + } + } } var errorNode: Node; @@ -8509,9 +8653,51 @@ module ts { error(errorNode, Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)); } + + function checkIndexConstraintForProperty( + prop: Symbol, + propertyType: Type, + containingType: Type, + indexDeclaration: Declaration, + indexType: Type, + indexKind: IndexKind): void { + + if (!indexType) { + return; + } + + // index is numeric and property name is not valid numeric literal + if (indexKind === IndexKind.Number && !isNumericName(prop.valueDeclaration.name)) { + return; + } + + // perform property check if property or indexer is declared in 'type' + // this allows to rule out cases when both property and indexer are inherited from the base class + var errorNode: Node; + if (prop.valueDeclaration.name.kind === SyntaxKind.ComputedPropertyName || prop.parent === containingType.symbol) { + errorNode = prop.valueDeclaration; + } + else if (indexDeclaration) { + errorNode = indexDeclaration; + } + else if (containingType.flags & TypeFlags.Interface) { + // for interfaces property and indexer might be inherited from different bases + // check if any base class already has both property and indexer. + // check should be performed only if 'type' is the first type that brings property\indexer together + var someBaseClassHasBothPropertyAndIndexer = forEach((containingType).baseTypes, base => getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind)); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + } + + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = + indexKind === IndexKind.String + ? Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 + : Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + } + } } - // TODO(jfreeman): Decide what to do for computed properties function checkTypeNameIsReserved(name: DeclarationName, message: DiagnosticMessage): void { // TS 1.0 spec (April 2014): 3.6.1 // The predefined type keywords are reserved and cannot be used as names of user defined types. @@ -8740,7 +8926,7 @@ module ts { var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); - addDiagnostic(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo, host.getCompilerHost().getNewLine())); + diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } } } @@ -8805,8 +8991,7 @@ module ts { var enumIsConst = isConst(node); forEach(node.members, member => { - // TODO(jfreeman): Check that it is not a computed name - if(isNumericName((member.name).text)) { + if (member.name.kind !== SyntaxKind.ComputedPropertyName && isNumericLiteralName((member.name).text)) { error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -9356,8 +9541,14 @@ module ts { } } - // Fully type check a source file and collect the relevant diagnostics. function checkSourceFile(node: SourceFile) { + var start = new Date().getTime(); + checkSourceFileWorker(node); + checkTime += new Date().getTime() - start; + } + + // Fully type check a source file and collect the relevant diagnostics. + function checkSourceFileWorker(node: SourceFile) { var links = getNodeLinks(node); if (!(links.flags & NodeCheckFlags.TypeChecked)) { // Grammar checking @@ -9392,30 +9583,19 @@ module ts { } } - function getSortedDiagnostics(): Diagnostic[]{ - Debug.assert(produceDiagnostics, "diagnostics are available only in the full typecheck mode"); - - if (diagnosticsModified) { - diagnostics.sort(compareDiagnostics); - diagnostics = deduplicateSortedDiagnostics(diagnostics); - diagnosticsModified = false; - } - return diagnostics; - } - function getDiagnostics(sourceFile?: SourceFile): Diagnostic[] { throwIfNonDiagnosticsProducing(); if (sourceFile) { checkSourceFile(sourceFile); - return filter(getSortedDiagnostics(), d => d.file === sourceFile); + return diagnostics.getDiagnostics(sourceFile.fileName); } forEach(host.getSourceFiles(), checkSourceFile); - return getSortedDiagnostics(); + return diagnostics.getDiagnostics(); } - function getGlobalDiagnostics(): Diagnostic[]{ + function getGlobalDiagnostics(): Diagnostic[] { throwIfNonDiagnosticsProducing(); - return filter(getSortedDiagnostics(), d => !d.file); + return diagnostics.getGlobalDiagnostics(); } function throwIfNonDiagnosticsProducing() { @@ -9439,7 +9619,7 @@ module ts { return false; } - function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]{ + function getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[] { var symbols: SymbolTable = {}; var memberFlags: NodeFlags = 0; function copySymbol(symbol: Symbol, meaning: SymbolFlags) { @@ -9825,7 +10005,7 @@ module ts { return getNamedMembers(propsByName); } - function getRootSymbols(symbol: Symbol): Symbol[]{ + function getRootSymbols(symbol: Symbol): Symbol[] { if (symbol.flags & SymbolFlags.UnionProperty) { var symbols: Symbol[] = []; var name = symbol.name; @@ -9933,11 +10113,6 @@ module ts { return isImportResolvedToValue(getSymbolOfNode(node)); } - function hasSemanticErrors(sourceFile?: SourceFile) { - // Return true if there is any semantic error in a file or globally - return getDiagnostics(sourceFile).length > 0 || getGlobalDiagnostics().length > 0; - } - function isImportResolvedToValue(symbol: Symbol): boolean { var target = resolveImport(symbol); // const enums and modules that contain only const enums are not considered values from the emit perespective @@ -9991,7 +10166,11 @@ module ts { return getNodeLinks(node).enumMemberValue; } - function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number { + function getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number { + if (node.kind === SyntaxKind.EnumMember) { + return getEnumMemberValue(node); + } + var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & SymbolFlags.EnumMember)) { var declaration = symbol.valueDeclaration; @@ -10030,9 +10209,7 @@ module ts { getExportAssignmentName, isReferencedImportDeclaration, getNodeCheckFlags, - getEnumMemberValue, isTopLevelValueImportWithEntityName, - hasSemanticErrors, isDeclarationVisible, isImplementationOfOverload, writeTypeOfDeclaration, @@ -10048,14 +10225,15 @@ module ts { // Bind all source files and propagate errors forEach(host.getSourceFiles(), file => { bindSourceFile(file); - forEach(file.semanticDiagnostics, addDiagnostic); }); + // Initialize global symbol table forEach(host.getSourceFiles(), file => { if (!isExternalModule(file)) { extendSymbolTable(globals, file.locals); } }); + // Initialize special symbols getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); @@ -10433,22 +10611,18 @@ module ts { return false; } - function checkGrammarComputedPropertyName(node: Node): void { + function checkGrammarComputedPropertyName(node: Node): boolean { // If node is not a computedPropertyName, just skip the grammar checking if (node.kind !== SyntaxKind.ComputedPropertyName) { - return; + return false; } - // Since computed properties are not supported in the type checker, disallow them in TypeScript 1.4 - // Once full support is added, remove this error. - grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_not_currently_supported); - return; var computedPropertyName = node; if (languageVersion < ScriptTarget.ES6) { - grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); + return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); } else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) { - grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -10853,14 +11027,14 @@ module ts { if (!hasParseDiagnostics(sourceFile)) { var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceFile.text); var start = scanToken(scanner, node.pos); - diagnostics.push(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + diagnostics.add(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); return true; } } function grammarErrorAtPos(sourceFile: SourceFile, start: number, length: number, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { if (!hasParseDiagnostics(sourceFile)) { - diagnostics.push(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + diagnostics.add(createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); return true; } } @@ -10870,7 +11044,7 @@ module ts { if (!hasParseDiagnostics(sourceFile)) { var span = getErrorSpanForNode(node); var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; - diagnostics.push(createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); + diagnostics.add(createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); return true; } } @@ -11004,7 +11178,7 @@ module ts { if (!hasParseDiagnostics(sourceFile)) { var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceFile.text); scanToken(scanner, node.pos); - diagnostics.push(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + diagnostics.add(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); return true; } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 23bbba5c6ca..4ba2da757e5 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -134,6 +134,12 @@ module ts { type: "boolean", description: Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, }, + { + name: "stripInternal", + type: "boolean", + description: Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + experimental: true + }, { name: "target", shortName: "t", @@ -158,7 +164,7 @@ module ts { export function parseCommandLine(commandLine: string[]): ParsedCommandLine { var options: CompilerOptions = {}; - var filenames: string[] = []; + var fileNames: string[] = []; var errors: Diagnostic[] = []; var shortOptionNames: Map = {}; var optionNameMap: Map = {}; @@ -172,7 +178,7 @@ module ts { parseStrings(commandLine); return { options, - filenames, + fileNames, errors }; @@ -226,16 +232,16 @@ module ts { } } else { - filenames.push(s); + fileNames.push(s); } } } - function parseResponseFile(filename: string) { - var text = sys.readFile(filename); + function parseResponseFile(fileName: string) { + var text = sys.readFile(fileName); if (!text) { - errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, filename)); + errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, fileName)); return; } @@ -253,7 +259,7 @@ module ts { pos++; } else { - errors.push(createCompilerDiagnostic(Diagnostics.Unterminated_quoted_string_in_response_file_0, filename)); + errors.push(createCompilerDiagnostic(Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); } } else { @@ -265,9 +271,9 @@ module ts { } } - export function readConfigFile(filename: string): any { + export function readConfigFile(fileName: string): any { try { - var text = sys.readFile(filename); + var text = sys.readFile(fileName); return /\S/.test(text) ? JSON.parse(text) : {}; } catch (e) { @@ -279,7 +285,7 @@ module ts { return { options: getCompilerOptions(), - filenames: getFiles(), + fileNames: getFiles(), errors }; diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 4a710c035ba..d527b62005e 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -118,6 +118,12 @@ module ts { return result; } + export function addRange(to: T[], from: T[]): void { + for (var i = 0, n = from.length; i < n; i++) { + to.push(from[i]); + } + } + /** * Returns the last element of an array if non-empty, undefined otherwise. */ @@ -280,7 +286,6 @@ module ts { messageText: text, category: message.category, code: message.code, - isEarly: message.isEarly }; } @@ -299,8 +304,7 @@ module ts { messageText: text, category: message.category, - code: message.code, - isEarly: message.isEarly + code: message.code }; } @@ -327,38 +331,6 @@ module ts { return headChain; } - export function flattenDiagnosticChain(file: SourceFile, start: number, length: number, diagnosticChain: DiagnosticMessageChain, newLine: string): Diagnostic { - Debug.assert(start >= 0, "start must be non-negative, is " + start); - Debug.assert(length >= 0, "length must be non-negative, is " + length); - - var code = diagnosticChain.code; - var category = diagnosticChain.category; - var messageText = ""; - - var indent = 0; - while (diagnosticChain) { - if (indent) { - messageText += newLine; - - for (var i = 0; i < indent; i++) { - messageText += " "; - } - } - messageText += diagnosticChain.messageText; - indent++; - diagnosticChain = diagnosticChain.next; - } - - return { - file, - start, - length, - code, - category, - messageText - }; - } - export function compareValues(a: T, b: T): Comparison { if (a === b) return Comparison.EqualTo; if (a === undefined) return Comparison.LessThan; @@ -366,17 +338,45 @@ module ts { return a < b ? Comparison.LessThan : Comparison.GreaterThan; } - function getDiagnosticFilename(diagnostic: Diagnostic): string { - return diagnostic.file ? diagnostic.file.filename : undefined; + function getDiagnosticFileName(diagnostic: Diagnostic): string { + return diagnostic.file ? diagnostic.file.fileName : undefined; } - export function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number { - return compareValues(getDiagnosticFilename(d1), getDiagnosticFilename(d2)) || + export function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): Comparison { + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || - compareValues(d1.messageText, d2.messageText) || - 0; + compareMessageText(d1.messageText, d2.messageText) || + Comparison.EqualTo; + } + + function compareMessageText(text1: string | DiagnosticMessageChain, text2: string | DiagnosticMessageChain): Comparison { + while (text1 && text2) { + // We still have both chains. + var string1 = typeof text1 === "string" ? text1 : text1.messageText; + var string2 = typeof text2 === "string" ? text2 : text2.messageText; + + var res = compareValues(string1, string2); + if (res) { + return res; + } + + text1 = typeof text1 === "string" ? undefined : text1.next; + text2 = typeof text2 === "string" ? undefined : text2.next; + } + + if (!text1 && !text2) { + // if the chains are done, then these messages are the same. + return Comparison.EqualTo; + } + + // We still have one chain remaining. The shorter chain should come first. + return text1 ? Comparison.GreaterThan : Comparison.LessThan; + } + + export function sortAndDeduplicateDiagnostics(diagnostics: Diagnostic[]): Diagnostic[]{ + return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics)); } export function deduplicateSortedDiagnostics(diagnostics: Diagnostic[]): Diagnostic[] { @@ -474,8 +474,8 @@ module ts { return normalizedPathComponents(path, rootLength); } - export function getNormalizedAbsolutePath(filename: string, currentDirectory: string) { - return getNormalizedPathFromPathComponents(getNormalizedPathComponents(filename, currentDirectory)); + export function getNormalizedAbsolutePath(fileName: string, currentDirectory: string) { + return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)); } export function getNormalizedPathFromPathComponents(pathComponents: string[]) { @@ -573,7 +573,7 @@ module ts { return absolutePath; } - export function getBaseFilename(path: string) { + export function getBaseFileName(path: string) { var i = path.lastIndexOf(directorySeparator); return i < 0 ? path : path.substring(i + 1); } @@ -646,6 +646,10 @@ module ts { } } + export function getDefaultLibFileName(options: CompilerOptions): string { + return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts"; + } + export interface ObjectAllocator { getNodeConstructor(kind: SyntaxKind): new () => Node; getSymbolConstructor(): new (flags: SymbolFlags, name: string) => Symbol; diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 874ac506449..fc0a6dc60fd 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -4,87 +4,87 @@ module ts { export var Diagnostics = { Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." }, Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." }, - _0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected.", isEarly: true }, + _0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." }, A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed.", isEarly: true }, + Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." }, Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." }, Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." }, - Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation.", isEarly: true }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list.", isEarly: true }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer.", isEarly: true }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter.", isEarly: true }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter.", isEarly: true }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier.", isEarly: true }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark.", isEarly: true }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer.", isEarly: true }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation.", isEarly: true }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation.", isEarly: true }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'.", isEarly: true }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: DiagnosticCategory.Error, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: DiagnosticCategory.Error, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: DiagnosticCategory.Error, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: DiagnosticCategory.Error, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." }, A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." }, An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." }, A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." }, A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: DiagnosticCategory.Error, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen.", isEarly: true }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier.", isEarly: true }, - _0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen.", isEarly: true }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element.", isEarly: true }, + Accessibility_modifier_already_seen: { code: 1028, category: DiagnosticCategory.Error, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: DiagnosticCategory.Error, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: DiagnosticCategory.Error, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a class element." }, An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: DiagnosticCategory.Error, key: "An interface declaration cannot have an 'implements' clause." }, super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: DiagnosticCategory.Error, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names.", isEarly: true }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts.", isEarly: true }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context.", isEarly: true }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts.", isEarly: true }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element.", isEarly: true }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration.", isEarly: true }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: DiagnosticCategory.Error, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: DiagnosticCategory.Error, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: DiagnosticCategory.Error, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an interface declaration." }, A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: DiagnosticCategory.Error, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional.", isEarly: true }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer.", isEarly: true }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter.", isEarly: true }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter.", isEarly: true }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer.", isEarly: true }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter.", isEarly: true }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters.", isEarly: true }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher.", isEarly: true }, - Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer.", isEarly: true }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module.", isEarly: true }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers.", isEarly: true }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: DiagnosticCategory.Error, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: DiagnosticCategory.Error, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: DiagnosticCategory.Error, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: DiagnosticCategory.Error, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration.", isEarly: true }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, Invalid_reference_directive_syntax: { code: 1084, category: DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher.", isEarly: true }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context.", isEarly: true }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration.", isEarly: true }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter.", isEarly: true }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement.", isEarly: true }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration.", isEarly: true }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration.", isEarly: true }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters.", isEarly: true }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation.", isEarly: true }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter.", isEarly: true }, - _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty.", isEarly: true }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty.", isEarly: true }, - Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty.", isEarly: true }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode.", isEarly: true }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode.", isEarly: true }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode.", isEarly: true }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement.", isEarly: true }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement.", isEarly: true }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary.", isEarly: true }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body.", isEarly: true }, - Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected.", isEarly: true }, - Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected.", isEarly: true }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional.", isEarly: true }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement.", isEarly: true }, - Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'", isEarly: true }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement.", isEarly: true }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement.", isEarly: true }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode.", isEarly: true }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name.", isEarly: true }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name.", isEarly: true }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers.", isEarly: true }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode.", isEarly: true }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty.", isEarly: true }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty.", isEarly: true }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: DiagnosticCategory.Error, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: DiagnosticCategory.Error, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: DiagnosticCategory.Error, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: DiagnosticCategory.Error, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: DiagnosticCategory.Error, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: DiagnosticCategory.Error, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: DiagnosticCategory.Error, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: DiagnosticCategory.Error, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: DiagnosticCategory.Error, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: DiagnosticCategory.Error, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: DiagnosticCategory.Error, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: DiagnosticCategory.Error, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: DiagnosticCategory.Error, key: "Expression expected." }, + Type_expected: { code: 1110, category: DiagnosticCategory.Error, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: DiagnosticCategory.Error, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: DiagnosticCategory.Error, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: DiagnosticCategory.Error, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: DiagnosticCategory.Error, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: DiagnosticCategory.Error, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: DiagnosticCategory.Error, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: DiagnosticCategory.Error, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: DiagnosticCategory.Error, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: DiagnosticCategory.Error, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: DiagnosticCategory.Error, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: DiagnosticCategory.Error, key: "Variable declaration list cannot be empty." }, Digit_expected: { code: 1124, category: DiagnosticCategory.Error, key: "Digit expected." }, Hexadecimal_digit_expected: { code: 1125, category: DiagnosticCategory.Error, key: "Hexadecimal digit expected." }, Unexpected_end_of_text: { code: 1126, category: DiagnosticCategory.Error, key: "Unexpected end of text." }, @@ -96,52 +96,52 @@ module ts { Enum_member_expected: { code: 1132, category: DiagnosticCategory.Error, key: "Enum member expected." }, Type_reference_expected: { code: 1133, category: DiagnosticCategory.Error, key: "Type reference expected." }, Variable_declaration_expected: { code: 1134, category: DiagnosticCategory.Error, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected.", isEarly: true }, + Argument_expression_expected: { code: 1135, category: DiagnosticCategory.Error, key: "Argument expression expected." }, Property_assignment_expected: { code: 1136, category: DiagnosticCategory.Error, key: "Property assignment expected." }, Expression_or_comma_expected: { code: 1137, category: DiagnosticCategory.Error, key: "Expression or comma expected." }, Parameter_declaration_expected: { code: 1138, category: DiagnosticCategory.Error, key: "Parameter declaration expected." }, Type_parameter_declaration_expected: { code: 1139, category: DiagnosticCategory.Error, key: "Type parameter declaration expected." }, Type_argument_expected: { code: 1140, category: DiagnosticCategory.Error, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected.", isEarly: true }, - Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here.", isEarly: true }, + String_literal_expected: { code: 1141, category: DiagnosticCategory.Error, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: DiagnosticCategory.Error, key: "Line break not permitted here." }, or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members.", isEarly: true }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module.", isEarly: true }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." }, Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, - Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead.", isEarly: true }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher.", isEarly: true }, - const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized", isEarly: true }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block.", isEarly: true }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block.", isEarly: true }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: DiagnosticCategory.Error, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: DiagnosticCategory.Error, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: DiagnosticCategory.Error, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: DiagnosticCategory.Error, key: "'let' declarations can only be declared inside a block." }, 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.", isEarly: true }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration.", isEarly: true }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums.", isEarly: true }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context.", isEarly: true }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations.", isEarly: true }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher.", isEarly: true }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads.", isEarly: true }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces.", isEarly: true }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals.", isEarly: true }, + 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." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, + Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." }, + Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." }, + Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." }, + Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen.", isEarly: true }, - extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause.", isEarly: true }, - Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class.", isEarly: true }, - implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen.", isEarly: true }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause.", isEarly: true }, + extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: DiagnosticCategory.Error, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: DiagnosticCategory.Error, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: DiagnosticCategory.Error, key: "Interface declaration cannot have 'implements' clause." }, Binary_digit_expected: { code: 1177, category: DiagnosticCategory.Error, key: "Binary digit expected." }, Octal_digit_expected: { code: 1178, category: DiagnosticCategory.Error, key: "Octal digit expected." }, Unexpected_token_expected: { code: 1179, category: DiagnosticCategory.Error, key: "Unexpected token. '{' expected." }, Property_destructuring_pattern_expected: { code: 1180, category: DiagnosticCategory.Error, key: "Property destructuring pattern expected." }, Array_element_destructuring_pattern_expected: { code: 1181, category: DiagnosticCategory.Error, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer.", isEarly: true }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts.", isEarly: true }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts.", isEarly: true }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: DiagnosticCategory.Error, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: DiagnosticCategory.Error, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: DiagnosticCategory.Error, key: "An implementation cannot be declared in ambient contexts." }, Modifiers_cannot_appear_here: { code: 1184, category: DiagnosticCategory.Error, key: "Modifiers cannot appear here." }, Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, @@ -283,10 +283,10 @@ module ts { Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: DiagnosticCategory.Error, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: DiagnosticCategory.Error, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: DiagnosticCategory.Error, key: "Block-scoped variable '{0}' used before its declaration.", isEarly: true }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator cannot be a constant.", isEarly: true }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant.", isEarly: true }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'.", isEarly: true }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: DiagnosticCategory.Error, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: DiagnosticCategory.Error, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: DiagnosticCategory.Error, key: "Cannot redeclare block-scoped variable '{0}'." }, An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: DiagnosticCategory.Error, key: "An enum member cannot have a numeric name." }, The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: DiagnosticCategory.Error, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: DiagnosticCategory.Error, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, @@ -298,6 +298,10 @@ module ts { Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, 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}'." }, @@ -368,12 +372,12 @@ module ts { Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." }, Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression.", isEarly: true }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal.", isEarly: true }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'.", isEarly: true }, + Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, @@ -428,6 +432,7 @@ module ts { File_0_not_found: { code: 6053, category: DiagnosticCategory.Error, key: "File '{0}' not found." }, File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: DiagnosticCategory.Error, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: DiagnosticCategory.Message, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." }, 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." }, @@ -445,8 +450,9 @@ module ts { _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." }, You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported.", isEarly: true }, - Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported.", isEarly: true }, - Computed_property_names_are_not_currently_supported: { code: 9002, category: DiagnosticCategory.Error, key: "Computed property names are not currently supported.", isEarly: true }, + 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." }, + 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." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index bc455c74f4e..9e2d03fcede 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -9,8 +9,7 @@ }, "'{0}' expected.": { "category": "Error", - "code": 1005, - "isEarly": true + "code": 1005 }, "A file cannot have a reference to itself.": { "category": "Error", @@ -18,8 +17,7 @@ }, "Trailing comma not allowed.": { "category": "Error", - "code": 1009, - "isEarly": true + "code": 1009 }, "'*/' expected.": { "category": "Error", @@ -31,58 +29,47 @@ }, "Catch clause parameter cannot have a type annotation.": { "category": "Error", - "code": 1013, - "isEarly": true + "code": 1013 }, "A rest parameter must be last in a parameter list.": { "category": "Error", - "code": 1014, - "isEarly": true + "code": 1014 }, "Parameter cannot have question mark and initializer.": { "category": "Error", - "code": 1015, - "isEarly": true + "code": 1015 }, "A required parameter cannot follow an optional parameter.": { "category": "Error", - "code": 1016, - "isEarly": true + "code": 1016 }, "An index signature cannot have a rest parameter.": { "category": "Error", - "code": 1017, - "isEarly": true + "code": 1017 }, "An index signature parameter cannot have an accessibility modifier.": { "category": "Error", - "code": 1018, - "isEarly": true + "code": 1018 }, "An index signature parameter cannot have a question mark.": { "category": "Error", - "code": 1019, - "isEarly": true + "code": 1019 }, "An index signature parameter cannot have an initializer.": { "category": "Error", - "code": 1020, - "isEarly": true + "code": 1020 }, "An index signature must have a type annotation.": { "category": "Error", - "code": 1021, - "isEarly": true + "code": 1021 }, "An index signature parameter must have a type annotation.": { "category": "Error", - "code": 1022, - "isEarly": true + "code": 1022 }, "An index signature parameter type must be 'string' or 'number'.": { "category": "Error", - "code": 1023, - "isEarly": true + "code": 1023 }, "A class or interface declaration can only have one 'extends' clause.": { "category": "Error", @@ -102,23 +89,19 @@ }, "Accessibility modifier already seen.": { "category": "Error", - "code": 1028, - "isEarly": true + "code": 1028 }, "'{0}' modifier must precede '{1}' modifier.": { "category": "Error", - "code": 1029, - "isEarly": true + "code": 1029 }, "'{0}' modifier already seen.": { "category": "Error", - "code": 1030, - "isEarly": true + "code": 1030 }, "'{0}' modifier cannot appear on a class element.": { "category": "Error", - "code": 1031, - "isEarly": true + "code": 1031 }, "An interface declaration cannot have an 'implements' clause.": { "category": "Error", @@ -130,33 +113,27 @@ }, "Only ambient modules can use quoted names.": { "category": "Error", - "code": 1035, - "isEarly": true + "code": 1035 }, "Statements are not allowed in ambient contexts.": { "category": "Error", - "code": 1036, - "isEarly": true + "code": 1036 }, "A 'declare' modifier cannot be used in an already ambient context.": { "category": "Error", - "code": 1038, - "isEarly": true + "code": 1038 }, "Initializers are not allowed in ambient contexts.": { "category": "Error", - "code": 1039, - "isEarly": true + "code": 1039 }, "'{0}' modifier cannot appear on a module element.": { "category": "Error", - "code": 1044, - "isEarly": true + "code": 1044 }, "A 'declare' modifier cannot be used with an interface declaration.": { "category": "Error", - "code": 1045, - "isEarly": true + "code": 1045 }, "A 'declare' modifier is required for a top level declaration in a .d.ts file.": { "category": "Error", @@ -164,58 +141,47 @@ }, "A rest parameter cannot be optional.": { "category": "Error", - "code": 1047, - "isEarly": true + "code": 1047 }, "A rest parameter cannot have an initializer.": { "category": "Error", - "code": 1048, - "isEarly": true + "code": 1048 }, "A 'set' accessor must have exactly one parameter.": { "category": "Error", - "code": 1049, - "isEarly": true + "code": 1049 }, "A 'set' accessor cannot have an optional parameter.": { "category": "Error", - "code": 1051, - "isEarly": true + "code": 1051 }, "A 'set' accessor parameter cannot have an initializer.": { "category": "Error", - "code": 1052, - "isEarly": true + "code": 1052 }, "A 'set' accessor cannot have rest parameter.": { "category": "Error", - "code": 1053, - "isEarly": true + "code": 1053 }, "A 'get' accessor cannot have parameters.": { "category": "Error", - "code": 1054, - "isEarly": true + "code": 1054 }, "Accessors are only available when targeting ECMAScript 5 and higher.": { "category": "Error", - "code": 1056, - "isEarly": true + "code": 1056 }, "Enum member must have initializer.": { "category": "Error", - "code": 1061, - "isEarly": true + "code": 1061 }, "An export assignment cannot be used in an internal module.": { "category": "Error", - "code": 1063, - "isEarly": true + "code": 1063 }, "Ambient enum elements can only have integer literal initializers.": { "category": "Error", - "code": 1066, - "isEarly": true + "code": 1066 }, "Unexpected token. A constructor, method, accessor, or property was expected.": { "category": "Error", @@ -223,8 +189,7 @@ }, "A 'declare' modifier cannot be used with an import declaration.": { "category": "Error", - "code": 1079, - "isEarly": true + "code": 1079 }, "Invalid 'reference' directive syntax.": { "category": "Error", @@ -232,173 +197,139 @@ }, "Octal literals are not available when targeting ECMAScript 5 and higher.": { "category": "Error", - "code": 1085, - "isEarly": true + "code": 1085 }, "An accessor cannot be declared in an ambient context.": { "category": "Error", - "code": 1086, - "isEarly": true + "code": 1086 }, "'{0}' modifier cannot appear on a constructor declaration.": { "category": "Error", - "code": 1089, - "isEarly": true + "code": 1089 }, "'{0}' modifier cannot appear on a parameter.": { "category": "Error", - "code": 1090, - "isEarly": true + "code": 1090 }, "Only a single variable declaration is allowed in a 'for...in' statement.": { "category": "Error", - "code": 1091, - "isEarly": true + "code": 1091 }, "Type parameters cannot appear on a constructor declaration.": { "category": "Error", - "code": 1092, - "isEarly": true + "code": 1092 }, "Type annotation cannot appear on a constructor declaration.": { "category": "Error", - "code": 1093, - "isEarly": true + "code": 1093 }, "An accessor cannot have type parameters.": { "category": "Error", - "code": 1094, - "isEarly": true + "code": 1094 }, "A 'set' accessor cannot have a return type annotation.": { "category": "Error", - "code": 1095, - "isEarly": true + "code": 1095 }, "An index signature must have exactly one parameter.": { "category": "Error", - "code": 1096, - "isEarly": true + "code": 1096 }, "'{0}' list cannot be empty.": { "category": "Error", - "code": 1097, - "isEarly": true + "code": 1097 }, "Type parameter list cannot be empty.": { "category": "Error", - "code": 1098, - "isEarly": true + "code": 1098 }, "Type argument list cannot be empty.": { "category": "Error", - "code": 1099, - "isEarly": true + "code": 1099 }, "Invalid use of '{0}' in strict mode.": { "category": "Error", - "code": 1100, - "isEarly": true + "code": 1100 }, "'with' statements are not allowed in strict mode.": { "category": "Error", - "code": 1101, - "isEarly": true + "code": 1101 }, "'delete' cannot be called on an identifier in strict mode.": { "category": "Error", - "code": 1102, - "isEarly": true + "code": 1102 }, "A 'continue' statement can only be used within an enclosing iteration statement.": { "category": "Error", - "code": 1104, - "isEarly": true + "code": 1104 }, "A 'break' statement can only be used within an enclosing iteration or switch statement.": { "category": "Error", - "code": 1105, - "isEarly": true + "code": 1105 }, "Jump target cannot cross function boundary.": { "category": "Error", - "code": 1107, - "isEarly": true + "code": 1107 }, "A 'return' statement can only be used within a function body.": { "category": "Error", - "code": 1108, - "isEarly": true + "code": 1108 }, "Expression expected.": { "category": "Error", - "code": 1109, - "isEarly": true + "code": 1109 }, "Type expected.": { "category": "Error", - "code": 1110, - "isEarly": true + "code": 1110 }, "A class member cannot be declared optional.": { "category": "Error", - "code": 1112, - "isEarly": true + "code": 1112 }, "A 'default' clause cannot appear more than once in a 'switch' statement.": { "category": "Error", - "code": 1113, - "isEarly": true + "code": 1113 }, "Duplicate label '{0}'": { "category": "Error", - "code": 1114, - "isEarly": true + "code": 1114 }, "A 'continue' statement can only jump to a label of an enclosing iteration statement.": { "category": "Error", - "code": 1115, - "isEarly": true + "code": 1115 }, "A 'break' statement can only jump to a label of an enclosing statement.": { "category": "Error", - "code": 1116, - "isEarly": true + "code": 1116 }, "An object literal cannot have multiple properties with the same name in strict mode.": { "category": "Error", - "code": 1117, - "isEarly": true + "code": 1117 }, "An object literal cannot have multiple get/set accessors with the same name.": { "category": "Error", - "code": 1118, - "isEarly": true + "code": 1118 }, "An object literal cannot have property and accessor with the same name.": { "category": "Error", - "code": 1119, - "isEarly": true + "code": 1119 }, "An export assignment cannot have modifiers.": { "category": "Error", - "code": 1120, - "isEarly": true + "code": 1120 }, "Octal literals are not allowed in strict mode.": { "category": "Error", - "code": 1121, - "isEarly": true + "code": 1121 }, "A tuple type element list cannot be empty.": { "category": "Error", - "code": 1122, - "isEarly": true + "code": 1122 }, "Variable declaration list cannot be empty.": { "category": "Error", - "code": 1123, - "isEarly": true + "code": 1123 }, "Digit expected.": { "category": "Error", @@ -446,8 +377,7 @@ }, "Argument expression expected.": { "category": "Error", - "code": 1135, - "isEarly": true + "code": 1135 }, "Property assignment expected.": { "category": "Error", @@ -471,13 +401,11 @@ }, "String literal expected.": { "category": "Error", - "code": 1141, - "isEarly": true + "code": 1141 }, "Line break not permitted here.": { "category": "Error", - "code": 1142, - "isEarly": true + "code": 1142 }, "'{' or ';' expected.": { "category": "Error", @@ -485,8 +413,7 @@ }, "Modifiers not permitted on index signature members.": { "category": "Error", - "code": 1145, - "isEarly": true + "code": 1145 }, "Declaration expected.": { "category": "Error", @@ -494,21 +421,19 @@ }, "Import declarations in an internal module cannot reference an external module.": { "category": "Error", - "code": 1147, - "isEarly": true + "code": 1147 }, "Cannot compile external modules unless the '--module' flag is provided.": { "category": "Error", "code": 1148 }, - "Filename '{0}' differs from already included filename '{1}' only in casing": { + "File name '{0}' differs from already included file name '{1}' only in casing": { "category": "Error", "code": 1149 }, "'new T[]' cannot be used to create an array. Use 'new Array()' instead.": { "category": "Error", - "code": 1150, - "isEarly": true + "code": 1150 }, "'var', 'let' or 'const' expected.": { "category": "Error", @@ -516,28 +441,23 @@ }, "'let' declarations are only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 1153, - "isEarly": true + "code": 1153 }, "'const' declarations are only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 1154, - "isEarly": true + "code": 1154 }, "'const' declarations must be initialized": { "category": "Error", - "code": 1155, - "isEarly": true + "code": 1155 }, "'const' declarations can only be declared inside a block.": { "category": "Error", - "code": 1156, - "isEarly": true + "code": 1156 }, "'let' declarations can only be declared inside a block.": { "category": "Error", - "code": 1157, - "isEarly": true + "code": 1157 }, "Unterminated template literal.": { "category": "Error", @@ -549,48 +469,39 @@ }, "An object member cannot be declared optional.": { "category": "Error", - "code": 1162, - "isEarly": true + "code": 1162 }, "'yield' expression must be contained_within a generator declaration.": { "category": "Error", - "code": 1163, - "isEarly": true + "code": 1163 }, "Computed property names are not allowed in enums.": { "category": "Error", - "code": 1164, - "isEarly": true + "code": 1164 }, "Computed property names are not allowed in an ambient context.": { "category": "Error", - "code": 1165, - "isEarly": true + "code": 1165 }, "Computed property names are not allowed in class property declarations.": { "category": "Error", - "code": 1166, - "isEarly": true + "code": 1166 }, "Computed property names are only available when targeting ECMAScript 6 and higher.": { "category": "Error", - "code": 1167, - "isEarly": true + "code": 1167 }, "Computed property names are not allowed in method overloads.": { "category": "Error", - "code": 1168, - "isEarly": true + "code": 1168 }, "Computed property names are not allowed in interfaces.": { "category": "Error", - "code": 1169, - "isEarly": true + "code": 1169 }, "Computed property names are not allowed in type literals.": { "category": "Error", - "code": 1170, - "isEarly": true + "code": 1170 }, "A comma expression is not allowed in a computed property name.": { "category": "Error", @@ -598,28 +509,23 @@ }, "'extends' clause already seen.": { "category": "Error", - "code": 1172, - "isEarly": true + "code": 1172 }, "'extends' clause must precede 'implements' clause.": { "category": "Error", - "code": 1173, - "isEarly": true + "code": 1173 }, "Classes can only extend a single class.": { "category": "Error", - "code": 1174, - "isEarly": true + "code": 1174 }, "'implements' clause already seen.": { "category": "Error", - "code": 1175, - "isEarly": true + "code": 1175 }, "Interface declaration cannot have 'implements' clause.": { "category": "Error", - "code": 1176, - "isEarly": true + "code": 1176 }, "Binary digit expected.": { "category": "Error", @@ -643,18 +549,15 @@ }, "A destructuring declaration must have an initializer.": { "category": "Error", - "code": 1182, - "isEarly": true + "code": 1182 }, "Destructuring declarations are not allowed in ambient contexts.": { "category": "Error", - "code": 1183, - "isEarly": true + "code": 1183 }, "An implementation cannot be declared in ambient contexts.": { "category": "Error", - "code": 1184, - "isEarly": true + "code": 1184 }, "Modifiers cannot appear here.": { "category": "Error", @@ -670,7 +573,7 @@ }, "A parameter property may not be a binding pattern.": { "category": "Error", - "code": 1187 + "code": 1187 }, "Duplicate identifier '{0}'.": { @@ -1223,23 +1126,19 @@ }, "Block-scoped variable '{0}' used before its declaration.": { "category": "Error", - "code": 2448, - "isEarly": true + "code": 2448 }, "The operand of an increment or decrement operator cannot be a constant.": { "category": "Error", - "code": 2449, - "isEarly": true + "code": 2449 }, "Left-hand side of assignment expression cannot be a constant.": { "category": "Error", - "code": 2450, - "isEarly": true + "code": 2450 }, "Cannot redeclare block-scoped variable '{0}'.": { "category": "Error", - "code": 2451, - "isEarly": true + "code": 2451 }, "An enum member cannot have a numeric name.": { "category": "Error", @@ -1283,7 +1182,23 @@ }, "A binding pattern parameter cannot be optional in an implementation signature.": { "category": "Error", - "code": 2463 + "code": 2463 + }, + "A computed property name must be of type 'string', 'number', or 'any'.": { + "category": "Error", + "code": 2464 + }, + "'this' cannot be referenced in a computed property name.": { + "category": "Error", + "code": 2465 + }, + "'super' cannot be referenced in a computed property name.": { + "category": "Error", + "code": 2466 + }, + "A computed property name cannot reference a type parameter from its containing type.": { + "category": "Error", + "code": 2466 }, "Import declaration '{0}' is using private name '{1}'.": { @@ -1568,8 +1483,7 @@ }, "In 'const' enum declarations member initializer must be constant expression.": { "category": "Error", - "code": 4083, - "isEarly": true + "code": 4083 }, "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { "category": "Error", @@ -1577,8 +1491,7 @@ }, "A const enum member can only be accessed using a string literal.": { "category": "Error", - "code": 4085, - "isEarly": true + "code": 4085 }, "'const' enum member initializer was evaluated to a non-finite value.": { "category": "Error", @@ -1590,8 +1503,7 @@ }, "Property '{0}' does not exist on 'const' enum '{1}'.": { "category": "Error", - "code": 4088, - "isEarly": true + "code": 4088 }, "The current host does not support the '{0}' option.": { "category": "Error", @@ -1809,6 +1721,10 @@ "category": "Message", "code": 6055 }, + "Do not emit declarations for code that has an '@internal' annotation.": { + "category": "Message", + "code": 6056 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", @@ -1878,19 +1794,20 @@ "category": "Error", "code": 8000 }, + "You cannot rename elements that are defined in the standard TypeScript library.": { + "category": "Error", + "code": 8001 + }, "'yield' expressions are not currently supported.": { "category": "Error", - "code": 9000, - "isEarly": true + "code": 9000 }, "Generators are not currently supported.": { "category": "Error", - "code": 9001, - "isEarly": true + "code": 9001 }, - "Computed property names are not currently supported.": { + "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": { "category": "Error", - "code": 9002, - "isEarly": true + "code": 9002 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 680ccd6a7df..04a487396e2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -55,7 +55,7 @@ module ts { export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.filename, ".js")) { + if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) { return true; } return false; @@ -134,7 +134,7 @@ module ts { } function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { - return currentSourceFile.getLineAndCharacterFromPosition(pos).line; + return getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { @@ -169,16 +169,16 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { - var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos); - var lastLine = currentSourceFile.getLineStarts().length; + var firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); + var lastLine = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, /*character*/1); + var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(currentSourceFile.getPositionFromLineAndCharacter(firstCommentLineAndCharacter.line, /*character*/1), + firstCommentLineIndent = calculateIndent(getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), comment.pos); } @@ -314,7 +314,7 @@ module ts { } function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) { - var sourceFilePath = getNormalizedAbsolutePath(sourceFile.filename, host.getCurrentDirectory()); + var sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); return combinePaths(newDirPath, sourceFilePath); } @@ -325,15 +325,15 @@ module ts { var emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); } else { - var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.filename); + var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.fileName); } return emitOutputFilePathWithoutExtension + extension; } - function writeFile(host: EmitHost, diagnostics: Diagnostic[], filename: string, data: string, writeByteOrderMark: boolean) { - host.writeFile(filename, data, writeByteOrderMark, hostErrorMessage => { - diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, filename, hostErrorMessage)); + function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean) { + host.writeFile(fileName, data, writeByteOrderMark, hostErrorMessage => { + diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); }); } @@ -355,9 +355,86 @@ module ts { var reportedDeclarationError = false; var emitJsDocComments = compilerOptions.removeComments ? function (declaration: Node) { } : writeJsDocComments; + var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = []; + // Contains the reference paths that needs to go in the declaration file. + // Collecting this separately because reference paths need to be first thing in the declaration file + // and we could be collecting these paths from multiple files into single one with --out option + var referencePathsOutput = ""; + + if (root) { + // Emitting just a single file, so emit references in this file only + if (!compilerOptions.noResolve) { + var addedGlobalFileReference = false; + forEach(root.referencedFiles, fileReference => { + var referencedFile = tryResolveScriptReference(host, root, fileReference); + + // All the references that are not going to be part of same file + if (referencedFile && ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference + shouldEmitToOwnFile(referencedFile, compilerOptions) || // This is referenced file is emitting its own js file + !addedGlobalFileReference)) { // Or the global out file corresponding to this reference was not added + + writeReferencePath(referencedFile); + if (!isExternalModuleOrDeclarationFile(referencedFile)) { + addedGlobalFileReference = true; + } + } + }); + } + + emitSourceFile(root); + } + else { + // Emit references corresponding to this file + var emittedReferencedFiles: SourceFile[] = []; + forEach(host.getSourceFiles(), sourceFile => { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + // Check what references need to be added + if (!compilerOptions.noResolve) { + forEach(sourceFile.referencedFiles, fileReference => { + var referencedFile = tryResolveScriptReference(host, sourceFile, fileReference); + + // If the reference file is a declaration file or an external module, emit that reference + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !contains(emittedReferencedFiles, referencedFile))) { // If the file reference was not already emitted + + writeReferencePath(referencedFile); + emittedReferencedFiles.push(referencedFile); + } + }); + } + + emitSourceFile(sourceFile); + } + }); + } + + return { + reportedDeclarationError, + aliasDeclarationEmitInfo, + synchronousDeclarationOutput: writer.getText(), + referencePathsOutput, + } + + function hasInternalAnnotation(range: CommentRange) { + var text = currentSourceFile.text; + var comment = text.substring(range.pos, range.end); + return comment.indexOf("@internal") >= 0; + } + + function stripInternal(node: Node) { + if (node) { + var leadingCommentRanges = getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (forEach(leadingCommentRanges, hasInternalAnnotation)) { + return; + } + + emitNode(node); + } + } + function createAndSetNewTextWriterWithSymbolWriter(): EmitTextWriterWithSymbolWriter { var writer = createTextWriter(newLine); writer.trackSymbol = trackSymbol; @@ -463,7 +540,7 @@ module ts { function emitLines(nodes: Node[]) { for (var i = 0, n = nodes.length; i < n; i++) { - emitNode(nodes[i]); + emit(nodes[i]); } } @@ -748,7 +825,7 @@ module ts { function emitEnumMemberDeclaration(node: EnumMember) { emitJsDocComments(node); writeTextOfNode(currentSourceFile, node.name); - var enumMemberValue = resolver.getEnumMemberValue(node); + var enumMemberValue = resolver.getConstantValue(node); if (enumMemberValue !== undefined) { write(" = "); write(enumMemberValue.toString()); @@ -932,6 +1009,10 @@ module ts { } function emitPropertyDeclaration(node: Declaration) { + if (hasDynamicName(node)) { + return; + } + emitJsDocComments(node); emitClassMemberDeclarationFlags(node); emitVariableDeclaration(node); @@ -939,11 +1020,13 @@ module ts { writeLine(); } - // TODO(jfreeman): Factor out common part of property definition, but treat name differently function emitVariableDeclaration(node: VariableDeclaration) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) { + // If this node is a computed name, it can only be a symbol, because we've already skipped + // it if it's not a well known symbol. In that case, the text of the name will be exactly + // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentSourceFile, node.name); // If optional property emit ? if ((node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature) && hasQuestionToken(node)) { @@ -1030,6 +1113,10 @@ module ts { } function emitAccessorDeclaration(node: AccessorDeclaration) { + if (hasDynamicName(node)) { + return; + } + var accessors = getAllAccessorDeclarations(node.parent, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); @@ -1057,7 +1144,9 @@ module ts { if (accessor) { return accessor.kind === SyntaxKind.GetAccessor ? accessor.type // Getter - return type - : accessor.parameters[0].type; // Setter parameter type + : accessor.parameters.length > 0 + ? accessor.parameters[0].type // Setter parameter type + : undefined; } } @@ -1107,6 +1196,10 @@ module ts { } function emitFunctionDeclaration(node: FunctionLikeDeclaration) { + if (hasDynamicName(node)) { + return; + } + // If we are emitting Method/Constructor it isn't moduleElement and hence already determined to be emitting // so no need to verify if the declaration is visible if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) && @@ -1388,13 +1481,9 @@ module ts { } } - // Contains the reference paths that needs to go in the declaration file. - // Collecting this separately because reference paths need to be first thing in the declaration file - // and we could be collecting these paths from multiple files into single one with --out option - var referencePathsOutput = ""; function writeReferencePath(referencedFile: SourceFile) { var declFileName = referencedFile.flags & NodeFlags.DeclarationFile - ? referencedFile.filename // Declaration file, use declaration file name + ? referencedFile.fileName // Declaration file, use declaration file name : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file : removeFileExtension(compilerOptions.out) + ".d.ts";// Global out file @@ -1408,60 +1497,6 @@ module ts { referencePathsOutput += "/// " + newLine; } - - if (root) { - // Emitting just a single file, so emit references in this file only - if (!compilerOptions.noResolve) { - var addedGlobalFileReference = false; - forEach(root.referencedFiles, fileReference => { - var referencedFile = tryResolveScriptReference(host, root, fileReference); - - // All the references that are not going to be part of same file - if (referencedFile && ((referencedFile.flags & NodeFlags.DeclarationFile) || // This is a declare file reference - shouldEmitToOwnFile(referencedFile, compilerOptions) || // This is referenced file is emitting its own js file - !addedGlobalFileReference)) { // Or the global out file corresponding to this reference was not added - - writeReferencePath(referencedFile); - if (!isExternalModuleOrDeclarationFile(referencedFile)) { - addedGlobalFileReference = true; - } - } - }); - } - - emitNode(root); - } - else { - // Emit references corresponding to this file - var emittedReferencedFiles: SourceFile[] = []; - forEach(host.getSourceFiles(), sourceFile => { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - // Check what references need to be added - if (!compilerOptions.noResolve) { - forEach(sourceFile.referencedFiles, fileReference => { - var referencedFile = tryResolveScriptReference(host, sourceFile, fileReference); - - // If the reference file is a declaration file or an external module, emit that reference - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && - !contains(emittedReferencedFiles, referencedFile))) { // If the file reference was not already emitted - - writeReferencePath(referencedFile); - emittedReferencedFiles.push(referencedFile); - } - }); - } - - emitNode(sourceFile); - } - }); - } - - return { - reportedDeclarationError, - aliasDeclarationEmitInfo, - synchronousDeclarationOutput: writer.getText(), - referencePathsOutput, - } } export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] { @@ -1471,15 +1506,47 @@ module ts { return diagnostics; } - // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compilerOnSave feature - export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile?: SourceFile): EmitResult { - // var program = resolver.getProgram(); + // @internal + // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature + export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || ScriptTarget.ES3; var sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap ? [] : undefined; var diagnostics: Diagnostic[] = []; var newLine = host.getNewLine(); + if (targetSourceFile === undefined) { + forEach(host.getSourceFiles(), sourceFile => { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + + if (compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + else { + // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) + if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + + // Sort and make the unique list of diagnostics + diagnostics = sortAndDeduplicateDiagnostics(diagnostics); + + return { + emitSkipped: false, + diagnostics, + sourceMaps: sourceMapDataList + }; + function emitJavaScript(jsFilePath: string, root?: SourceFile) { var writer = createTextWriter(newLine); var write = writer.write; @@ -1543,6 +1610,25 @@ module ts { /** Sourcemap data that will get encoded */ var sourceMapData: SourceMapData; + if (compilerOptions.sourceMap) { + initializeEmitterWithSourceMaps(); + } + + if (root) { + emit(root); + } + else { + forEach(host.getSourceFiles(), sourceFile => { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emit(sourceFile); + } + }); + } + + writeLine(); + writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); + return; + function initializeEmitterWithSourceMaps() { var sourceMapDir: string; // The directory in which sourcemap will be @@ -1647,7 +1733,7 @@ module ts { } function recordSourceMapSpan(pos: number) { - var sourceLinePos = currentSourceFile.getLineAndCharacterFromPosition(pos); + var sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); @@ -1703,14 +1789,14 @@ module ts { var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; sourceMapData.sourceMapSources.push(getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, - node.filename, + node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ true)); sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(node.filename); + sourceMapData.inputSourceFileNames.push(node.fileName); } function recordScopeNameOfNode(node: Node, scopeName?: string) { @@ -1723,7 +1809,14 @@ module ts { if (scopeName) { var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { - scopeName = sourceMapData.sourceMapNames[parentIndex] + "." + scopeName; + // Child scopes are always shown with a dot (even if they have no name), + // unless it is a computed property. Then it is shown with brackets, + // but the brackets are included in the name. + var name = (node).name; + if (!name || name.kind !== SyntaxKind.ComputedPropertyName) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; } scopeNameIndex = getProperty(sourceMapNameIndexMap, scopeName); @@ -1751,8 +1844,11 @@ module ts { node.kind === SyntaxKind.EnumDeclaration) { // Declaration and has associated name use it if ((node).name) { - // TODO(jfreeman): Ask shkamat about what this name should be for source maps - scopeName = ((node).name).text; + var name = (node).name; + // For computed property names, the text will include the brackets + scopeName = name.kind === SyntaxKind.ComputedPropertyName + ? getTextOfNode(name) + : ((node).name).text; } recordScopeNameStart(scopeName); } @@ -1815,7 +1911,7 @@ module ts { } // Initialize source map data - var sourceMapJsFile = getBaseFilename(normalizeSlashes(jsFilePath)); + var sourceMapJsFile = getBaseFileName(normalizeSlashes(jsFilePath)); sourceMapData = { sourceMapFilePath: jsFilePath + ".map", jsSourceMappingURL: sourceMapJsFile + ".map", @@ -2117,8 +2213,6 @@ module ts { return; } - Debug.assert(node.parent.kind !== SyntaxKind.TaggedTemplateExpression); - var emitOuterParens = isExpression(node.parent) && templateNeedsParens(node, node.parent); @@ -2197,10 +2291,9 @@ module ts { case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: return (parent).expression === template; + case SyntaxKind.TaggedTemplateExpression: case SyntaxKind.ParenthesizedExpression: return false; - case SyntaxKind.TaggedTemplateExpression: - Debug.fail("Path should be unreachable; tagged templates not supported pre-ES6."); default: return comparePrecedenceToBinaryPlus(parent) !== Comparison.LessThan; } @@ -2220,7 +2313,6 @@ module ts { // // TODO (drosen): Note that we need to account for the upcoming 'yield' and // spread ('...') unary operators that are anticipated for ES6. - Debug.assert(languageVersion < ScriptTarget.ES6); switch (expression.kind) { case SyntaxKind.BinaryExpression: switch ((expression).operator) { @@ -2470,28 +2562,20 @@ module ts { } function emitMethod(node: MethodDeclaration) { - if (!isObjectLiteralMethod(node)) { - return; - } - emitLeadingComments(node); emit(node.name); if (languageVersion < ScriptTarget.ES6) { write(": function "); } emitSignatureAndBody(node); - emitTrailingComments(node); } function emitPropertyAssignment(node: PropertyDeclaration) { - emitLeadingComments(node); emit(node.name); write(": "); emit(node.initializer); - emitTrailingComments(node); } function emitShorthandPropertyAssignment(node: ShorthandPropertyAssignment) { - emitLeadingComments(node); emit(node.name); // If short-hand property has a prefix, then regardless of the target version, we will emit it as normal property assignment. For example: // module m { @@ -2508,14 +2592,16 @@ module ts { // Short-hand, { x }, is equivalent of normal form { x: x } emitExpressionIdentifier(node.name); } - emitTrailingComments(node); } function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean { var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { - var propertyName = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((node).name) : getTextOfNode((node).argumentExpression); - write(constantValue.toString() + " /* " + propertyName + " */"); + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName: string = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((node).name) : getTextOfNode((node).argumentExpression); + write(" /* " + propertyName + " */"); + } return true; } return false; @@ -2677,7 +2763,6 @@ module ts { write(tokenToString(node.operator)); } - function emitBinaryExpression(node: BinaryExpression) { if (languageVersion < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { @@ -2732,14 +2817,12 @@ module ts { } function emitExpressionStatement(node: ExpressionStatement) { - emitLeadingComments(node); emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction); + emitParenthesized(node.expression, /*parenthesized*/ node.expression.kind === SyntaxKind.ArrowFunction); write(";"); - emitTrailingComments(node); } function emitIfStatement(node: IfStatement) { - emitLeadingComments(node); var endPos = emitToken(SyntaxKind.IfKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); @@ -2757,7 +2840,6 @@ module ts { emitEmbeddedStatement(node.elseStatement); } } - emitTrailingComments(node); } function emitDoStatement(node: DoStatement) { @@ -2845,11 +2927,9 @@ module ts { } function emitReturnStatement(node: ReturnStatement) { - emitLeadingComments(node); emitToken(SyntaxKind.ReturnKeyword, node.pos); emitOptional(" ", node.expression); write(";"); - emitTrailingComments(node); } function emitWithStatement(node: WhileStatement) { @@ -3173,7 +3253,6 @@ module ts { } function emitVariableDeclaration(node: VariableDeclaration) { - emitLeadingComments(node); if (isBindingPattern(node.name)) { if (languageVersion < ScriptTarget.ES6) { emitDestructuring(node); @@ -3187,11 +3266,9 @@ module ts { emitModuleMemberName(node); emitOptional(" = ", node.initializer); } - emitTrailingComments(node); } function emitVariableStatement(node: VariableStatement) { - emitLeadingComments(node); if (!(node.flags & NodeFlags.Export)) { if (isLet(node.declarationList)) { write("let "); @@ -3205,11 +3282,9 @@ module ts { } emitCommaList(node.declarationList.declarations); write(";"); - emitTrailingComments(node); } function emitParameter(node: ParameterDeclaration) { - emitLeadingComments(node); if (languageVersion < ScriptTarget.ES6) { if (isBindingPattern(node.name)) { var name = createTempVariable(node); @@ -3230,7 +3305,6 @@ module ts { emit(node.name); emitOptional(" = ", node.initializer); } - emitTrailingComments(node); } function emitDefaultValueAssignments(node: FunctionLikeDeclaration) { @@ -3303,11 +3377,13 @@ module ts { } function emitAccessor(node: AccessorDeclaration) { - emitLeadingComments(node); write(node.kind === SyntaxKind.GetAccessor ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); - emitTrailingComments(node); + } + + function shouldEmitAsArrowFunction(node: FunctionLikeDeclaration): boolean { + return node.kind === SyntaxKind.ArrowFunction && languageVersion >= ScriptTarget.ES6; } function emitFunctionDeclaration(node: FunctionLikeDeclaration) { @@ -3319,7 +3395,13 @@ module ts { // Methods will emit the comments as part of emitting method declaration emitLeadingComments(node); } - write("function "); + + // For targeting below es6, emit functions-like declaration including arrow function using function keyword. + // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead + if (!shouldEmitAsArrowFunction(node)) { + write("function "); + } + if (node.kind === SyntaxKind.FunctionDeclaration || (node.kind === SyntaxKind.FunctionExpression && node.name)) { emit(node.name); } @@ -3350,6 +3432,15 @@ module ts { decreaseIndent(); } + function emitSignatureParametersForArrow(node: FunctionLikeDeclaration) { + // Check whether the parameter list needs parentheses and preserve no-parenthesis + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitSignatureAndBody(node: FunctionLikeDeclaration) { var saveTempCount = tempCount; var saveTempVariables = tempVariables; @@ -3357,61 +3448,82 @@ module ts { tempCount = 0; tempVariables = undefined; tempParameters = undefined; - emitSignatureParameters(node); - write(" {"); - scopeEmitStart(node); - increaseIndent(); - emitDetachedComments(node.body.kind === SyntaxKind.Block ? (node.body).statements : node.body); - - var startIndex = 0; - if (node.body.kind === SyntaxKind.Block) { - startIndex = emitDirectivePrologues((node.body).statements, /*startWithNewLine*/ true); - } - var outPos = writer.getTextPos(); - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - emitNode(node.body); - emitEnd(node.body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); + // When targeting ES6, emit arrow function natively in ES6 + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); } else { - if (node.body.kind === SyntaxKind.Block) { - emitLinesStartingAt((node.body).statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(/*newLine*/ true); + emitSignatureParameters(node); + } + + write(" {"); + scopeEmitStart(node); + + if (!node.body) { writeLine(); + write("}"); + } + else { + increaseIndent(); + + emitDetachedComments(node.body.kind === SyntaxKind.Block ? (node.body).statements : node.body); + + var startIndex = 0; if (node.body.kind === SyntaxKind.Block) { - emitLeadingCommentsOfPosition((node.body).statements.end); - decreaseIndent(); - emitToken(SyntaxKind.CloseBraceToken,(node.body).statements.end); + startIndex = emitDirectivePrologues((node.body).statements, /*startWithNewLine*/ true); } - else { + var outPos = writer.getTextPos(); + + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) { decreaseIndent(); + write(" "); + emitStart(node.body); + write("return "); + + // Don't emit comments on this body. We'll have already taken care of it above + // when we called emitDetachedComments. + emitNode(node.body, /*disableComments:*/ true); + emitEnd(node.body); + write(";"); + emitTempDeclarations(/*newLine*/ false); + write(" "); emitStart(node.body); write("}"); emitEnd(node.body); } + else { + if (node.body.kind === SyntaxKind.Block) { + emitLinesStartingAt((node.body).statements, startIndex); + } + else { + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, /*disableComments:*/ true); + write(";"); + emitTrailingComments(node.body); + } + emitTempDeclarations(/*newLine*/ true); + writeLine(); + if (node.body.kind === SyntaxKind.Block) { + emitLeadingCommentsOfPosition((node.body).statements.end); + decreaseIndent(); + emitToken(SyntaxKind.CloseBraceToken, (node.body).statements.end); + } + else { + decreaseIndent(); + emitStart(node.body); + write("}"); + emitEnd(node.body); + } + } } + scopeEmitEnd(); if (node.flags & NodeFlags.Export) { writeLine(); @@ -3575,7 +3687,6 @@ module ts { } function emitClassDeclaration(node: ClassDeclaration) { - emitLeadingComments(node); write("var "); emit(node.name); write(" = (function ("); @@ -3625,7 +3736,6 @@ module ts { emitEnd(node); write(";"); } - emitTrailingComments(node); function emitConstructorOfClass() { var saveTempCount = tempCount; @@ -3704,13 +3814,17 @@ module ts { emitPinnedOrTripleSlashComments(node); } + function shouldEmitEnumDeclaration(node: EnumDeclaration) { + var isConstEnum = isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums; + } + function emitEnumDeclaration(node: EnumDeclaration) { // const enums are completely erased during compilation. - var isConstEnum = isConst(node); - if (isConstEnum && !compilerOptions.preserveConstEnums) { + if (!shouldEmitEnumDeclaration(node)) { return; } - emitLeadingComments(node); + if (!(node.flags & NodeFlags.Export)) { emitStart(node); write("var "); @@ -3727,7 +3841,7 @@ module ts { write(") {"); increaseIndent(); scopeEmitStart(node); - emitEnumMemberDeclarations(isConstEnum); + emitLines(node.members); decreaseIndent(); writeLine(); emitToken(SyntaxKind.CloseBraceToken, node.members.end); @@ -3748,31 +3862,38 @@ module ts { emitEnd(node); write(";"); } - emitTrailingComments(node); + } - function emitEnumMemberDeclarations(isConstEnum: boolean) { - forEach(node.members, member => { - writeLine(); - emitLeadingComments(member); - emitStart(member); - write(resolver.getLocalNameOfContainer(node)); - write("["); - write(resolver.getLocalNameOfContainer(node)); - write("["); - emitExpressionForPropertyName(member.name); - write("] = "); - if (member.initializer && !isConstEnum) { - emit(member.initializer); - } - else { - write(resolver.getEnumMemberValue(member).toString()); - } - write("] = "); - emitExpressionForPropertyName(member.name); - emitEnd(member); - write(";"); - emitTrailingComments(member); - }); + function emitEnumMember(node: EnumMember) { + var enumParent = node.parent; + emitStart(node); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + + function writeEnumMemberDeclarationValue(member: EnumMember) { + if (!member.initializer || isConst(member.parent)) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + } + + if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); } } @@ -3783,14 +3904,18 @@ module ts { } } + function shouldEmitModuleDeclaration(node: ModuleDeclaration) { + return isInstantiatedModule(node, compilerOptions.preserveConstEnums); + } + function emitModuleDeclaration(node: ModuleDeclaration) { // Emit only if this module is non-ambient. - var shouldEmit = isInstantiatedModule(node, compilerOptions.preserveConstEnums); + var shouldEmit = shouldEmitModuleDeclaration(node); if (!shouldEmit) { return emitPinnedOrTripleSlashComments(node); } - emitLeadingComments(node); + emitStart(node); write("var "); emit(node.name); @@ -3835,7 +3960,6 @@ module ts { emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - emitTrailingComments(node); } function emitImportDeclaration(node: ImportDeclaration) { @@ -4025,7 +4149,7 @@ module ts { emitLeadingComments(node.endOfFileToken); } - function emitNode(node: Node): void { + function emitNode(node: Node, disableComments?:boolean): void { if (!node) { return; } @@ -4033,6 +4157,46 @@ module ts { if (node.flags & NodeFlags.Ambient) { return emitPinnedOrTripleSlashComments(node); } + + var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { + emitLeadingComments(node); + } + + emitJavaScriptWorker(node); + + if (emitComments) { + emitTrailingComments(node); + } + } + + function shouldEmitLeadingAndTrailingComments(node: Node) { + switch (node.kind) { + // All of these entities are emitted in a specialized fashion. As such, we allow + // the specilized methods for each to handle the comments on the nodes. + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.ImportDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.ExportAssignment: + return false; + + case SyntaxKind.ModuleDeclaration: + // Only emit the leading/trailing comments for a module if we're actually + // emitting the module as well. + return shouldEmitModuleDeclaration(node); + + case SyntaxKind.EnumDeclaration: + // Only emit the leading/trailing comments for an enum if we're actually + // emitting the module as well. + return shouldEmitEnumDeclaration(node); + } + + // Emit comments for everything else. + return true; + } + + function emitJavaScriptWorker(node: Node) { // Check if the node can be emitted regardless of the ScriptTarget switch (node.kind) { case SyntaxKind.Identifier: @@ -4170,6 +4334,8 @@ module ts { return emitInterfaceDeclaration(node); case SyntaxKind.EnumDeclaration: return emitEnumDeclaration(node); + case SyntaxKind.EnumMember: + return emitEnumMember(node); case SyntaxKind.ModuleDeclaration: return emitModuleDeclaration(node); case SyntaxKind.ImportDeclaration: @@ -4196,20 +4362,21 @@ module ts { return leadingComments; } - function getLeadingCommentsToEmit(node: Node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments - if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) { - var leadingComments: CommentRange[]; - if (hasDetachedComments(node.pos)) { - // get comments without detached comments - leadingComments = getLeadingCommentsWithoutDetachedComments(); + if (node.parent) { + if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) { + var leadingComments: CommentRange[]; + if (hasDetachedComments(node.pos)) { + // get comments without detached comments + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + // get the leading comments from the node + leadingComments = getLeadingCommentRangesOfNode(node, currentSourceFile); + } + return leadingComments; } - else { - // get the leading comments from the node - leadingComments = getLeadingCommentRangesOfNode(node, currentSourceFile); - } - return leadingComments; } } @@ -4222,10 +4389,12 @@ module ts { function emitTrailingDeclarationComments(node: Node) { // Emit the trailing comments only if the parent's end doesn't match - if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) { - var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end); - // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + if (node.parent) { + if (node.parent.kind === SyntaxKind.SourceFile || node.end !== node.parent.end) { + var trailingComments = getTrailingCommentRanges(currentSourceFile.text, node.end); + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + } } } @@ -4310,24 +4479,6 @@ module ts { // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space emitComments(currentSourceFile, writer, pinnedComments, /*trailingSeparator*/ true, newLine, writeComment); } - - if (compilerOptions.sourceMap) { - initializeEmitterWithSourceMaps(); - } - - if (root) { - emit(root); - } - else { - forEach(host.getSourceFiles(), sourceFile => { - if (!isExternalModuleOrDeclarationFile(sourceFile)) { - emit(sourceFile); - } - }); - } - - writeLine(); - writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); } function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile) { @@ -4349,84 +4500,13 @@ module ts { writeFile(host, diagnostics, removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); } } - - var hasSemanticErrors: boolean = false; - var isEmitBlocked: boolean = false; - - if (targetSourceFile === undefined) { - // No targetSourceFile is specified (e.g. calling emitter from batch compiler) - hasSemanticErrors = resolver.hasSemanticErrors(); - isEmitBlocked = host.isEmitBlocked(); - - forEach(host.getSourceFiles(), sourceFile => { - if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, ".js"); - emitFile(jsFilePath, sourceFile); - } - }); - - if (compilerOptions.out) { - emitFile(compilerOptions.out); - } - } - else { - // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) - if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - // If shouldEmitToOwnFile returns true or targetSourceFile is an external module file, then emit targetSourceFile in its own output file - hasSemanticErrors = resolver.hasSemanticErrors(targetSourceFile); - isEmitBlocked = host.isEmitBlocked(targetSourceFile); - - var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); - emitFile(jsFilePath, targetSourceFile); - } - else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) { - // Otherwise, if --out is specified and targetSourceFile is not a declaration file, - // Emit all, non-external-module file, into one single output file - forEach(host.getSourceFiles(), sourceFile => { - if (!shouldEmitToOwnFile(sourceFile, compilerOptions)) { - hasSemanticErrors = hasSemanticErrors || resolver.hasSemanticErrors(sourceFile); - isEmitBlocked = isEmitBlocked || host.isEmitBlocked(sourceFile); - } - }); - - emitFile(compilerOptions.out); - } - } function emitFile(jsFilePath: string, sourceFile?: SourceFile) { - if (!isEmitBlocked) { - emitJavaScript(jsFilePath, sourceFile); - if (!hasSemanticErrors && compilerOptions.declaration) { - writeDeclarationFile(jsFilePath, sourceFile); - } + emitJavaScript(jsFilePath, sourceFile); + + if (compilerOptions.declaration) { + writeDeclarationFile(jsFilePath, sourceFile); } } - - // Sort and make the unique list of diagnostics - diagnostics.sort(compareDiagnostics); - diagnostics = deduplicateSortedDiagnostics(diagnostics); - - // Update returnCode if there is any EmitterError - var hasEmitterError = forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); - - // Check and update returnCode for syntactic and semantic - var emitResultStatus: EmitReturnStatus; - if (isEmitBlocked) { - emitResultStatus = EmitReturnStatus.AllOutputGenerationSkipped; - } else if (hasEmitterError) { - emitResultStatus = EmitReturnStatus.EmitErrorsEncountered; - } else if (hasSemanticErrors && compilerOptions.declaration) { - emitResultStatus = EmitReturnStatus.DeclarationGenerationSkipped; - } else if (hasSemanticErrors && !compilerOptions.declaration) { - emitResultStatus = EmitReturnStatus.JSGeneratedWithSemanticErrors; - } else { - emitResultStatus = EmitReturnStatus.Succeeded; - } - - return { - emitResultStatus, - diagnostics, - sourceMaps: sourceMapDataList - }; } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5ae44e5ff39..cd08e592be8 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3,6 +3,7 @@ module ts { var nodeConstructors = new Array Node>(SyntaxKind.Count); + /* @internal */ export var parseTime = 0; export function getNodeConstructor(kind: SyntaxKind): new () => Node { return nodeConstructors[kind] || (nodeConstructors[kind] = objectAllocator.getNodeConstructor(kind)); @@ -356,6 +357,359 @@ module ts { forEachChild(sourceFile, walk); } + function moveElementEntirelyPastChangeRange(element: IncrementalElement, delta: number) { + if (element.length) { + visitArray(element); + } + else { + visitNode(element); + } + + function visitNode(node: IncrementalNode) { + // Ditch any existing LS children we may have created. This way we can avoid + // moving them forward. + node._children = undefined; + node.pos += delta; + node.end += delta; + + forEachChild(node, visitNode, visitArray); + } + + function visitArray(array: IncrementalNodeArray) { + array.pos += delta; + array.end += delta; + + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); + } + } + } + + function adjustIntersectingElement(element: IncrementalElement, changeStart: number, changeRangeOldEnd: number, changeRangeNewEnd: number, delta: number) { + Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); + Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); + + // We have an element that intersects the change range in some way. It may have its + // start, or its end (or both) in the changed range. We want to adjust any part + // that intersects such that the final tree is in a consistent state. i.e. all + // chlidren have spans within the span of their parent, and all siblings are ordered + // properly. + + // We may need to update both the 'pos' and the 'end' of the element. + + // If the 'pos' is before the start of the change, then we don't need to touch it. + // If it isn't, then the 'pos' must be inside the change. How we update it will + // depend if delta is positive or negative. If delta is positive then we have + // something like: + // + // -------------------AAA----------------- + // -------------------BBBCCCCCCC----------------- + // + // In this case, we consider any node that started in the change range to still be + // starting at the same position. + // + // however, if the delta is negative, then we instead have something like this: + // + // -------------------XXXYYYYYYY----------------- + // -------------------ZZZ----------------- + // + // In this case, any element that started in the 'X' range will keep its position. + // However any element htat started after that will have their pos adjusted to be + // at the end of the new range. i.e. any node that started in the 'Y' range will + // be adjusted to have their start at the end of the 'Z' range. + // + // The element will keep its position if possible. Or Move backward to the new-end + // if it's in the 'Y' range. + element.pos = Math.min(element.pos, changeRangeNewEnd); + + // If the 'end' is after the change range, then we always adjust it by the delta + // amount. However, if the end is in the change range, then how we adjust it + // will depend on if delta is positive or negative. If delta is positive then we + // have something like: + // + // -------------------AAA----------------- + // -------------------BBBCCCCCCC----------------- + // + // In this case, we consider any node that ended inside the change range to keep its + // end position. + // + // however, if the delta is negative, then we instead have something like this: + // + // -------------------XXXYYYYYYY----------------- + // -------------------ZZZ----------------- + // + // In this case, any element that ended in the 'X' range will keep its position. + // However any element htat ended after that will have their pos adjusted to be + // at the end of the new range. i.e. any node that ended in the 'Y' range will + // be adjusted to have their end at the end of the 'Z' range. + if (element.end >= changeRangeOldEnd) { + // Element ends after the change range. Always adjust the end pos. + element.end += delta; + } + else { + // Element ends in the change range. The element will keep its position if + // possible. Or Move backward to the new-end if it's in the 'Y' range. + element.end = Math.min(element.end, changeRangeNewEnd); + } + + Debug.assert(element.pos <= element.end); + if (element.parent) { + Debug.assert(element.pos >= element.parent.pos); + Debug.assert(element.end <= element.parent.end); + } + } + + function updateTokenPositionsAndMarkElements(node: IncrementalNode, changeStart: number, changeRangeOldEnd: number, changeRangeNewEnd: number, delta: number): void { + visitNode(node); + + function visitNode(child: IncrementalNode) { + 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, delta); + return; + } + + // Check if the element intersects the change range. If it does, then it is not + // reusable. Also, we'll need to recurse to see what constituent portions we may + // be able to use. + var fullEnd = child.end; + if (fullEnd >= changeStart) { + child.intersectsChange = true; + + // Adjust the pos or end (or both) of the intersecting element accordingly. + adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + forEachChild(child, visitNode, visitArray); + return; + } + + // Otherwise, the node is entirely before the change range. No need to do anything with it. + } + + function visitArray(array: IncrementalNodeArray) { + if (array.pos > changeRangeOldEnd) { + // Array is entirely after the change range. We need to move it, and move any of + // its children. + moveElementEntirelyPastChangeRange(array, delta); + } + else { + // Check if the element intersects the change range. If it does, then it is not + // reusable. Also, we'll need to recurse to see what constituent portions we may + // be able to use. + var fullEnd = array.end; + if (fullEnd >= changeStart) { + array.intersectsChange = true; + + // Adjust the pos or end (or both) of the intersecting array accordingly. + adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); + } + } + // else { + // Otherwise, the array is entirely before the change range. No need to do anything with it. + // } + } + } + } + + + function extendToAffectedRange(sourceFile: SourceFile, changeRange: TextChangeRange): TextChangeRange { + // Consider the following code: + // void foo() { /; } + // + // If the text changes with an insertion of / just before the semicolon then we end up with: + // void foo() { //; } + // + // If we were to just use the changeRange a is, then we would not rescan the { token + // (as it does not intersect the actual original change range). Because an edit may + // change the token touching it, we actually need to look back *at least* one token so + // that the prior token sees that change. + var maxLookahead = 1; + + var start = changeRange.span.start; + + // the first iteration aligns us with the change start. subsequent iteration move us to + // the left by maxLookahead tokens. We only need to do this as long as we're not at the + // start of the tree. + for (var i = 0; start > 0 && i <= maxLookahead; i++) { + var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + var position = nearestNode.pos; + + start = Math.max(0, position - 1); + } + + var finalSpan = createTextSpanFromBounds(start, textSpanEnd(changeRange.span)); + var finalLength = changeRange.newLength + (changeRange.span.start - start); + + return createTextChangeRange(finalSpan, finalLength); + } + + function findNearestNodeStartingBeforeOrAtPosition(sourceFile: SourceFile, position: number): Node { + var bestResult: Node = sourceFile; + var lastNodeEntirelyBeforePosition: Node; + + forEachChild(sourceFile, visit); + + if (lastNodeEntirelyBeforePosition) { + var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition); + if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { + bestResult = lastChildOfLastEntireNodeBeforePosition; + } + } + + return bestResult; + + function getLastChild(node: Node): Node { + while (true) { + var lastChild = getLastChildWorker(node); + if (lastChild) { + node = lastChild; + } + else { + return node; + } + } + } + + function getLastChildWorker(node: Node): Node { + var last: Node = undefined; + forEachChild(node, child => { + if (nodeIsPresent(child)) { + last = child; + } + }); + return last; + } + + function visit(child: Node) { + if (nodeIsMissing(child)) { + // Missing nodes are effectively invisible to us. We never even consider them + // When trying to find the nearest node before us. + return; + } + + // If the child intersects this position, then this node is currently the nearest + // node that starts before the position. + if (child.pos <= position) { + if (child.pos >= bestResult.pos) { + // This node starts before the position, and is closer to the position than + // the previous best node we found. It is now the new best node. + bestResult = child; + } + + // Now, the node may overlap the position, or it may end entirely before the + // position. If it overlaps with the position, then either it, or one of its + // children must be the nearest node before the position. So we can just + // recurse into this child to see if we can find something better. + if (position < child.end) { + // The nearest node is either this child, or one of the children inside + // of it. We've already marked this child as the best so far. Recurse + // in case one of the children is better. + forEachChild(child, visit); + + // Once we look at the children of this node, then there's no need to + // continue any further. + return true; + } + else { + Debug.assert(child.end <= position); + // The child ends entirely before this position. Say you have the following + // (where $ is the position) + // + // ? $ : <...> <...> + // + // We would want to find the nearest preceding node in "complex expr 2". + // To support that, we keep track of this node, and once we're done searching + // for a best node, we recurse down this node to see if we can find a good + // result in it. + // + // This approach allows us to quickly skip over nodes that are entirely + // before the position, while still allowing us to find any nodes in the + // last one that might be what we want. + lastNodeEntirelyBeforePosition = child; + } + } + else { + Debug.assert(child.pos > position); + // We're now at a node that is entirely past the position we're searching for. + // This node (and all following nodes) could never contribute to the result, + // so just skip them by returning 'true' here. + return true; + } + } + } + + + // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter + // indicates what changed between the 'text' that this SourceFile has and the 'newText'. + // The SourceFile will be created with the compiler attempting to reuse as many nodes from + // this file as possible. + // + // Note: this function mutates nodes from this SourceFile. That means any existing nodes + // from this SourceFile that are being held onto may change as a result (including + // becoming detached from any SourceFile). It is recommended that this SourceFile not + // be used once 'update' is called on it. + export function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile { + if (textChangeRangeIsUnchanged(textChangeRange)) { + // if the text didn't change, then we can just return our current source file as-is. + return sourceFile; + } + + if (sourceFile.statements.length === 0) { + // If we don't have any statements in the current source file, then there's no real + // way to incrementally parse. So just do a full parse instead. + return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion,/*syntaxCursor*/ undefined, /*setNodeParents*/ true) + } + + var syntaxCursor = createSyntaxCursor(sourceFile); + + // Make the actual change larger so that we know to reparse anything whose lookahead + // might have intersected the change. + var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + + // The is the amount the nodes after the edit range need to be adjusted. It can be + // positive (if the edit added characters), negative (if the edit deleted characters) + // or zero (if this was a pure overwrite with nothing added/removed). + var delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length; + + // If we added or removed characters during the edit, then we need to go and adjust all + // the nodes after the edit. Those nodes may move forward down (if we inserted chars) + // or they may move backward (if we deleted chars). + // + // Doing this helps us out in two ways. First, it means that any nodes/tokens we want + // to reuse are already at the appropriate position in the new text. That way when we + // reuse them, we don't have to figure out if they need to be adjusted. Second, it makes + // it very easy to determine if we can reuse a node. If the node's position is at where + // we are in the text, then we can reuse it. Otherwise we can't. If hte node's position + // is ahead of us, then we'll need to rescan tokens. If the node's position is behind + // us, then we'll need to skip it or crumble it as appropriate + // + // We will also adjust the positions of nodes that intersect the change range as well. + // By doing this, we ensure that all the positions in the old tree are consistent, not + // just the positions of nodes entirely before/after the change range. By being + // consistent, we can then easily map from positions to nodes in the old tree easily. + // + // Also, mark any syntax elements that intersect the changed span. We know, up front, + // that we cannot reuse these elements. + updateTokenPositionsAndMarkElements(sourceFile, + changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta); + + // Now that we've set up our internal incremental state just proceed and parse the + // source file in the normal fashion. When possible the parser will retrieve and + // reuse nodes from the old tree. + // + // Note: passing in 'true' for setNodeParents is very important. When incrementally + // parsing, we will be reusing nodes from the old tree, and placing it into new + // parents. If we don't set the parents now, we'll end up with an observably + // inconsistent tree. Setting the parents on the new tree should be very fast. We + // will immediately bail out of walking any subtrees when we can see that their parents + // are already correct. + var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true) + + return result; + } + export function isEvalOrArgumentsIdentifier(node: Node): boolean { return node.kind === SyntaxKind.Identifier && ((node).text === "eval" || (node).text === "arguments"); @@ -496,16 +850,33 @@ module ts { } } - export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile { - var parsingContext: ParsingContext; - var identifiers: Map; + export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile { + var start = new Date().getTime(); + var result = parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); + + parseTime += new Date().getTime() - start; + return result; + } + + function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile { + var parsingContext: ParsingContext = 0; + var identifiers: Map = {}; var identifierCount = 0; var nodeCount = 0; - var lineStarts: number[]; - var syntacticDiagnostics: Diagnostic[]; var scanner: Scanner; var token: SyntaxKind; - var syntaxCursor: SyntaxCursor; + + var sourceFile = createNode(SyntaxKind.SourceFile, /*pos*/ 0); + + sourceFile.pos = 0; + sourceFile.end = sourceText.length; + sourceFile.text = sourceText; + + sourceFile.parseDiagnostics = []; + sourceFile.bindDiagnostics = []; + sourceFile.languageVersion = languageVersion; + sourceFile.fileName = normalizePath(fileName); + sourceFile.flags = fileExtensionIs(sourceFile.fileName, ".d.ts") ? NodeFlags.DeclarationFile : 0; // Flags that dictate what parsing context we're in. For example: // Whether or not we are in strict parsing mode. All that changes in strict parsing mode is @@ -553,7 +924,7 @@ module ts { // Note: it should not be necessary to save/restore these flags during speculative/lookahead // parsing. These context flags are naturally stored and restored through normal recursive // descent parsing and unwinding. - var contextFlags: ParserContextFlags; + var contextFlags: ParserContextFlags = 0; // Whether or not we've had a parse error since creating the last AST node. If we have // encountered an error, it will be stored on the next AST node we create. Parse errors @@ -582,406 +953,29 @@ module ts { // // Note: any errors at the end of the file that do not precede a regular node, should get // attached to the EOF token. - var parseErrorBeforeNextFinishedNode: boolean; + var parseErrorBeforeNextFinishedNode: boolean = false; - var sourceFile: SourceFile; + // Create and prime the scanner before parsing the source elements. + scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError); + token = nextToken(); - return parseSourceFile(sourceText, setParentNodes); + processReferenceComments(sourceFile); - function parseSourceFile(text: string, setParentNodes: boolean): SourceFile { - // Set our initial state before parsing. - sourceText = text; - parsingContext = 0; - identifiers = {}; - lineStarts = undefined; - syntacticDiagnostics = undefined; - contextFlags = 0; - parseErrorBeforeNextFinishedNode = false; + sourceFile.statements = parseList(ParsingContext.SourceElements, /*checkForStrictMode*/ true, parseSourceElement); + Debug.assert(token === SyntaxKind.EndOfFileToken); + sourceFile.endOfFileToken = parseTokenNode(); - sourceFile = createNode(SyntaxKind.SourceFile, 0); - sourceFile.referenceDiagnostics = []; - sourceFile.parseDiagnostics = []; - sourceFile.semanticDiagnostics = []; + setExternalModuleIndicator(sourceFile); - // Create and prime the scanner before parsing the source elements. - scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError); - token = nextToken(); + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.identifiers = identifiers; - sourceFile.flags = fileExtensionIs(filename, ".d.ts") ? NodeFlags.DeclarationFile : 0; - sourceFile.end = sourceText.length; - sourceFile.filename = normalizePath(filename); - sourceFile.text = sourceText; - - sourceFile.getLineAndCharacterFromPosition = getLineAndCharacterFromSourcePosition; - sourceFile.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter; - sourceFile.getLineStarts = getLineStarts; - sourceFile.getSyntacticDiagnostics = getSyntacticDiagnostics; - sourceFile.update = update; - - processReferenceComments(sourceFile); - - sourceFile.statements = parseList(ParsingContext.SourceElements, /*checkForStrictMode*/ true, parseSourceElement); - Debug.assert(token === SyntaxKind.EndOfFileToken); - sourceFile.endOfFileToken = parseTokenNode(); - - setExternalModuleIndicator(sourceFile); - - sourceFile.nodeCount = nodeCount; - sourceFile.identifierCount = identifierCount; - sourceFile.languageVersion = languageVersion; - sourceFile.identifiers = identifiers; - - if (setParentNodes) { - fixupParentReferences(sourceFile); - } - - return sourceFile; + if (setParentNodes) { + fixupParentReferences(sourceFile); } - function update(newText: string, textChangeRange: TextChangeRange) { - if (textChangeRangeIsUnchanged(textChangeRange)) { - // if the text didn't change, then we can just return our current source file as-is. - return sourceFile; - } - - if (sourceFile.statements.length === 0) { - // If we don't have any statements in the current source file, then there's no real - // way to incrementally parse. So just do a full parse instead. - return parseSourceFile(newText, /*setNodeParents*/ true); - } - - syntaxCursor = createSyntaxCursor(sourceFile); - - // Make the actual change larger so that we know to reparse anything whose lookahead - // might have intersected the change. - var changeRange = extendToAffectedRange(textChangeRange); - - // The is the amount the nodes after the edit range need to be adjusted. It can be - // positive (if the edit added characters), negative (if the edit deleted characters) - // or zero (if this was a pure overwrite with nothing added/removed). - var delta = textChangeRangeNewSpan(changeRange).length - changeRange.span.length; - - // If we added or removed characters during the edit, then we need to go and adjust all - // the nodes after the edit. Those nodes may move forward down (if we inserted chars) - // or they may move backward (if we deleted chars). - // - // Doing this helps us out in two ways. First, it means that any nodes/tokens we want - // to reuse are already at the appropriate position in the new text. That way when we - // reuse them, we don't have to figure out if they need to be adjusted. Second, it makes - // it very easy to determine if we can reuse a node. If the node's position is at where - // we are in the text, then we can reuse it. Otherwise we can't. If hte node's position - // is ahead of us, then we'll need to rescan tokens. If the node's position is behind - // us, then we'll need to skip it or crumble it as appropriate - // - // We will also adjust the positions of nodes that intersect the change range as well. - // By doing this, we ensure that all the positions in the old tree are consistent, not - // just the positions of nodes entirely before/after the change range. By being - // consistent, we can then easily map from positions to nodes in the old tree easily. - // - // Also, mark any syntax elements that intersect the changed span. We know, up front, - // that we cannot reuse these elements. - updateTokenPositionsAndMarkElements(sourceFile, - changeRange.span.start, textSpanEnd(changeRange.span), textSpanEnd(textChangeRangeNewSpan(changeRange)), delta); - - // Now that we've set up our internal incremental state just proceed and parse the - // source file in the normal fashion. When possible the parser will retrieve and - // reuse nodes from the old tree. - // - // Note: passing in 'true' for setNodeParents is very important. When incrementally - // parsing, we will be reusing nodes from the old tree, and placing it into new - // parents. If we don't set the parents now, we'll end up with an observably - // inconsistent tree. Setting the parents on the new tree should be very fast. We - // will immediately bail out of walking any subtrees when we can see that their parents - // are already correct. - var result = parseSourceFile(newText, /*setNodeParents*/ true); - - // Clear out the syntax cursor so it doesn't keep anything alive longer than it should. - syntaxCursor = undefined; - - return result; - } - - function updateTokenPositionsAndMarkElements(node: IncrementalNode, changeStart: number, changeRangeOldEnd: number, changeRangeNewEnd: number, delta: number): void { - visitNode(node); - - function visitNode(child: IncrementalNode) { - 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, delta); - return; - } - - // Check if the element intersects the change range. If it does, then it is not - // reusable. Also, we'll need to recurse to see what constituent portions we may - // be able to use. - var fullEnd = child.end; - if (fullEnd >= changeStart) { - child.intersectsChange = true; - - // Adjust the pos or end (or both) of the intersecting element accordingly. - adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - forEachChild(child, visitNode, visitArray); - return; - } - - // Otherwise, the node is entirely before the change range. No need to do anything with it. - } - - function visitArray(array: IncrementalNodeArray) { - if (array.pos > changeRangeOldEnd) { - // Array is entirely after the change range. We need to move it, and move any of - // its children. - moveElementEntirelyPastChangeRange(array, delta); - } - else { - // Check if the element intersects the change range. If it does, then it is not - // reusable. Also, we'll need to recurse to see what constituent portions we may - // be able to use. - var fullEnd = array.end; - if (fullEnd >= changeStart) { - array.intersectsChange = true; - - // Adjust the pos or end (or both) of the intersecting array accordingly. - adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); - } - } - // else { - // Otherwise, the array is entirely before the change range. No need to do anything with it. - // } - } - } - } - - function adjustIntersectingElement(element: IncrementalElement, changeStart: number, changeRangeOldEnd: number, changeRangeNewEnd: number, delta: number) { - Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); - Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); - - // We have an element that intersects the change range in some way. It may have its - // start, or its end (or both) in the changed range. We want to adjust any part - // that intersects such that the final tree is in a consistent state. i.e. all - // chlidren have spans within the span of their parent, and all siblings are ordered - // properly. - - // We may need to update both the 'pos' and the 'end' of the element. - - // If the 'pos' is before the start of the change, then we don't need to touch it. - // If it isn't, then the 'pos' must be inside the change. How we update it will - // depend if delta is positive or negative. If delta is positive then we have - // something like: - // - // -------------------AAA----------------- - // -------------------BBBCCCCCCC----------------- - // - // In this case, we consider any node that started in the change range to still be - // starting at the same position. - // - // however, if the delta is negative, then we instead have something like this: - // - // -------------------XXXYYYYYYY----------------- - // -------------------ZZZ----------------- - // - // In this case, any element that started in the 'X' range will keep its position. - // However any element htat started after that will have their pos adjusted to be - // at the end of the new range. i.e. any node that started in the 'Y' range will - // be adjusted to have their start at the end of the 'Z' range. - // - // The element will keep its position if possible. Or Move backward to the new-end - // if it's in the 'Y' range. - element.pos = Math.min(element.pos, changeRangeNewEnd); - - // If the 'end' is after the change range, then we always adjust it by the delta - // amount. However, if the end is in the change range, then how we adjust it - // will depend on if delta is positive or negative. If delta is positive then we - // have something like: - // - // -------------------AAA----------------- - // -------------------BBBCCCCCCC----------------- - // - // In this case, we consider any node that ended inside the change range to keep its - // end position. - // - // however, if the delta is negative, then we instead have something like this: - // - // -------------------XXXYYYYYYY----------------- - // -------------------ZZZ----------------- - // - // In this case, any element that ended in the 'X' range will keep its position. - // However any element htat ended after that will have their pos adjusted to be - // at the end of the new range. i.e. any node that ended in the 'Y' range will - // be adjusted to have their end at the end of the 'Z' range. - if (element.end >= changeRangeOldEnd) { - // Element ends after the change range. Always adjust the end pos. - element.end += delta; - } - else { - // Element ends in the change range. The element will keep its position if - // possible. Or Move backward to the new-end if it's in the 'Y' range. - element.end = Math.min(element.end, changeRangeNewEnd); - } - - Debug.assert(element.pos <= element.end); - if (element.parent) { - Debug.assert(element.pos >= element.parent.pos); - Debug.assert(element.end <= element.parent.end); - } - } - - function moveElementEntirelyPastChangeRange(element: IncrementalElement, delta: number) { - if (element.length) { - visitArray(element); - } - else { - visitNode(element); - } - - function visitNode(node: IncrementalNode) { - // Ditch any existing LS children we may have created. This way we can avoid - // moving them forward. - node._children = undefined; - node.pos += delta; - node.end += delta; - - forEachChild(node, visitNode, visitArray); - } - - function visitArray(array: IncrementalNodeArray) { - array.pos += delta; - array.end += delta; - - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); - } - } - } - - function extendToAffectedRange(changeRange: TextChangeRange): TextChangeRange { - // Consider the following code: - // void foo() { /; } - // - // If the text changes with an insertion of / just before the semicolon then we end up with: - // void foo() { //; } - // - // If we were to just use the changeRange a is, then we would not rescan the { token - // (as it does not intersect the actual original change range). Because an edit may - // change the token touching it, we actually need to look back *at least* one token so - // that the prior token sees that change. - var maxLookahead = 1; - - var start = changeRange.span.start; - - // the first iteration aligns us with the change start. subsequent iteration move us to - // the left by maxLookahead tokens. We only need to do this as long as we're not at the - // start of the tree. - for (var i = 0; start > 0 && i <= maxLookahead; i++) { - var nearestNode = findNearestNodeStartingBeforeOrAtPosition(start); - var position = nearestNode.pos; - - start = Math.max(0, position - 1); - } - - var finalSpan = createTextSpanFromBounds(start, textSpanEnd(changeRange.span)); - var finalLength = changeRange.newLength + (changeRange.span.start - start); - - return createTextChangeRange(finalSpan, finalLength); - } - - function findNearestNodeStartingBeforeOrAtPosition(position: number): Node { - var bestResult: Node = sourceFile; - var lastNodeEntirelyBeforePosition: Node; - - forEachChild(sourceFile, visit); - - if (lastNodeEntirelyBeforePosition) { - var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition); - if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { - bestResult = lastChildOfLastEntireNodeBeforePosition; - } - } - - return bestResult; - - function getLastChild(node: Node): Node { - while (true) { - var lastChild = getLastChildWorker(node); - if (lastChild) { - node = lastChild; - } - else { - return node; - } - } - } - - function getLastChildWorker(node: Node): Node { - var last:Node = undefined; - forEachChild(node, child => { - if (nodeIsPresent(child)) { - last = child; - } - }); - return last; - } - - function visit(child: Node) { - if (nodeIsMissing(child)) { - // Missing nodes are effectively invisible to us. We never even consider them - // When trying to find the nearest node before us. - return; - } - - // If the child intersects this position, then this node is currently the nearest - // node that starts before the position. - if (child.pos <= position) { - if (child.pos >= bestResult.pos) { - // This node starts before the position, and is closer to the position than - // the previous best node we found. It is now the new best node. - bestResult = child; - } - - // Now, the node may overlap the position, or it may end entirely before the - // position. If it overlaps with the position, then either it, or one of its - // children must be the nearest node before the position. So we can just - // recurse into this child to see if we can find something better. - if (position < child.end) { - // The nearest node is either this child, or one of the children inside - // of it. We've already marked this child as the best so far. Recurse - // in case one of the children is better. - forEachChild(child, visit); - - // Once we look at the children of this node, then there's no need to - // continue any further. - return true; - } - else { - Debug.assert(child.end <= position); - // The child ends entirely before this position. Say you have the following - // (where $ is the position) - // - // ? $ : <...> <...> - // - // We would want to find the nearest preceding node in "complex expr 2". - // To support that, we keep track of this node, and once we're done searching - // for a best node, we recurse down this node to see if we can find a good - // result in it. - // - // This approach allows us to quickly skip over nodes that are entirely - // before the position, while still allowing us to find any nodes in the - // last one that might be what we want. - lastNodeEntirelyBeforePosition = child; - } - } - else { - Debug.assert(child.pos > position); - // We're now at a node that is entirely past the position we're searching for. - // This node (and all following nodes) could never contribute to the result, - // so just skip them by returning 'true' here. - return true; - } - } - } + return sourceFile; function setContextFlag(val: Boolean, flag: ParserContextFlags) { if (val) { @@ -1072,18 +1066,6 @@ module ts { return (contextFlags & ParserContextFlags.DisallowIn) !== 0; } - function getLineStarts(): number[] { - return lineStarts || (lineStarts = computeLineStarts(sourceText)); - } - - function getLineAndCharacterFromSourcePosition(position: number) { - return getLineAndCharacterOfPosition(getLineStarts(), position); - } - - function getPositionFromSourceLineAndCharacter(line: number, character: number): number { - return getPositionFromLineAndCharacter(getLineStarts(), line, character); - } - function parseErrorAtCurrentToken(message: DiagnosticMessage, arg0?: any): void { var start = scanner.getTokenPos(); var length = scanner.getTextPos() - start; @@ -4678,7 +4660,7 @@ module ts { } function processReferenceComments(sourceFile: SourceFile): void { - var triviaScanner = createScanner(languageVersion, /*skipTrivia*/false, sourceText); + var triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText); var referencedFiles: FileReference[] = []; var amdDependencies: string[] = []; var amdModuleName: string; @@ -4707,7 +4689,7 @@ module ts { referencedFiles.push(fileReference); } if (diagnosticMessage) { - sourceFile.referenceDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); + sourceFile.parseDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); } } else { @@ -4715,7 +4697,7 @@ module ts { var amdModuleNameMatchResult = amdModuleNameRegEx.exec(comment); if (amdModuleNameMatchResult) { if (amdModuleName) { - sourceFile.referenceDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments)); + sourceFile.parseDiagnostics.push(createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, Diagnostics.An_AMD_module_cannot_have_multiple_name_assignments)); } amdModuleName = amdModuleNameMatchResult[2]; } @@ -4741,17 +4723,6 @@ module ts { ? node : undefined); } - - function getSyntacticDiagnostics() { - if (syntacticDiagnostics === undefined) { - // Don't bother doing any grammar checks if there are already parser errors. - // Otherwise we may end up with too many cascading errors. - syntacticDiagnostics = sourceFile.referenceDiagnostics.concat(sourceFile.parseDiagnostics); - } - - Debug.assert(syntacticDiagnostics !== undefined); - return syntacticDiagnostics; - } } export function isLeftHandSideExpression(expr: Expression): boolean { diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 06e63635232..954c443a77c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2,6 +2,8 @@ /// module ts { + /* @internal */ export var emitTime = 0; + export function createCompilerHost(options: CompilerOptions): CompilerHost { var currentDirectory: string; var existingDirectories: Map = {}; @@ -15,20 +17,20 @@ module ts { // returned by CScript sys environment var unsupportedFileEncodingErrorCode = -2147024809; - function getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile { + function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile { try { - var text = sys.readFile(filename, options.charset); + var text = sys.readFile(fileName, options.charset); } catch (e) { if (onError) { - onError(e.number === unsupportedFileEncodingErrorCode ? - createCompilerDiagnostic(Diagnostics.Unsupported_file_encoding).messageText : - e.message); + onError(e.number === unsupportedFileEncodingErrorCode + ? createCompilerDiagnostic(Diagnostics.Unsupported_file_encoding).messageText + : e.message); } text = ""; } - return text !== undefined ? createSourceFile(filename, text, languageVersion) : undefined; + return text !== undefined ? createSourceFile(fileName, text, languageVersion) : undefined; } function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) { @@ -64,7 +66,7 @@ module ts { return { getSourceFile, - getDefaultLibFilename: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts"), + getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)), writeFile, getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()), useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, @@ -73,161 +75,237 @@ module ts { }; } - export function createProgram(rootNames: string[], options: CompilerOptions, host: CompilerHost): Program { + export function getPreEmitDiagnostics(program: Program): Diagnostic[] { + var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + return sortAndDeduplicateDiagnostics(diagnostics); + } + + export function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string { + if (typeof messageText === "string") { + return messageText; + } + else { + var diagnosticChain = messageText; + var result = ""; + + var indent = 0; + while (diagnosticChain) { + if (indent) { + result += newLine; + + for (var i = 0; i < indent; i++) { + result += " "; + } + } + result += diagnosticChain.messageText; + indent++; + diagnosticChain = diagnosticChain.next; + } + + return result; + } + } + + export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program { var program: Program; var files: SourceFile[] = []; var filesByName: Map = {}; - var errors: Diagnostic[] = []; + var diagnostics = createDiagnosticCollection(); var seenNoDefaultLib = options.noLib; var commonSourceDirectory: string; + host = host || createCompilerHost(options); forEach(rootNames, name => processRootFile(name, false)); if (!seenNoDefaultLib) { - processRootFile(host.getDefaultLibFilename(options), true); + processRootFile(host.getDefaultLibFileName(options), true); } verifyCompilerOptions(); - errors.sort(compareDiagnostics); - var diagnosticsProducingTypeChecker: TypeChecker; var noDiagnosticsTypeChecker: TypeChecker; - var emitHost: EmitHost; program = { getSourceFile: getSourceFile, getSourceFiles: () => files, getCompilerOptions: () => options, - getCompilerHost: () => host, - getDiagnostics: getDiagnostics, - getGlobalDiagnostics: getGlobalDiagnostics, - getDeclarationDiagnostics: getDeclarationDiagnostics, + getSyntacticDiagnostics, + getGlobalDiagnostics, + getSemanticDiagnostics, + getDeclarationDiagnostics, getTypeChecker, + getDiagnosticsProducingTypeChecker, getCommonSourceDirectory: () => commonSourceDirectory, - emitFiles: invokeEmitter, - isEmitBlocked, + emit, getCurrentDirectory: host.getCurrentDirectory, + getNodeCount: () => getDiagnosticsProducingTypeChecker().getNodeCount(), + getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(), + getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(), + getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(), }; return program; - function getEmitHost() { - return emitHost || (emitHost = createEmitHostFromProgram(program)); - } - - function hasEarlyErrors(sourceFile?: SourceFile): boolean { - return forEach(getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile), d => d.isEarly); - } - - function isEmitBlocked(sourceFile?: SourceFile): boolean { - return getDiagnostics(sourceFile).length !== 0 || - hasEarlyErrors(sourceFile) || - (options.noEmitOnError && getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile).length !== 0); + function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost { + return { + getCanonicalFileName: host.getCanonicalFileName, + getCommonSourceDirectory: program.getCommonSourceDirectory, + getCompilerOptions: program.getCompilerOptions, + getCurrentDirectory: host.getCurrentDirectory, + getNewLine: host.getNewLine, + getSourceFile: program.getSourceFile, + getSourceFiles: program.getSourceFiles, + writeFile: writeFileCallback || host.writeFile, + }; } function getDiagnosticsProducingTypeChecker() { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ true)); } - function getTypeChecker(produceDiagnostics: boolean) { - if (produceDiagnostics) { - return getDiagnosticsProducingTypeChecker(); - } - else { - return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, produceDiagnostics)); - } + function getTypeChecker() { + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ false)); } - function getDeclarationDiagnostics(targetSourceFile: SourceFile): Diagnostic[]{ - var typeChecker = getDiagnosticsProducingTypeChecker(); - typeChecker.getDiagnostics(targetSourceFile); - var resolver = typeChecker.getEmitResolver(); + function getDeclarationDiagnostics(targetSourceFile: SourceFile): Diagnostic[] { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(targetSourceFile); return ts.getDeclarationDiagnostics(getEmitHost(), resolver, targetSourceFile); } - function invokeEmitter(targetSourceFile?: SourceFile) { - var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(); - return emitFiles(resolver, getEmitHost(), targetSourceFile); - } - - function getSourceFile(filename: string) { - filename = host.getCanonicalFileName(filename); - return hasProperty(filesByName, filename) ? filesByName[filename] : undefined; + function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback): EmitResult { + // If the noEmitOnError flag is set, then check if we have any errors so far. If so, + // immediately bail out. + if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { + return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + } + + var start = new Date().getTime(); + + var emitResult = emitFiles( + getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile), + getEmitHost(writeFileCallback), + sourceFile); + + emitTime += new Date().getTime() - start; + return emitResult; } - function getDiagnostics(sourceFile?: SourceFile): Diagnostic[] { - return sourceFile ? filter(errors, e => e.file === sourceFile) : errors; + function getSourceFile(fileName: string) { + fileName = host.getCanonicalFileName(fileName); + return hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; + } + + function getDiagnosticsHelper(sourceFile: SourceFile, getDiagnostics: (sourceFile: SourceFile) => Diagnostic[]): Diagnostic[] { + if (sourceFile) { + return getDiagnostics(sourceFile); + } + + var allDiagnostics: Diagnostic[] = []; + forEach(program.getSourceFiles(), sourceFile => { + addRange(allDiagnostics, getDiagnostics(sourceFile)); + }); + + return sortAndDeduplicateDiagnostics(allDiagnostics); + } + + function getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[] { + return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile); + } + + function getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[] { + return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile); + } + + function getSyntacticDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] { + return sourceFile.parseDiagnostics; + } + + function getSemanticDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] { + var typeChecker = getDiagnosticsProducingTypeChecker(); + + Debug.assert(!!sourceFile.bindDiagnostics); + var bindDiagnostics = sourceFile.bindDiagnostics; + var checkDiagnostics = typeChecker.getDiagnostics(sourceFile); + var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + + return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); } function getGlobalDiagnostics(): Diagnostic[] { - return filter(errors, e => !e.file); + var typeChecker = getDiagnosticsProducingTypeChecker(); + + var allDiagnostics: Diagnostic[] = []; + addRange(allDiagnostics, typeChecker.getGlobalDiagnostics()); + addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + + return sortAndDeduplicateDiagnostics(allDiagnostics); } - function hasExtension(filename: string): boolean { - return getBaseFilename(filename).indexOf(".") >= 0; + function hasExtension(fileName: string): boolean { + return getBaseFileName(fileName).indexOf(".") >= 0; } - function processRootFile(filename: string, isDefaultLib: boolean) { - processSourceFile(normalizePath(filename), isDefaultLib); + function processRootFile(fileName: string, isDefaultLib: boolean) { + processSourceFile(normalizePath(fileName), isDefaultLib); } - function processSourceFile(filename: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) { + function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) { if (refEnd !== undefined && refPos !== undefined) { var start = refPos; var length = refEnd - refPos; } var diagnostic: DiagnosticMessage; - if (hasExtension(filename)) { - if (!options.allowNonTsExtensions && !fileExtensionIs(filename, ".ts")) { + if (hasExtension(fileName)) { + if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts; } - else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; } - else if (refFile && host.getCanonicalFileName(filename) === host.getCanonicalFileName(refFile.filename)) { + else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself; } } else { - if (options.allowNonTsExtensions && !findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; } - else if (!findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; - filename += ".ts"; + fileName += ".ts"; } } if (diagnostic) { if (refFile) { - errors.push(createFileDiagnostic(refFile, start, length, diagnostic, filename)); + diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, fileName)); } else { - errors.push(createCompilerDiagnostic(diagnostic, filename)); + diagnostics.add(createCompilerDiagnostic(diagnostic, fileName)); } } } - // Get source file from normalized filename - function findSourceFile(filename: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile { - var canonicalName = host.getCanonicalFileName(filename); + // Get source file from normalized fileName + function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile { + var canonicalName = host.getCanonicalFileName(fileName); if (hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result - return getSourceFileFromCache(filename, canonicalName, /*useAbsolutePath*/ false); + return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); } else { - var normalizedAbsolutePath = getNormalizedAbsolutePath(filename, host.getCurrentDirectory()); + var normalizedAbsolutePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); if (hasProperty(filesByName, canonicalAbsolutePath)) { return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true); } // We haven't looked for this file, do so now and cache result - var file = filesByName[canonicalName] = host.getSourceFile(filename, options.target, hostErrorMessage => { + var file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, hostErrorMessage => { if (refFile) { - errors.push(createFileDiagnostic(refFile, refStart, refLength, - Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + diagnostics.add(createFileDiagnostic(refFile, refStart, refLength, + Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - errors.push(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); if (file) { @@ -237,7 +315,7 @@ module ts { filesByName[canonicalAbsolutePath] = file; if (!options.noResolve) { - var basePath = getDirectoryPath(filename); + var basePath = getDirectoryPath(fileName); processReferencedFiles(file, basePath); processImportedModules(file, basePath); } @@ -247,20 +325,17 @@ module ts { else { files.push(file); } - forEach(file.getSyntacticDiagnostics(), e => { - errors.push(e); - }); } } return file; - function getSourceFileFromCache(filename: string, canonicalName: string, useAbsolutePath: boolean): SourceFile { + function getSourceFileFromCache(fileName: string, canonicalName: string, useAbsolutePath: boolean): SourceFile { var file = filesByName[canonicalName]; if (file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.filename, host.getCurrentDirectory()) : file.filename; + var sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { - errors.push(createFileDiagnostic(refFile, refStart, refLength, - Diagnostics.Filename_0_differs_from_already_included_filename_1_only_in_casing, filename, sourceFileName)); + diagnostics.add(createFileDiagnostic(refFile, refStart, refLength, + Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } return file; @@ -269,8 +344,8 @@ module ts { function processReferencedFiles(file: SourceFile, basePath: string) { forEach(file.referencedFiles, ref => { - var referencedFilename = isRootedDiskPath(ref.filename) ? ref.filename : combinePaths(basePath, ref.filename); - processSourceFile(normalizePath(referencedFilename), /* isDefaultLib */ false, file, ref.pos, ref.end); + var referencedFileName = isRootedDiskPath(ref.fileName) ? ref.fileName : combinePaths(basePath, ref.fileName); + processSourceFile(normalizePath(referencedFileName), /* isDefaultLib */ false, file, ref.pos, ref.end); }); } @@ -324,8 +399,8 @@ module ts { } }); - function findModuleSourceFile(filename: string, nameLiteral: LiteralExpression) { - return findSourceFile(filename, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + function findModuleSourceFile(fileName: string, nameLiteral: LiteralExpression) { + return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); } } @@ -333,10 +408,10 @@ module ts { if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - errors.push(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); } if (options.sourceRoot) { - errors.push(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); } return; } @@ -347,7 +422,7 @@ module ts { var externalModuleErrorSpan = getErrorSpanForNode(firstExternalModule.externalModuleIndicator); var errorStart = skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); var errorLength = externalModuleErrorSpan.end - errorStart; - errors.push(createFileDiagnostic(firstExternalModule, errorStart, errorLength, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(createFileDiagnostic(firstExternalModule, errorStart, errorLength, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } // there has to be common source directory if user specified --outdir || --sourcRoot @@ -361,14 +436,14 @@ module ts { forEach(files, sourceFile => { // Each file contributes into common source file path if (!(sourceFile.flags & NodeFlags.DeclarationFile) - && !fileExtensionIs(sourceFile.filename, ".js")) { - var sourcePathComponents = getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); + && !fileExtensionIs(sourceFile.fileName, ".js")) { + var sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); // FileName is not part of directory if (commonPathComponents) { for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { - errors.push(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); return; } @@ -401,11 +476,11 @@ module ts { if (options.noEmit) { if (options.out || options.outDir) { - errors.push(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir)); } if (options.declaration) { - errors.push(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); } } } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 4aef773004b..fbbd69bbd69 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -278,12 +278,20 @@ module ts { return result; } - export function getPositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number { - Debug.assert(line > 0 && line <= lineStarts.length ); + export function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + } + + export function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number { + Debug.assert(line > 0 && line <= lineStarts.length); return lineStarts[line - 1] + character - 1; } - export function getLineAndCharacterOfPosition(lineStarts: number[], position: number) { + export function getLineStarts(sourceFile: SourceFile): number[] { + return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); + } + + export function computeLineAndCharacterOfPosition(lineStarts: number[], position: number) { var lineNumber = binarySearch(lineStarts, position); if (lineNumber < 0) { // If the actual position was not found, @@ -298,9 +306,8 @@ module ts { }; } - export function positionToLineAndCharacter(text: string, pos: number) { - var lineStarts = computeLineStarts(text); - return getLineAndCharacterOfPosition(lineStarts, pos); + export function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } var hasOwnProperty = Object.prototype.hasOwnProperty; diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index ee5dc5104ff..4bcd0856ca8 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -2,7 +2,7 @@ /// module ts { - var version = "1.4.0.0"; + var version = "1.5.0.0"; export interface SourceFile { fileWatcher: FileWatcher; @@ -72,27 +72,27 @@ module ts { function countLines(program: Program): number { var count = 0; forEach(program.getSourceFiles(), file => { - count += file.getLineAndCharacterFromPosition(file.end).line; + count += getLineAndCharacterOfPosition(file, file.end).line; }); return count; } function getDiagnosticText(message: DiagnosticMessage, ...args: any[]): string { - var diagnostic: Diagnostic = createCompilerDiagnostic.apply(undefined, arguments); - return diagnostic.messageText; + var diagnostic = createCompilerDiagnostic.apply(undefined, arguments); + return diagnostic.messageText; } function reportDiagnostic(diagnostic: Diagnostic) { var output = ""; if (diagnostic.file) { - var loc = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): "; + output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; } var category = DiagnosticCategory[diagnostic.category].toLowerCase(); - output += category + " TS" + diagnostic.code + ": " + diagnostic.messageText + sys.newLine; + output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) + sys.newLine; sys.write(output); } @@ -136,27 +136,27 @@ module ts { function findConfigFile(): string { var searchPath = normalizePath(sys.getCurrentDirectory()); - var filename = "tsconfig.json"; + var fileName = "tsconfig.json"; while (true) { - if (sys.fileExists(filename)) { - return filename; + if (sys.fileExists(fileName)) { + return fileName; } var parentPath = getDirectoryPath(searchPath); if (parentPath === searchPath) { break; } searchPath = parentPath; - filename = "../" + filename; + fileName = "../" + fileName; } return undefined; } export function executeCommandLine(args: string[]): void { var commandLine = parseCommandLine(args); - var configFilename: string; // Configuration file name (if any) + var configFileName: string; // Configuration file name (if any) var configFileWatcher: FileWatcher; // Configuration file watcher var cachedProgram: Program; // Program cached from last compilation - var rootFilenames: string[]; // Root filenames for compilation + var rootFileNames: string[]; // Root fileNames for compilation var compilerOptions: CompilerOptions; // Compiler options for compilation var compilerHost: CompilerHost; // Compiler host var hostGetSourceFile: typeof compilerHost.getSourceFile; // getSourceFile method from default host @@ -165,7 +165,7 @@ module ts { if (commandLine.options.locale) { if (!isJSONSupported()) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } @@ -174,48 +174,48 @@ module ts { // setting up localization, report them and quit. if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } if (commandLine.options.version) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Version_0, version)); - return sys.exit(EmitReturnStatus.Succeeded); + return sys.exit(ExitStatus.Success); } if (commandLine.options.help) { printVersion(); printHelp(); - return sys.exit(EmitReturnStatus.Succeeded); + return sys.exit(ExitStatus.Success); } if (commandLine.options.project) { if (!isJSONSupported()) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - configFilename = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json")); - if (commandLine.filenames.length !== 0) { + configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json")); + if (commandLine.fileNames.length !== 0) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } } - else if (commandLine.filenames.length === 0 && isJSONSupported()) { - configFilename = findConfigFile(); + else if (commandLine.fileNames.length === 0 && isJSONSupported()) { + configFileName = findConfigFile(); } - if (commandLine.filenames.length === 0 && !configFilename) { + if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); printHelp(); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + return sys.exit(ExitStatus.Success); } if (commandLine.options.watch) { if (!sys.watchFile) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - if (configFilename) { - configFileWatcher = sys.watchFile(configFilename, configFileChanged); + if (configFileName) { + configFileWatcher = sys.watchFile(configFileName, configFileChanged); } } @@ -225,22 +225,22 @@ module ts { function performCompilation() { if (!cachedProgram) { - if (configFilename) { - var configObject = readConfigFile(configFilename); + if (configFileName) { + var configObject = readConfigFile(configFileName); if (!configObject) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFilename)); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFileName)); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - var configParseResult = parseConfigFile(configObject, getDirectoryPath(configFilename)); + var configParseResult = parseConfigFile(configObject, getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); - return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - rootFilenames = configParseResult.filenames; + rootFileNames = configParseResult.fileNames; compilerOptions = extend(commandLine.options, configParseResult.options); } else { - rootFilenames = commandLine.filenames; + rootFileNames = commandLine.fileNames; compilerOptions = commandLine.options; } compilerHost = createCompilerHost(compilerOptions); @@ -248,7 +248,7 @@ module ts { compilerHost.getSourceFile = getSourceFile; } - var compileResult = compile(rootFilenames, compilerOptions, compilerHost); + var compileResult = compile(rootFileNames, compilerOptions, compilerHost); if (!commandLine.options.watch) { return sys.exit(compileResult.exitStatus); @@ -258,20 +258,20 @@ module ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes)); } - function getSourceFile(filename: string, languageVersion: ScriptTarget, onError ?: (message: string) => void) { + function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError ?: (message: string) => void) { // Return existing SourceFile object if one is available if (cachedProgram) { - var sourceFile = cachedProgram.getSourceFile(filename); + var sourceFile = cachedProgram.getSourceFile(fileName); // A modified source file has no watcher and should not be reused if (sourceFile && sourceFile.fileWatcher) { return sourceFile; } } // Use default host function - var sourceFile = hostGetSourceFile(filename, languageVersion, onError); + var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && commandLine.options.watch) { // Attach a file watcher - sourceFile.fileWatcher = sys.watchFile(sourceFile.filename, () => sourceFileChanged(sourceFile)); + sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, () => sourceFileChanged(sourceFile)); } return sourceFile; } @@ -321,45 +321,22 @@ module ts { } } - function compile(filenames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) { - var parseStart = new Date().getTime(); - var program = createProgram(filenames, compilerOptions, compilerHost); + function compile(fileNames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) { + ts.parseTime = 0; + ts.bindTime = 0; + ts.checkTime = 0; + ts.emitTime = 0; - var bindStart = new Date().getTime(); - var errors: Diagnostic[] = program.getDiagnostics(); - var exitStatus: EmitReturnStatus; + var start = new Date().getTime(); - if (errors.length) { - var checkStart = bindStart; - var emitStart = bindStart; - var reportStart = bindStart; - exitStatus = EmitReturnStatus.AllOutputGenerationSkipped; - } - else { - var checker = program.getTypeChecker(/*fullTypeCheckMode*/ true); - var checkStart = new Date().getTime(); - errors = checker.getDiagnostics(); - if (program.isEmitBlocked()) { - exitStatus = EmitReturnStatus.AllOutputGenerationSkipped; - } - else if (compilerOptions.noEmit) { - exitStatus = EmitReturnStatus.Succeeded; - } - else { - var emitStart = new Date().getTime(); - var emitOutput = program.emitFiles(); - var emitErrors = emitOutput.diagnostics; - exitStatus = emitOutput.emitResultStatus; - var reportStart = new Date().getTime(); - errors = concatenate(errors, emitErrors); - } - } + var program = createProgram(fileNames, compilerOptions, compilerHost); + var exitStatus = compileProgram(); - reportDiagnostics(errors); + var end = start - new Date().getTime(); if (compilerOptions.listFiles) { forEach(program.getSourceFiles(), file => { - sys.write(file.filename + sys.newLine); + sys.write(file.fileName + sys.newLine); }); } @@ -367,21 +344,65 @@ module ts { var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1; reportCountStatistic("Files", program.getSourceFiles().length); reportCountStatistic("Lines", countLines(program)); - reportCountStatistic("Nodes", checker ? checker.getNodeCount() : 0); - reportCountStatistic("Identifiers", checker ? checker.getIdentifierCount() : 0); - reportCountStatistic("Symbols", checker ? checker.getSymbolCount() : 0); - reportCountStatistic("Types", checker ? checker.getTypeCount() : 0); + reportCountStatistic("Nodes", program.getNodeCount()); + reportCountStatistic("Identifiers", program.getIdentifierCount()); + reportCountStatistic("Symbols", program.getSymbolCount()); + reportCountStatistic("Types", program.getTypeCount()); + if (memoryUsed >= 0) { reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); } - reportTimeStatistic("Parse time", bindStart - parseStart); - reportTimeStatistic("Bind time", checkStart - bindStart); - reportTimeStatistic("Check time", emitStart - checkStart); - reportTimeStatistic("Emit time", reportStart - emitStart); - reportTimeStatistic("Total time", reportStart - parseStart); + + reportTimeStatistic("Parse time", ts.parseTime); + reportTimeStatistic("Bind time", ts.bindTime); + reportTimeStatistic("Check time", ts.checkTime); + reportTimeStatistic("Emit time", ts.emitTime); + reportTimeStatistic("Total time", start - end); } return { program, exitStatus }; + + function compileProgram(): ExitStatus { + // First get any syntactic errors. + var diagnostics = program.getSyntacticDiagnostics(); + reportDiagnostics(diagnostics); + + // If we didn't have any syntactic errors, then also try getting the global and + // semantic errors. + if (diagnostics.length === 0) { + var diagnostics = program.getGlobalDiagnostics(); + reportDiagnostics(diagnostics); + + if (diagnostics.length === 0) { + var diagnostics = program.getSemanticDiagnostics(); + reportDiagnostics(diagnostics); + } + } + + // If the user doesn't want us to emit, then we're done at this point. + if (compilerOptions.noEmit) { + return diagnostics.length + ? ExitStatus.DiagnosticsPresent_OutputsSkipped + : ExitStatus.Success; + } + + // Otherwise, emit and report any errors we ran into. + var emitOutput = program.emit(); + reportDiagnostics(emitOutput.diagnostics); + + // If the emitter didn't emit anything, then pass that value along. + if (emitOutput.emitSkipped) { + return ExitStatus.DiagnosticsPresent_OutputsSkipped; + } + + // The emitter emitted something, inform the caller if that happened in the presence + // of diagnostics or not. + if (diagnostics.length > 0 || emitOutput.diagnostics.length > 0) { + ExitStatus.DiagnosticsPresent_OutputsGenerated; + } + + return ExitStatus.Success; + } } function printVersion() { @@ -413,7 +434,7 @@ module ts { output += getDiagnosticText(Diagnostics.Options_Colon) + sys.newLine; // Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch") - var optsList = optionDeclarations.slice(); + var optsList = filter(optionDeclarations.slice(), v => !v.experimental); optsList.sort((a, b) => compareValues(a.name.toLowerCase(), b.name.toLowerCase())); // We want our descriptions to align at the same column in our output, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b8c842641d7..1c79ef169e9 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -330,6 +330,12 @@ module ts { HasAggregatedChildData = 1 << 6 } + export const enum RelationComparisonResult { + Succeeded = 1, // Should be truthy + Failed = 2, + FailedAndReported = 3 + } + export interface Node extends TextRange { kind: SyntaxKind; flags: NodeFlags; @@ -866,7 +872,7 @@ module ts { } export interface FileReference extends TextRange { - filename: string; + fileName: string; } export interface CommentRange extends TextRange { @@ -878,77 +884,79 @@ module ts { statements: NodeArray; endOfFileToken: Node; - filename: string; + fileName: string; text: string; - getLineAndCharacterFromPosition(position: number): LineAndCharacter; - getPositionFromLineAndCharacter(line: number, character: number): number; - getLineStarts(): number[]; - - // Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter - // indicates what changed between the 'text' that this SourceFile has and the 'newText'. - // The SourceFile will be created with the compiler attempting to reuse as many nodes from - // this file as possible. - // - // Note: this function mutates nodes from this SourceFile. That means any existing nodes - // from this SourceFile that are being held onto may change as a result (including - // becoming detached from any SourceFile). It is recommended that this SourceFile not - // be used once 'update' is called on it. - update(newText: string, textChangeRange: TextChangeRange): SourceFile; - amdDependencies: string[]; amdModuleName: string; referencedFiles: FileReference[]; - // Diagnostics reported about the "///; + + /* @internal */ nodeCount: number; + /* @internal */ identifierCount: number; + /* @internal */ symbolCount: number; + + // File level diagnostics reported by the parser (includes diagnostics about /// references + // as well as code diagnostics). + /* @internal */ parseDiagnostics: Diagnostic[]; + + // File level diagnostics reported by the binder. + /* @internal */ bindDiagnostics: Diagnostic[]; + + // Stores a line map for the file. + // This field should never be used directly to obtain line map, use getLineMap function instead. + /* @internal */ lineMap: number[]; } export interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } + export interface WriteFileCallback { + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + } + export interface Program extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; - getCompilerHost(): CompilerHost; - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; + + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; getGlobalDiagnostics(): Diagnostic[]; - getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; // Gets a type checker that can be used to semantically analyze source fils in the program. - // The 'produceDiagnostics' flag determines if the checker will produce diagnostics while - // analyzing the code. It can be set to 'false' to make many type checking operaitons - // faster. With this flag set, the checker can avoid codepaths only necessary to produce - // diagnostics, but not necessary to answer semantic questions about the code. - // - // If 'produceDiagnostics' is false, then any calls to get diagnostics from the TypeChecker - // will throw an invalid operation exception. - getTypeChecker(produceDiagnostics: boolean): TypeChecker; + getTypeChecker(): TypeChecker; + getCommonSourceDirectory(): string; - emitFiles(targetSourceFile?: SourceFile): EmitResult; - isEmitBlocked(sourceFile?: SourceFile): boolean; + // For testing purposes only. Should not be used by any other consumers (including the + // language service). + /* @internal */ getDiagnosticsProducingTypeChecker(): TypeChecker; + + /* @internal */ getNodeCount(): number; + /* @internal */ getIdentifierCount(): number; + /* @internal */ getSymbolCount(): number; + /* @internal */ getTypeCount(): number; } export interface SourceMapSpan { @@ -973,37 +981,33 @@ module ts { } // Return code used by getEmitOutput function to indicate status of the function - export enum EmitReturnStatus { - Succeeded = 0, // All outputs generated if requested (.js, .map, .d.ts), no errors reported - AllOutputGenerationSkipped = 1, // No .js generated because of syntax errors, nothing generated - JSGeneratedWithSemanticErrors = 2, // .js and .map generated with semantic errors - DeclarationGenerationSkipped = 3, // .d.ts generation skipped because of semantic errors or declaration emitter specific errors; Output .js with semantic errors - EmitErrorsEncountered = 4, // Emitter errors occurred during emitting process - CompilerOptionsErrors = 5, // Errors occurred in parsing compiler options, nothing generated + export enum ExitStatus { + // Compiler ran successfully. Either this was a simple do-nothing compilation (for example, + // when -version or -help was provided, or this was a normal compilation, no diagnostics + // were produced, and all outputs were generated successfully. + Success = 0, + + // Diagnostics were produced and because of them no code was generated. + DiagnosticsPresent_OutputsSkipped = 1, + + // Diagnostics were produced and outputs were generated in spite of them. + DiagnosticsPresent_OutputsGenerated = 2, } export interface EmitResult { - emitResultStatus: EmitReturnStatus; + emitSkipped: boolean; diagnostics: Diagnostic[]; sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps } export interface TypeCheckerHost { getCompilerOptions(): CompilerOptions; - getCompilerHost(): CompilerHost; getSourceFiles(): SourceFile[]; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; } export interface TypeChecker { - getEmitResolver(): EmitResolver; - getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; - getGlobalDiagnostics(): Diagnostic[]; - getNodeCount(): number; - getIdentifierCount(): number; - getSymbolCount(): number; - getTypeCount(): number; getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; getPropertiesOfType(type: Type): Symbol[]; @@ -1028,10 +1032,19 @@ module ts { isUndefinedSymbol(symbol: Symbol): boolean; isArgumentsSymbol(symbol: Symbol): boolean; - // Returns the constant value of this enum member, or 'undefined' if the enum member has a computed value. - getEnumMemberValue(node: EnumMember): number; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; getAliasedSymbol(symbol: Symbol): Symbol; + + // Should not be called directly. Should only be accessed through the Program instance. + /* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + /* @internal */ getGlobalDiagnostics(): Diagnostic[]; + /* @internal */ getEmitResolver(sourceFile?: SourceFile): EmitResolver; + + /* @internal */ getNodeCount(): number; + /* @internal */ getIdentifierCount(): number; + /* @internal */ getSymbolCount(): number; + /* @internal */ getTypeCount(): number; } export interface SymbolDisplayBuilder { @@ -1074,6 +1087,7 @@ module ts { WriteOwnNameForAnyLike = 0x00000010, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc) WriteTypeArgumentsOfSignature = 0x00000020, // Write the type arguments instead of type parameters of the signature InElementType = 0x00000040, // Writing an array or union element type + UseFullyQualifiedType = 0x00000080, // Write out the fully qualified type name (eg. Module.Type, instead of Type) } export const enum SymbolFormatFlags { @@ -1115,8 +1129,6 @@ module ts { isReferencedImportDeclaration(node: ImportDeclaration): boolean; isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; - getEnumMemberValue(node: EnumMember): number; - hasSemanticErrors(sourceFile?: SourceFile): boolean; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; @@ -1124,7 +1136,7 @@ module ts { isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; // Returns the constant value this property access resolves to, or 'undefined' for a non-constant - getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; isUnknownIdentifier(location: Node, name: string): boolean; } @@ -1266,29 +1278,33 @@ module ts { } export const enum TypeFlags { - Any = 0x00000001, - String = 0x00000002, - Number = 0x00000004, - Boolean = 0x00000008, - Void = 0x00000010, - Undefined = 0x00000020, - Null = 0x00000040, - Enum = 0x00000080, // Enum type - StringLiteral = 0x00000100, // String literal type - TypeParameter = 0x00000200, // Type parameter - Class = 0x00000400, // Class - Interface = 0x00000800, // Interface - Reference = 0x00001000, // Generic type reference - Tuple = 0x00002000, // Tuple - Union = 0x00004000, // Union - Anonymous = 0x00008000, // Anonymous - FromSignature = 0x00010000, // Created for signature assignment check - Unwidened = 0x00020000, // Unwidened type (is or contains Undefined or Null type) + Any = 0x00000001, + String = 0x00000002, + Number = 0x00000004, + Boolean = 0x00000008, + Void = 0x00000010, + Undefined = 0x00000020, + Null = 0x00000040, + Enum = 0x00000080, // Enum type + StringLiteral = 0x00000100, // String literal type + TypeParameter = 0x00000200, // Type parameter + Class = 0x00000400, // Class + Interface = 0x00000800, // Interface + Reference = 0x00001000, // Generic type reference + Tuple = 0x00002000, // Tuple + Union = 0x00004000, // Union + Anonymous = 0x00008000, // Anonymous + FromSignature = 0x00010000, // Created for signature assignment check + ObjectLiteral = 0x00020000, // Originates in an object literal + ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type + ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, + Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum, StringLike = String | StringLiteral, NumberLike = Number | Enum, ObjectType = Class | Interface | Reference | Tuple | Anonymous, + RequiresWidening = ContainsUndefinedOrNull | ContainsObjectLiteral } // Properties common to all types @@ -1407,7 +1423,6 @@ module ts { key: string; category: DiagnosticCategory; code: number; - isEarly?: boolean; } // A linked list of formatted diagnostic messages to be used as part of a multiline message. @@ -1425,13 +1440,9 @@ module ts { file: SourceFile; start: number; length: number; - messageText: string; + messageText: string | DiagnosticMessageChain; category: DiagnosticCategory; code: number; - /** - * Early error - any error (can be produced at parsing\binding\typechecking step) that blocks emit - */ - isEarly?: boolean; } export enum DiagnosticCategory { @@ -1470,6 +1481,7 @@ module ts { target?: ScriptTarget; version?: boolean; watch?: boolean; + stripInternal?: boolean; [option: string]: string | number | boolean; } @@ -1496,18 +1508,19 @@ module ts { export interface ParsedCommandLine { options: CompilerOptions; - filenames: string[]; + fileNames: string[]; errors: Diagnostic[]; } export interface CommandLineOption { name: string; type: string | Map; // "string", "number", "boolean", or an object literal mapping named values to actual values - isFilePath?: boolean; // True if option value is a path or filename + isFilePath?: boolean; // True if option value is a path or fileName shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' description?: DiagnosticMessage; // The message describing what the command line switch does paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter error?: DiagnosticMessage; // The error given when the argument does not fit a customized 'type' + experimental?: boolean; } export const enum CharacterCodes { @@ -1650,10 +1663,10 @@ module ts { } export interface CompilerHost { - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getDefaultLibFilename(options: CompilerOptions): string; + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; getCancellationToken? (): CancellationToken; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; @@ -1669,4 +1682,24 @@ module ts { span: TextSpan; newLength: number; } + + // @internal + export interface DiagnosticCollection { + // Adds a diagnostic to this diagnostic collection. + add(diagnostic: Diagnostic): void; + + // Gets all the diagnostics that aren't associated with a file. + getGlobalDiagnostics(): Diagnostic[]; + + // If fileName is provided, gets all the diagnostics associated with that file name. + // Otherwise, returns all the diagnostics (global and file associated) in this colletion. + getDiagnostics(fileName?: string): Diagnostic[]; + + // Gets a count of how many times this collection has been modified. This value changes + // each time 'add' is called (regardless of whether or not an equivalent diagnostic was + // already in the collection). As such, it can be used as a simple way to tell if any + // operation caused diagnostics to be returned by storing and comparing the return value + // of this method before/after the operation is performed. + getModificationCount(): number; + } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7494ec9f6cb..5a50e2799dc 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -25,13 +25,12 @@ module ts { export interface EmitHost extends ScriptReferenceHost { getSourceFiles(): SourceFile[]; - isEmitBlocked(sourceFile?: SourceFile): boolean; getCommonSourceDirectory(): string; getCanonicalFileName(fileName: string): string; getNewLine(): string; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile: WriteFileCallback; } // Pool writers to avoid needing to allocate them for every symbol we write. @@ -109,8 +108,8 @@ module ts { // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); - var loc = file.getLineAndCharacterFromPosition(node.pos); - return file.filename + "(" + loc.line + "," + loc.character + ")"; + var loc = getLineAndCharacterOfPosition(file, node.pos); + return file.fileName + "(" + loc.line + "," + loc.character + ")"; } export function getStartPosOfNode(node: Node): number { @@ -199,12 +198,19 @@ module ts { return createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); } - export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain, newLine: string): Diagnostic { + export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic { node = getErrorSpanForNode(node); var file = getSourceFileOfNode(node); var start = skipTrivia(file.text, node.pos); var length = node.end - start; - return flattenDiagnosticChain(file, start, length, messageChain, newLine); + return { + file, + start, + length, + code: messageChain.code, + category: messageChain.category, + messageText: messageChain.next ? messageChain : messageChain.messageText + }; } export function getErrorSpanForNode(node: Node): Node { @@ -399,6 +405,21 @@ module ts { return undefined; } switch (node.kind) { + case SyntaxKind.ComputedPropertyName: + // If the grandparent node is an object literal (as opposed to a class), + // then the computed property is not a 'this' container. + // A computed property name in a class needs to be a this container + // so that we can error on it. + if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) { + return node; + } + // If this is a computed property, then the parent should not + // make it a this container. The parent might be a property + // in an object literal, like a method or accessor. But in order for + // such a parent to be a this container, the reference must be in + // the *body* of the container. + node = node.parent; + break; case SyntaxKind.ArrowFunction: if (!includeArrowFunctions) { continue; @@ -421,13 +442,32 @@ module ts { } } - export function getSuperContainer(node: Node): Node { + export function getSuperContainer(node: Node, includeFunctions: boolean): Node { while (true) { node = node.parent; - if (!node) { - return undefined; - } + if (!node) return node; switch (node.kind) { + case SyntaxKind.ComputedPropertyName: + // If the grandparent node is an object literal (as opposed to a class), + // then the computed property is not a 'super' container. + // A computed property name in a class needs to be a super container + // so that we can error on it. + if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) { + return node; + } + // If this is a computed property, then the parent should not + // make it a super container. The parent might be a property + // in an object literal, like a method or accessor. But in order for + // such a parent to be a super container, the reference must be in + // the *body* of the container. + node = node.parent; + break; + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.ArrowFunction: + if (!includeFunctions) { + continue; + } case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: case SyntaxKind.MethodDeclaration: @@ -527,6 +567,8 @@ module ts { return node === (parent).expression; case SyntaxKind.TemplateSpan: return node === (parent).expression; + case SyntaxKind.ComputedPropertyName: + return node === (parent).expression; default: if (isExpression(parent)) { return true; @@ -710,7 +752,7 @@ module ts { export function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference) { if (!host.getCompilerOptions().noResolve) { - var referenceFileName = isRootedDiskPath(reference.filename) ? reference.filename : combinePaths(getDirectoryPath(sourceFile.filename), reference.filename); + var referenceFileName = isRootedDiskPath(reference.fileName) ? reference.fileName : combinePaths(getDirectoryPath(sourceFile.fileName), reference.fileName); referenceFileName = getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); return host.getSourceFile(referenceFileName); } @@ -768,7 +810,7 @@ module ts { fileReference: { pos: start, end: end, - filename: matchResult[3] + fileName: matchResult[3] }, isNoDefaultLib: false }; @@ -807,21 +849,6 @@ module ts { return false; } - export function createEmitHostFromProgram(program: Program): EmitHost { - var compilerHost = program.getCompilerHost(); - return { - getCanonicalFileName: compilerHost.getCanonicalFileName, - getCommonSourceDirectory: program.getCommonSourceDirectory, - getCompilerOptions: program.getCompilerOptions, - getCurrentDirectory: compilerHost.getCurrentDirectory, - getNewLine: compilerHost.getNewLine, - getSourceFile: program.getSourceFile, - getSourceFiles: program.getSourceFiles, - isEmitBlocked: program.isEmitBlocked, - writeFile: compilerHost.writeFile, - }; - } - export function textSpanEnd(span: TextSpan) { return span.start + span.length } @@ -1032,4 +1059,84 @@ module ts { return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength: */newEndN - oldStartN); } + + // @internal + export function createDiagnosticCollection(): DiagnosticCollection { + var nonFileDiagnostics: Diagnostic[] = []; + var fileDiagnostics: Map = {}; + + var diagnosticsModified = false; + var modificationCount = 0; + + return { + add, + getGlobalDiagnostics, + getDiagnostics, + getModificationCount + }; + + function getModificationCount() { + return modificationCount; + } + + function add(diagnostic: Diagnostic): void { + var diagnostics: Diagnostic[]; + if (diagnostic.file) { + diagnostics = fileDiagnostics[diagnostic.file.fileName]; + if (!diagnostics) { + diagnostics = []; + fileDiagnostics[diagnostic.file.fileName] = diagnostics; + } + } + else { + diagnostics = nonFileDiagnostics; + } + + diagnostics.push(diagnostic); + diagnosticsModified = true; + modificationCount++; + } + + function getGlobalDiagnostics(): Diagnostic[] { + sortAndDeduplicate(); + return nonFileDiagnostics; + } + + function getDiagnostics(fileName?: string): Diagnostic[] { + sortAndDeduplicate(); + if (fileName) { + return fileDiagnostics[fileName] || []; + } + + var allDiagnostics: Diagnostic[] = []; + function pushDiagnostic(d: Diagnostic) { + allDiagnostics.push(d); + } + + forEach(nonFileDiagnostics, pushDiagnostic); + + for (var key in fileDiagnostics) { + if (hasProperty(fileDiagnostics, key)) { + forEach(fileDiagnostics[key], pushDiagnostic); + } + } + + return sortAndDeduplicateDiagnostics(allDiagnostics); + } + + function sortAndDeduplicate() { + if (!diagnosticsModified) { + return; + } + + diagnosticsModified = false; + nonFileDiagnostics = sortAndDeduplicateDiagnostics(nonFileDiagnostics); + + for (var key in fileDiagnostics) { + if (hasProperty(fileDiagnostics, key)) { + fileDiagnostics[key] = sortAndDeduplicateDiagnostics(fileDiagnostics[key]); + } + } + } + } } \ No newline at end of file diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index a88620c4e6c..e4979f7a3c4 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -256,11 +256,40 @@ class CompilerBaselineRunner extends RunnerBase { it('Correct type baselines for ' + fileName, () => { // NEWTODO: Type baselines if (result.errors.length === 0) { - Harness.Baseline.runBaseline('Correct expression types for ' + fileName, justName.replace(/\.ts/, '.types'), () => { + // The full walker simulates the types that you would get from doing a full + // compile. The pull walker simulates the types you get when you just do + // a type query for a random node (like how the LS would do it). Most of the + // time, these will be the same. However, occasionally, they can be different. + // Specifically, when the compiler internally depends on symbol IDs to order + // things, then we may see different results because symbols can be created in a + // different order with 'pull' operations, and thus can produce slightly differing + // output. + // + // For example, with a full type check, we may see a type outputed as: number | string + // But with a pull type check, we may see it as: string | number + // + // These types are equivalent, but depend on what order the compiler observed + // certain parts of the program. + + var fullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ true); + var pullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ false); + + var fullTypes = generateTypes(fullWalker); + var pullTypes = generateTypes(pullWalker); + + if (fullTypes !== pullTypes) { + Harness.Baseline.runBaseline('Correct full expression types for ' + fileName, justName.replace(/\.ts/, '.types'), () => fullTypes); + Harness.Baseline.runBaseline('Correct pull expression types for ' + fileName, justName.replace(/\.ts/, '.types.pull'), () => pullTypes); + } + else { + Harness.Baseline.runBaseline('Correct expression types for ' + fileName, justName.replace(/\.ts/, '.types'), () => fullTypes); + } + + function generateTypes(walker: TypeWriterWalker): string { var allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName)); var typeLines: string[] = []; var typeMap: { [fileName: string]: { [lineNum: number]: string[]; } } = {}; - var walker = new TypeWriterWalker(program); + allFiles.forEach(file => { var codeLines = file.content.split('\n'); walker.getTypes(file.unitName).forEach(result => { @@ -299,7 +328,7 @@ class CompilerBaselineRunner extends RunnerBase { }); return typeLines.join(''); - }); + } } }); }); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 512248197a4..d829ce0b83e 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -118,7 +118,7 @@ module FourSlash { baselineFile: 'BaselineFile', declaration: 'declaration', emitThisFile: 'emitThisFile', // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project - filename: 'Filename', + fileName: 'Filename', mapRoot: 'mapRoot', module: 'module', out: 'out', @@ -129,7 +129,7 @@ module FourSlash { }; // List of allowed metadata names - var fileMetadataNames = [testOptMetadataNames.filename, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference]; + var fileMetadataNames = [testOptMetadataNames.fileName, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference]; var globalMetadataNames = [testOptMetadataNames.baselineFile, testOptMetadataNames.declaration, testOptMetadataNames.mapRoot, testOptMetadataNames.module, testOptMetadataNames.out, testOptMetadataNames.outDir, testOptMetadataNames.sourceMap, testOptMetadataNames.sourceRoot] @@ -237,9 +237,6 @@ module FourSlash { getLength: () => { return sourceText.length; }, - getLineStartPositions: () => { - return []; - }, getChangeRange: (oldSnapshot: ts.IScriptSnapshot) => { return undefined; } @@ -271,7 +268,7 @@ module FourSlash { private scenarioActions: string[] = []; private taoInvalidReason: string = null; - private inputFiles: ts.Map = {}; // Map between inputFile's filename and its content for easily looking up when resolving references + private inputFiles: ts.Map = {}; // Map between inputFile's fileName and its content for easily looking up when resolving references // Add input file which has matched file name with the given reference-file path. // This is necessary when resolveReference flag is specified @@ -363,9 +360,9 @@ module FourSlash { }; this.testData.files.forEach(file => { - var filename = file.fileName.replace(Harness.IO.directoryName(file.fileName), '').substr(1); - var filenameWithoutExtension = filename.substr(0, filename.lastIndexOf(".")); - this.scenarioActions.push(''); + var fileName = file.fileName.replace(Harness.IO.directoryName(file.fileName), '').substr(1); + var fileNameWithoutExtension = fileName.substr(0, fileName.lastIndexOf(".")); + this.scenarioActions.push(''); }); // Open the first file by default @@ -391,7 +388,7 @@ module FourSlash { this.currentCaretPosition = pos; var lineStarts = ts.computeLineStarts(this.getCurrentFileContent()); - var lineCharPos = ts.getLineAndCharacterOfPosition(lineStarts, pos); + var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); this.scenarioActions.push(''); } @@ -412,8 +409,8 @@ module FourSlash { var fileToOpen: FourSlashFile = this.findFile(indexOrName); fileToOpen.fileName = ts.normalizeSlashes(fileToOpen.fileName); this.activeFile = fileToOpen; - var filename = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1); - this.scenarioActions.push(''); + var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1); + this.scenarioActions.push(''); } public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) { @@ -516,7 +513,9 @@ module FourSlash { } errors.forEach(function (error: ts.Diagnostic) { - Harness.IO.log(" minChar: " + error.start + ", limChar: " + (error.start + error.length) + ", message: " + error.messageText + "\n"); + Harness.IO.log(" minChar: " + error.start + + ", limChar: " + (error.start + error.length) + + ", message: " + ts.flattenDiagnosticMessageText(error.messageText, ts.sys.newLine) + "\n"); }); } @@ -665,7 +664,16 @@ module FourSlash { Harness.IO.log(errorMsg); this.raiseError("Completion list is not empty at Caret"); + } + } + public verifyCompletionListAllowsNewIdentifier(negative: boolean) { + var completions = this.getCompletionListAtCaret(); + + if ((completions && !completions.isNewIdentifierLocation) && !negative) { + this.raiseError("Expected builder completion entry"); + } else if ((completions && completions.isNewIdentifierLocation) && negative) { + this.raiseError("Un-expected builder completion entry"); } } @@ -733,7 +741,7 @@ module FourSlash { var localFiles = this.testData.files.map(file => file.fileName); // Count only the references in local files. Filter the ones in lib and other files. ts.forEach(references, entry => { - if (localFiles.some((filename) => filename === entry.fileName)) { + if (localFiles.some((fileName) => fileName === entry.fileName)) { ++referencesCount; } }); @@ -1141,16 +1149,24 @@ module FourSlash { // Loop through all the emittedFiles and emit them one by one emitFiles.forEach(emitFile => { var emitOutput = this.languageService.getEmitOutput(emitFile.fileName); - var emitOutputStatus = emitOutput.emitOutputStatus; // Print emitOutputStatus in readable format - resultString += "EmitOutputStatus : " + ts.EmitReturnStatus[emitOutputStatus]; - resultString += "\n"; + resultString += "EmitSkipped: " + emitOutput.emitSkipped + ts.sys.newLine; + + if (emitOutput.emitSkipped) { + resultString += "Diagnostics:" + ts.sys.newLine; + var diagnostics = ts.getPreEmitDiagnostics(this.languageService.getProgram()); + for (var i = 0, n = diagnostics.length; i < n; i++) { + resultString += " " + diagnostics[0].messageText + ts.sys.newLine; + } + } + emitOutput.outputFiles.forEach((outputFile, idx, array) => { - var filename = "Filename : " + outputFile.name + "\n"; - resultString = resultString + filename + outputFile.text; + var fileName = "FileName : " + outputFile.name + ts.sys.newLine; + resultString = resultString + fileName + outputFile.text; }); - resultString += "\n"; + resultString += ts.sys.newLine; }); + return resultString; }, true /* run immediately */); @@ -1182,7 +1198,10 @@ module FourSlash { if (errorList.length) { errorList.forEach(err => { - Harness.IO.log("start: " + err.start + ", length: " + err.length + ", message: " + err.messageText); + Harness.IO.log( + "start: " + err.start + + ", length: " + err.length + + ", message: " + ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine)); }); } } @@ -1396,15 +1415,15 @@ module FourSlash { var incrementalSourceFile = this.languageService.getSourceFile(this.activeFile.fileName); Utils.assertInvariants(incrementalSourceFile, /*parent:*/ undefined); - var incrementalSyntaxDiagnostics = incrementalSourceFile.getSyntacticDiagnostics(); + var incrementalSyntaxDiagnostics = incrementalSourceFile.parseDiagnostics; // Check syntactic structure var snapshot = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName); var content = snapshot.getText(0, snapshot.getLength()); var referenceSourceFile = ts.createLanguageServiceSourceFile( - this.activeFile.fileName, createScriptSnapShot(content), ts.ScriptTarget.Latest, /*version:*/ "0", /*isOpen:*/ false, /*setNodeParents:*/ false); - var referenceSyntaxDiagnostics = referenceSourceFile.getSyntacticDiagnostics(); + this.activeFile.fileName, createScriptSnapShot(content), ts.ScriptTarget.Latest, /*version:*/ "0", /*setNodeParents:*/ false); + var referenceSyntaxDiagnostics = referenceSourceFile.parseDiagnostics; Utils.assertDiagnosticsEquals(incrementalSyntaxDiagnostics, referenceSyntaxDiagnostics); Utils.assertStructuralEquals(incrementalSourceFile, referenceSourceFile); @@ -2134,7 +2153,7 @@ module FourSlash { } } else if (typeof indexOrName === 'string') { var name = indexOrName; - // names are stored in the compiler with this relative path, this allows people to use goTo.file on just the filename + // names are stored in the compiler with this relative path, this allows people to use goTo.file on just the fileName name = name.indexOf('/') === -1 ? 'tests/cases/fourslash/' + name : name; var availableNames: string[] = []; var foundIt = false; @@ -2206,20 +2225,20 @@ module FourSlash { currentTestState = new TestState(testData); var result = ''; - var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFilename, content: undefined }, + var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined }, { unitName: fileName, content: content }], (fn, contents) => result = contents, ts.ScriptTarget.Latest, ts.sys.useCaseSensitiveFileNames); // TODO (drosen): We need to enforce checking on these tests. - var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); - var checker = ts.createTypeChecker(program, /*produceDiagnostics*/ true); + var program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); - var errors = program.getDiagnostics().concat(checker.getDiagnostics()); - if (errors.length > 0) { - throw new Error('Error compiling ' + fileName + ': ' + errors.map(e => e.messageText).join('\r\n')); + var diagnostics = ts.getPreEmitDiagnostics(program); + if (diagnostics.length > 0) { + throw new Error('Error compiling ' + fileName + ': ' + + diagnostics.map(e => ts.flattenDiagnosticMessageText(e.messageText, ts.sys.newLine)).join('\r\n')); } - program.emitFiles(); + program.emit(); result = result || ''; // Might have an empty fourslash file // Compile and execute the test @@ -2299,8 +2318,8 @@ module FourSlash { if (globalMetadataNamesIndex === -1) { if (fileMetadataNamesIndex === -1) { throw new Error('Unrecognized metadata name "' + match[1] + '". Available global metadata names are: ' + globalMetadataNames.join(', ') + '; file metadata names are: ' + fileMetadataNames.join(', ')); - } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.filename)) { - // Found an @Filename directive, if this is not the first then create a new subfile + } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.fileName)) { + // Found an @FileName directive, if this is not the first then create a new subfile if (currentFileContent) { var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); file.fileOptions = currentFileOptions; diff --git a/src/harness/harness.ts b/src/harness/harness.ts index df73e52a605..8002b019551 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -52,7 +52,7 @@ module Utils { export var currentExecutionEnvironment = getExecutionEnvironment(); - export function evalFile(fileContents: string, filename: string, nodeContext?: any) { + export function evalFile(fileContents: string, fileName: string, nodeContext?: any) { var environment = getExecutionEnvironment(); switch (environment) { case ExecutionEnvironment.CScript: @@ -62,9 +62,9 @@ module Utils { case ExecutionEnvironment.Node: var vm = require('vm'); if (nodeContext) { - vm.runInNewContext(fileContents, nodeContext, filename); + vm.runInNewContext(fileContents, nodeContext, fileName); } else { - vm.runInThisContext(fileContents, filename); + vm.runInThisContext(fileContents, fileName); } break; default: @@ -107,7 +107,7 @@ module Utils { export function memoize(f: T): T { var cache: { [idx: string]: any } = {}; - return (() => { + return (function () { var key = Array.prototype.join.call(arguments); var cachedResult = cache[key]; if (cachedResult) { @@ -183,7 +183,7 @@ module Utils { return { start: diagnostic.start, length: diagnostic.length, - messageText: diagnostic.messageText, + messageText: ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine), category: (ts).DiagnosticCategory[diagnostic.category], code: diagnostic.code }; @@ -305,10 +305,11 @@ module Utils { assert.equal(d1.start, d2.start, "d1.start !== d2.start"); assert.equal(d1.length, d2.length, "d1.length !== d2.length"); - assert.equal(d1.messageText, d2.messageText, "d1.messageText !== d2.messageText"); + assert.equal( + ts.flattenDiagnosticMessageText(d1.messageText, ts.sys.newLine), + ts.flattenDiagnosticMessageText(d2.messageText, ts.sys.newLine), "d1.messageText !== d2.messageText"); assert.equal(d1.category, d2.category, "d1.category !== d2.category"); assert.equal(d1.code, d2.code, "d1.code !== d2.code"); - assert.equal(d1.isEarly, d2.isEarly, "d1.isEarly !== d2.isEarly"); } } @@ -390,9 +391,9 @@ module Harness { writeFile(path: string, contents: string): void; directoryName(path: string): string; createDirectory(path: string): void; - fileExists(filename: string): boolean; + fileExists(fileName: string): boolean; directoryExists(path: string): boolean; - deleteFile(filename: string): void; + deleteFile(fileName: string): void; listFiles(path: string, filter: RegExp, options?: { recursive?: boolean }): string[]; log(text: string): void; getMemoryUsage? (): number; @@ -622,7 +623,7 @@ module Harness { // root of the server if (dirPath.match(/localhost:\d+$/) || dirPath.match(/localhost:\d+\/$/)) { dirPath = null; - // path + filename + // path + fileName } else if (dirPath.indexOf('.') === -1) { dirPath = dirPath.substring(0, dirPath.lastIndexOf('/')); // path @@ -693,26 +694,26 @@ module Harness { module Harness { - var tcServicesFilename = "typescriptServices.js"; + var tcServicesFileName = "typescriptServices.js"; export var libFolder: string; switch (Utils.getExecutionEnvironment()) { case Utils.ExecutionEnvironment.CScript: libFolder = "built/local/"; - tcServicesFilename = "built/local/typescriptServices.js"; + tcServicesFileName = "built/local/typescriptServices.js"; break; case Utils.ExecutionEnvironment.Node: libFolder = "built/local/"; - tcServicesFilename = "built/local/typescriptServices.js"; + tcServicesFileName = "built/local/typescriptServices.js"; break; case Utils.ExecutionEnvironment.Browser: libFolder = "built/local/"; - tcServicesFilename = "built/local/typescriptServices.js"; + tcServicesFileName = "built/local/typescriptServices.js"; break; default: throw new Error('Unknown context'); } - export var tcServicesFile = IO.readFile(tcServicesFilename); + export var tcServicesFile = IO.readFile(tcServicesFileName); export interface SourceMapEmitterCallback { (emittedFile: string, emittedLine: number, emittedColumn: number, sourceFile: string, sourceLine: number, sourceColumn: number, sourceName: string): void; @@ -801,7 +802,7 @@ module Harness { // Cache these between executions so we don't have to re-parse them for every test - export var fourslashFilename = 'fourslash.ts'; + export var fourslashFileName = 'fourslash.ts'; export var fourslashSourceFile: ts.SourceFile; export function getCanonicalFileName(fileName: string): string { @@ -820,14 +821,14 @@ module Harness { return useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - var filemap: { [filename: string]: ts.SourceFile; } = {}; + var filemap: { [fileName: string]: ts.SourceFile; } = {}; var getCurrentDirectory = currentDirectory === undefined ? ts.sys.getCurrentDirectory : () => currentDirectory; // Register input files function register(file: { unitName: string; content: string; }) { if (file.content !== undefined) { - var filename = ts.normalizeSlashes(file.unitName); - filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, scriptTarget); + var fileName = ts.normalizeSlashes(file.unitName); + filemap[getCanonicalFileName(fileName)] = ts.createSourceFile(fileName, file.content, scriptTarget); } }; inputFiles.forEach(register); @@ -842,8 +843,8 @@ module Harness { var canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory)); return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined; } - else if (fn === fourslashFilename) { - var tsFn = 'tests/cases/fourslash/' + fourslashFilename; + else if (fn === fourslashFileName) { + var tsFn = 'tests/cases/fourslash/' + fourslashFileName; fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), scriptTarget); return fourslashSourceFile; } @@ -855,7 +856,7 @@ module Harness { return undefined; } }, - getDefaultLibFilename: options => defaultLibFileName, + getDefaultLibFileName: options => defaultLibFileName, writeFile, getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, @@ -931,10 +932,12 @@ module Harness { settingsCallback(null); } + var newLine = '\r\n'; + var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames; this.settings.forEach(setting => { switch (setting.flag.toLowerCase()) { - // "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve" + // "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve" case "module": case "modulegentarget": if (typeof setting.value === 'string') { @@ -1009,13 +1012,16 @@ module Harness { case 'newline': case 'newlines': - ts.sys.newLine = setting.value; + newLine = setting.value; break; case 'comments': options.removeComments = setting.value === 'false'; break; + case 'stripinternal': + options.stripInternal = !!setting.value; + case 'usecasesensitivefilenames': useCaseSensitiveFileNames = setting.value === 'true'; break; @@ -1051,7 +1057,7 @@ module Harness { break; case 'includebuiltfile': - inputFiles.push({ unitName: setting.value, content: IO.readFile(libFolder + setting.value) }); + inputFiles.push({ unitName: setting.value, content: normalizeLineEndings(IO.readFile(libFolder + setting.value), newLine) }); break; default: @@ -1062,42 +1068,34 @@ module Harness { var filemap: { [name: string]: ts.SourceFile; } = {}; var register = (file: { unitName: string; content: string; }) => { if (file.content !== undefined) { - var filename = ts.normalizeSlashes(file.unitName); - filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, options.target); + var fileName = ts.normalizeSlashes(file.unitName); + filemap[getCanonicalFileName(fileName)] = ts.createSourceFile(fileName, file.content, options.target); } }; inputFiles.forEach(register); otherFiles.forEach(register); var fileOutputs: GeneratedFile[] = []; - + var programFiles = inputFiles.map(file => file.unitName); var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(otherFiles), (fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }), options.target, useCaseSensitiveFileNames, currentDirectory)); - var checker = program.getTypeChecker(/*produceDiagnostics*/ true); - - var isEmitBlocked = program.isEmitBlocked(); - - // only emit if there weren't parse errors - var emitResult: ts.EmitResult; - if (!isEmitBlocked) { - emitResult = program.emitFiles(); - } + var emitResult = program.emit(); var errors: HarnessDiagnostic[] = []; - program.getDiagnostics().concat(checker.getDiagnostics()).concat(emitResult ? emitResult.diagnostics : []).forEach(err => { + ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).forEach(err => { // TODO: new compiler formats errors after this point to add . and newlines so we'll just do it manually for now errors.push(getMinimalDiagnostic(err)); }); this.lastErrors = errors; - var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult ? emitResult.sourceMaps : undefined); + var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult.sourceMaps); onComplete(result, program); // reset what newline means in case the last test changed it - ts.sys.newLine = '\r\n'; + ts.sys.newLine = newLine; return options; } @@ -1144,12 +1142,12 @@ module Harness { var sourceFileName: string; if (ts.isExternalModule(sourceFile) || !options.out) { if (options.outDir) { - var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, result.currentDirectoryForProgram); + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, result.currentDirectoryForProgram); sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), ""); sourceFileName = ts.combinePaths(options.outDir, sourceFilePath); } else { - sourceFileName = sourceFile.filename; + sourceFileName = sourceFile.fileName; } } else { @@ -1169,15 +1167,23 @@ module Harness { } } + function normalizeLineEndings(text: string, lineEnding: string): string { + var normalized = text.replace(/\r\n?/g, '\n'); + if (lineEnding !== '\n') { + normalized = normalized.replace(/\n/g, lineEnding); + } + return normalized; + } + export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; return { - filename: err.file && err.file.filename, + fileName: err.file && err.file.fileName, start: err.start, end: err.start + err.length, line: errorLineInfo.line, character: errorLineInfo.character, - message: err.messageText, + message: ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine), category: ts.DiagnosticCategory[err.category].toLowerCase(), code: err.code }; @@ -1187,8 +1193,8 @@ module Harness { // This is basically copied from tsc.ts's reportError to replicate what tsc does var errorOutput = ""; ts.forEach(diagnostics, diagnotic => { - if (diagnotic.filename) { - errorOutput += diagnotic.filename + "(" + diagnotic.line + "," + diagnotic.character + "): "; + if (diagnotic.fileName) { + errorOutput += diagnotic.fileName + "(" + diagnotic.line + "," + diagnotic.character + "): "; } errorOutput += diagnotic.category + " TS" + diagnotic.code + ": " + diagnotic.message + ts.sys.newLine; @@ -1198,7 +1204,7 @@ module Harness { } function compareDiagnostics(d1: HarnessDiagnostic, d2: HarnessDiagnostic) { - return ts.compareValues(d1.filename, d2.filename) || + return ts.compareValues(d1.fileName, d2.fileName) || ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.end, d2.end) || ts.compareValues(d1.code, d2.code) || @@ -1224,14 +1230,14 @@ module Harness { } // Report global errors - var globalErrors = diagnostics.filter(err => !err.filename); + var globalErrors = diagnostics.filter(err => !err.fileName); globalErrors.forEach(outputErrorText); // 'merge' the lines of each input file with any errors associated with it inputFiles.filter(f => f.content !== undefined).forEach(inputFile => { // Filter down to the errors in the file var fileErrors = diagnostics.filter(e => { - var errFn = e.filename; + var errFn = e.fileName; return errFn && errFn === inputFile.unitName; }); @@ -1295,12 +1301,12 @@ module Harness { }); var numLibraryDiagnostics = ts.countWhere(diagnostics, diagnostic => { - return diagnostic.filename && isLibraryFile(diagnostic.filename); + return diagnostic.fileName && isLibraryFile(diagnostic.fileName); }); var numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => { // Count an error generated from tests262-harness folder.This should only apply for test262 - return diagnostic.filename && diagnostic.filename.indexOf("test262-harness") >= 0; + return diagnostic.fileName && diagnostic.fileName.indexOf("test262-harness") >= 0; }); // Verify we didn't miss any errors in total @@ -1311,7 +1317,7 @@ module Harness { } export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[], clean?: (s: string) => string) { - // Collect, test, and sort the filenames + // Collect, test, and sort the fileNames function cleanName(fn: string) { var lastSlash = ts.normalizeSlashes(fn).lastIndexOf('/'); return fn.substr(lastSlash + 1).toLowerCase(); @@ -1324,7 +1330,7 @@ module Harness { // Some extra spacing if this isn't the first file if (result.length) result = result + '\r\n\r\n'; - // Filename header + content + // FileName header + content result = result + '/*====== ' + outputFile.fileName + ' ======*/\r\n'; if (clean) { result = result + clean(outputFile.code); @@ -1354,7 +1360,7 @@ module Harness { } export interface HarnessDiagnostic { - filename: string; + fileName: string; start: number; end: number; line: number; @@ -1455,7 +1461,7 @@ module Harness { var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines // List of allowed metadata names - var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "includebuiltfile", "suppressimplicitanyindexerrors"]; + var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal"]; function extractCompilerSettings(content: string): CompilerSetting[] { @@ -1469,7 +1475,7 @@ module Harness { return opts; } - /** Given a test file containing // @Filename directives, return an array of named units of code to be added to an existing compiler instance */ + /** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */ export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSetting[]; testUnitData: TestUnitData[]; } { var settings = extractCompilerSettings(code); @@ -1557,26 +1563,37 @@ module Harness { export interface BaselineOptions { LineEndingSensitive?: boolean; Subfolder?: string; + Baselinefolder?: string; } - export function localPath(fileName: string, subfolder?: string) { - return baselinePath(fileName, 'local', subfolder); + export function localPath(fileName: string, baselineFolder?: string, subfolder?: string) { + if (baselineFolder === undefined) { + return baselinePath(fileName, 'local', 'tests/baselines', subfolder); + } + else { + return baselinePath(fileName, 'local', baselineFolder, subfolder); + } } - function referencePath(fileName: string, subfolder?: string) { - return baselinePath(fileName, 'reference', subfolder); + function referencePath(fileName: string, baselineFolder?: string, subfolder?: string) { + if (baselineFolder === undefined) { + return baselinePath(fileName, 'reference', 'tests/baselines', subfolder); + } + else { + return baselinePath(fileName, 'reference', baselineFolder, subfolder); + } } - function baselinePath(fileName: string, type: string, subfolder?: string) { + function baselinePath(fileName: string, type: string, baselineFolder: string, subfolder?: string) { if (subfolder !== undefined) { - return Harness.userSpecifiedroot + 'tests/baselines/' + subfolder + '/' + type + '/' + fileName; + return Harness.userSpecifiedroot + baselineFolder + '/' + subfolder + '/' + type + '/' + fileName; } else { - return Harness.userSpecifiedroot + 'tests/baselines/' + type + '/' + fileName; + return Harness.userSpecifiedroot + baselineFolder + '/' + type + '/' + fileName; } } var fileCache: { [idx: string]: boolean } = {}; - function generateActual(actualFilename: string, generateContent: () => string): string { + function generateActual(actualFileName: string, generateContent: () => string): string { // For now this is written using TypeScript, because sys is not available when running old test cases. // But we need to move to sys once we have // Creates the directory including its parent if not already present @@ -1595,11 +1612,11 @@ module Harness { } // Create folders if needed - createDirectoryStructure(Harness.IO.directoryName(actualFilename)); + createDirectoryStructure(Harness.IO.directoryName(actualFileName)); // Delete the actual file in case it fails - if (IO.fileExists(actualFilename)) { - IO.deleteFile(actualFilename); + if (IO.fileExists(actualFileName)) { + IO.deleteFile(actualFileName); } var actual = generateContent(); @@ -1611,13 +1628,13 @@ module Harness { // Store the content in the 'local' folder so we // can accept it later (manually) if (actual !== null) { - IO.writeFile(actualFilename, actual); + IO.writeFile(actualFileName, actual); } return actual; } - function compareToBaseline(actual: string, relativeFilename: string, opts: BaselineOptions) { + function compareToBaseline(actual: string, relativeFileName: string, opts: BaselineOptions) { // actual is now either undefined (the generator had an error), null (no file requested), // or some real output of the function if (actual === undefined) { @@ -1625,15 +1642,15 @@ module Harness { return; } - var refFilename = referencePath(relativeFilename, opts && opts.Subfolder); + var refFileName = referencePath(relativeFileName, opts && opts.Baselinefolder, opts && opts.Subfolder); if (actual === null) { actual = ''; } var expected = ''; - if (IO.fileExists(refFilename)) { - expected = IO.readFile(refFilename); + if (IO.fileExists(refFileName)) { + expected = IO.readFile(refFileName); } var lineEndingSensitive = opts && opts.LineEndingSensitive; @@ -1646,34 +1663,34 @@ module Harness { return { expected, actual }; } - function writeComparison(expected: string, actual: string, relativeFilename: string, actualFilename: string, descriptionForDescribe: string) { + function writeComparison(expected: string, actual: string, relativeFileName: string, actualFileName: string, descriptionForDescribe: string) { var encoded_actual = (new Buffer(actual)).toString('utf8') if (expected != encoded_actual) { // Overwrite & issue error - var errMsg = 'The baseline file ' + relativeFilename + ' has changed'; + var errMsg = 'The baseline file ' + relativeFileName + ' has changed'; throw new Error(errMsg); } } export function runBaseline( descriptionForDescribe: string, - relativeFilename: string, + relativeFileName: string, generateContent: () => string, runImmediately = false, opts?: BaselineOptions): void { var actual = undefined; - var actualFilename = localPath(relativeFilename, opts && opts.Subfolder); + var actualFileName = localPath(relativeFileName, opts && opts.Baselinefolder, opts && opts.Subfolder); if (runImmediately) { - actual = generateActual(actualFilename, generateContent); - var comparison = compareToBaseline(actual, relativeFilename, opts); - writeComparison(comparison.expected, comparison.actual, relativeFilename, actualFilename, descriptionForDescribe); + actual = generateActual(actualFileName, generateContent); + var comparison = compareToBaseline(actual, relativeFileName, opts); + writeComparison(comparison.expected, comparison.actual, relativeFileName, actualFileName, descriptionForDescribe); } else { - actual = generateActual(actualFilename, generateContent); + actual = generateActual(actualFileName, generateContent); - var comparison = compareToBaseline(actual, relativeFilename, opts); - writeComparison(comparison.expected, comparison.actual, relativeFilename, actualFilename, descriptionForDescribe); + var comparison = compareToBaseline(actual, relativeFileName, opts); + writeComparison(comparison.expected, comparison.actual, relativeFileName, actualFileName, descriptionForDescribe); } } } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 97885bdd20e..547f8ccce48 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -7,7 +7,7 @@ module Harness.LanguageService { public editRanges: { length: number; textChangeRange: ts.TextChangeRange; }[] = []; public lineMap: number[] = null; - constructor(public fileName: string, public content: string, public isOpen = true) { + constructor(public fileName: string, public content: string) { this.setContent(content); } @@ -72,14 +72,6 @@ module Harness.LanguageService { return this.textSnapshot.length; } - public getLineStartPositions(): string { - if (this.lineMap === null) { - this.lineMap = ts.computeLineStarts(this.textSnapshot); - } - - return JSON.stringify(this.lineMap); - } - public getChangeRange(oldScript: ts.ScriptSnapshotShim): string { var oldShim = oldScript; var range = this.scriptInfo.getTextChangeRangeBetweenVersions(oldShim.version, this.version); @@ -109,11 +101,9 @@ module Harness.LanguageService { fileName: string, compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, - version: string, - isOpen: boolean): ts.SourceFile { + version: string): ts.SourceFile { var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), compilationSettings.target); sourceFile.version = version; - sourceFile.isOpen = isOpen; return sourceFile; } @@ -123,10 +113,9 @@ module Harness.LanguageService { compilationSettings: ts.CompilerOptions, scriptSnapshot: ts.IScriptSnapshot, version: string, - isOpen: boolean, textChangeRange: ts.TextChangeRange ): ts.SourceFile { - return ts.updateLanguageServiceSourceFile(document, scriptSnapshot, version, isOpen, textChangeRange); + return ts.updateLanguageServiceSourceFile(document, scriptSnapshot, version, textChangeRange); } public releaseDocument(fileName: string, compilationSettings: ts.CompilerOptions): void { @@ -145,6 +134,10 @@ module Harness.LanguageService { public trace(s: string) { } + public getNewLine(): string { + return "\r\n"; + } + public addDefaultLibrary() { this.addScript(Harness.Compiler.defaultLibFileName, Harness.Compiler.defaultLibSourceFile.text); } @@ -159,13 +152,17 @@ module Harness.LanguageService { } private getScriptInfo(fileName: string): ScriptInfo { - return this.fileNameToScript[fileName]; + return ts.lookUp(this.fileNameToScript, fileName); } public addScript(fileName: string, content: string) { this.fileNameToScript[fileName] = new ScriptInfo(fileName, content); } + private contains(fileName: string): boolean { + return ts.hasProperty(this.fileNameToScript, fileName); + } + public updateScript(fileName: string, content: string) { var script = this.getScriptInfo(fileName); if (script !== null) { @@ -217,26 +214,28 @@ module Harness.LanguageService { return ""; } - public getDefaultLibFilename(): string { + public getDefaultLibFileName(): string { return ""; } public getScriptFileNames(): string { var fileNames: string[] = []; - ts.forEachKey(this.fileNameToScript, (fileName) => { fileNames.push(fileName); }); + ts.forEachKey(this.fileNameToScript,(fileName) => { fileNames.push(fileName); }); return JSON.stringify(fileNames); } public getScriptSnapshot(fileName: string): ts.ScriptSnapshotShim { - return new ScriptSnapshotShim(this.getScriptInfo(fileName)); + if (this.contains(fileName)) { + return new ScriptSnapshotShim(this.getScriptInfo(fileName)); + } + return undefined; } public getScriptVersion(fileName: string): string { - return this.getScriptInfo(fileName).version.toString(); - } - - public getScriptIsOpen(fileName: string): boolean { - return this.getScriptInfo(fileName).isOpen; + if (this.contains(fileName)) { + return this.getScriptInfo(fileName).version.toString(); + } + return undefined; } public getLocalizedDiagnosticMessages(): string { @@ -272,7 +271,6 @@ module Harness.LanguageService { public parseSourceText(fileName: string, sourceText: ts.IScriptSnapshot): ts.SourceFile { var result = ts.createSourceFile(fileName, sourceText.getText(0, sourceText.getLength()), ts.ScriptTarget.Latest); result.version = "1"; - result.isOpen = true; return result; } @@ -292,7 +290,7 @@ module Harness.LanguageService { assert.isTrue(line >= 1); assert.isTrue(col >= 1); - return ts.getPositionFromLineAndCharacter(script.lineMap, line, col); + return ts.computePositionFromLineAndCharacter(script.lineMap, line, col); } /** @@ -303,7 +301,7 @@ module Harness.LanguageService { var script: ScriptInfo = this.fileNameToScript[fileName]; assert.isNotNull(script); - var result = ts.getLineAndCharacterOfPosition(script.lineMap, position); + var result = ts.computeLineAndCharacterOfPosition(script.lineMap, position); assert.isTrue(result.line >= 1); assert.isTrue(result.character >= 1); diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index c6d15c34a84..d9418c0e6ae 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -60,18 +60,18 @@ interface IOLog { } interface PlaybackControl { - startReplayFromFile(logFilename: string): void; + startReplayFromFile(logFileName: string): void; startReplayFromString(logContents: string): void; startReplayFromData(log: IOLog): void; endReplay(): void; - startRecord(logFilename: string): void; + startRecord(logFileName: string): void; endRecord(): void; } module Playback { var recordLog: IOLog = undefined; var replayLog: IOLog = undefined; - var recordLogFilenameBase = ''; + var recordLogFileNameBase = ''; interface Memoized { (s: string): T; @@ -130,15 +130,15 @@ module Playback { replayLog = undefined; }; - wrapper.startRecord = (filenameBase) => { - recordLogFilenameBase = filenameBase; + wrapper.startRecord = (fileNameBase) => { + recordLogFileNameBase = fileNameBase; recordLog = createEmptyLog(); }; } function recordReplay(original: T, underlying: any) { function createWrapper(record: T, replay: T): T { - return (() => { + return (function () { if (replayLog !== undefined) { return replay.apply(undefined, arguments); } else if (recordLog !== undefined) { @@ -176,7 +176,7 @@ module Playback { function findResultByPath(wrapper: { resolvePath(s: string): string }, logArray: { path: string; result?: T }[], expectedPath: string, defaultValue?: T): T { var normalizedName = ts.normalizeSlashes(expectedPath).toLowerCase(); - // Try to find the result through normal filename + // Try to find the result through normal fileName for (var i = 0; i < logArray.length; i++) { if (ts.normalizeSlashes(logArray[i].path).toLowerCase() === normalizedName) { return logArray[i].result; @@ -231,7 +231,7 @@ module Playback { wrapper.endRecord = () => { if (recordLog !== undefined) { var i = 0; - var fn = () => recordLogFilenameBase + i + '.json'; + var fn = () => recordLogFileNameBase + i + '.json'; while (underlying.fileExists(fn())) i++; underlying.writeFile(fn(), JSON.stringify(recordLog)); recordLog = undefined; diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 52467fdffd6..0fde9a9d77c 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -91,8 +91,8 @@ class ProjectRunner extends RunnerBase { // We have these two separate locations because when comparing baselines the baseline verifier will delete the existing file // so even if it was created by compiler in that location, the file will be deleted by verified before we can read it // so lets keep these two locations separate - function getProjectOutputFolder(filename: string, moduleKind: ts.ModuleKind) { - return Harness.Baseline.localPath("projectOutput/" + testCaseJustName + "/" + moduleNameToString(moduleKind) + "/" + filename); + function getProjectOutputFolder(fileName: string, moduleKind: ts.ModuleKind) { + return Harness.Baseline.localPath("projectOutput/" + testCaseJustName + "/" + moduleNameToString(moduleKind) + "/" + fileName); } function cleanProjectUrl(url: string) { @@ -123,28 +123,24 @@ class ProjectRunner extends RunnerBase { } function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: ()=> string[], - getSourceFileText: (filename: string) => string, - writeFile: (filename: string, data: string, writeByteOrderMark: boolean) => void): CompileProjectFilesResult { + getSourceFileText: (fileName: string) => string, + writeFile: (fileName: string, data: string, writeByteOrderMark: boolean) => void): CompileProjectFilesResult { var program = ts.createProgram(getInputFiles(), createCompilerOptions(), createCompilerHost()); - var errors = program.getDiagnostics(); - var sourceMapData: ts.SourceMapData[] = null; - if (!errors.length) { - var checker = program.getTypeChecker(/*produceDiagnostics:*/ true); - errors = checker.getDiagnostics(); - var emitResult = program.emitFiles(); - errors = ts.concatenate(errors, emitResult.diagnostics); - sourceMapData = emitResult.sourceMaps; + var errors = ts.getPreEmitDiagnostics(program); - // Clean up source map data that will be used in baselining - if (sourceMapData) { - for (var i = 0; i < sourceMapData.length; i++) { - for (var j = 0; j < sourceMapData[i].sourceMapSources.length; j++) { - sourceMapData[i].sourceMapSources[j] = cleanProjectUrl(sourceMapData[i].sourceMapSources[j]); - } - sourceMapData[i].jsSourceMappingURL = cleanProjectUrl(sourceMapData[i].jsSourceMappingURL); - sourceMapData[i].sourceMapSourceRoot = cleanProjectUrl(sourceMapData[i].sourceMapSourceRoot); + var emitResult = program.emit(); + errors = ts.concatenate(errors, emitResult.diagnostics); + var sourceMapData = emitResult.sourceMaps; + + // Clean up source map data that will be used in baselining + if (sourceMapData) { + for (var i = 0; i < sourceMapData.length; i++) { + for (var j = 0; j < sourceMapData[i].sourceMapSources.length; j++) { + sourceMapData[i].sourceMapSources[j] = cleanProjectUrl(sourceMapData[i].sourceMapSources[j]); } + sourceMapData[i].jsSourceMappingURL = cleanProjectUrl(sourceMapData[i].jsSourceMappingURL); + sourceMapData[i].sourceMapSourceRoot = cleanProjectUrl(sourceMapData[i].sourceMapSourceRoot); } } @@ -168,15 +164,15 @@ class ProjectRunner extends RunnerBase { }; } - function getSourceFile(filename: string, languageVersion: ts.ScriptTarget): ts.SourceFile { + function getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile { var sourceFile: ts.SourceFile = undefined; - if (filename === Harness.Compiler.defaultLibFileName) { + if (fileName === Harness.Compiler.defaultLibFileName) { sourceFile = languageVersion === ts.ScriptTarget.ES6 ? Harness.Compiler.defaultES6LibSourceFile : Harness.Compiler.defaultLibSourceFile; } else { - var text = getSourceFileText(filename); + var text = getSourceFileText(fileName); if (text !== undefined) { - sourceFile = ts.createSourceFile(filename, text, languageVersion); + sourceFile = ts.createSourceFile(fileName, text, languageVersion); } } @@ -186,7 +182,7 @@ class ProjectRunner extends RunnerBase { function createCompilerHost(): ts.CompilerHost { return { getSourceFile, - getDefaultLibFilename: options => options.target === ts.ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts", + getDefaultLibFileName: options => Harness.Compiler.defaultLibFileName, writeFile, getCurrentDirectory, getCanonicalFileName: Harness.Compiler.getCanonicalFileName, @@ -211,11 +207,11 @@ class ProjectRunner extends RunnerBase { nonSubfolderDiskFiles, }; - function getSourceFileText(filename: string): string { + function getSourceFileText(fileName: string): string { try { - var text = ts.sys.readFile(ts.isRootedDiskPath(filename) - ? filename - : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename)); + var text = ts.sys.readFile(ts.isRootedDiskPath(fileName) + ? fileName + : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(fileName)); } catch (e) { // text doesn't get defined. @@ -223,30 +219,30 @@ class ProjectRunner extends RunnerBase { return text; } - function writeFile(filename: string, data: string, writeByteOrderMark: boolean) { - var diskFileName = ts.isRootedDiskPath(filename) - ? filename - : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename); + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { + var diskFileName = ts.isRootedDiskPath(fileName) + ? fileName + : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(fileName); var diskRelativeName = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, diskFileName, getCurrentDirectory(), Harness.Compiler.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); if (ts.isRootedDiskPath(diskRelativeName) || diskRelativeName.substr(0, 3) === "../") { // If the generated output file resides in the parent folder or is rooted path, // we need to instead create files that can live in the project reference folder - // but make sure extension of these files matches with the filename the compiler asked to write + // but make sure extension of these files matches with the fileName the compiler asked to write diskRelativeName = "diskFile" + nonSubfolderDiskFiles++ + - (Harness.Compiler.isDTS(filename) ? ".d.ts" : - Harness.Compiler.isJS(filename) ? ".js" : ".js.map"); + (Harness.Compiler.isDTS(fileName) ? ".d.ts" : + Harness.Compiler.isJS(fileName) ? ".js" : ".js.map"); } - if (Harness.Compiler.isJS(filename)) { + if (Harness.Compiler.isJS(fileName)) { // Make sure if there is URl we have it cleaned up var indexOfSourceMapUrl = data.lastIndexOf("//# sourceMappingURL="); if (indexOfSourceMapUrl != -1) { data = data.substring(0, indexOfSourceMapUrl + 21) + cleanProjectUrl(data.substring(indexOfSourceMapUrl + 21)); } } - else if (Harness.Compiler.isJSMap(filename)) { + else if (Harness.Compiler.isJSMap(fileName)) { // Make sure sources list is cleaned var sourceMapData = JSON.parse(data); for (var i = 0; i < sourceMapData.sources.length; i++) { @@ -269,26 +265,26 @@ class ProjectRunner extends RunnerBase { ensureDirectoryStructure(ts.getDirectoryPath(ts.normalizePath(outputFilePath))); ts.sys.writeFile(outputFilePath, data, writeByteOrderMark); - outputFiles.push({ emittedFileName: filename, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark }); + outputFiles.push({ emittedFileName: fileName, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark }); } } function compileCompileDTsFiles(compilerResult: BatchCompileProjectTestCaseResult) { var allInputFiles: { emittedFileName: string; code: string; }[] = []; var compilerOptions = compilerResult.program.getCompilerOptions(); - var compilerHost = compilerResult.program.getCompilerHost(); + ts.forEach(compilerResult.program.getSourceFiles(), sourceFile => { - if (Harness.Compiler.isDTS(sourceFile.filename)) { - allInputFiles.unshift({ emittedFileName: sourceFile.filename, code: sourceFile.text }); + if (Harness.Compiler.isDTS(sourceFile.fileName)) { + allInputFiles.unshift({ emittedFileName: sourceFile.fileName, code: sourceFile.text }); } else if (ts.shouldEmitToOwnFile(sourceFile, compilerResult.program.getCompilerOptions())) { if (compilerOptions.outDir) { - var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, compilerHost.getCurrentDirectory()); + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, compilerResult.program.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(compilerResult.program.getCommonSourceDirectory(), ""); var emitOutputFilePathWithoutExtension = ts.removeFileExtension(ts.combinePaths(compilerOptions.outDir, sourceFilePath)); } else { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.filename); + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); } var outputDtsFileName = emitOutputFilePathWithoutExtension + ".d.ts"; @@ -311,19 +307,19 @@ class ProjectRunner extends RunnerBase { function getInputFiles() { return ts.map(allInputFiles, outputFile => outputFile.emittedFileName); } - function getSourceFileText(filename: string): string { - return ts.forEach(allInputFiles, inputFile => inputFile.emittedFileName === filename ? inputFile.code : undefined); + function getSourceFileText(fileName: string): string { + return ts.forEach(allInputFiles, inputFile => inputFile.emittedFileName === fileName ? inputFile.code : undefined); } - function writeFile(filename: string, data: string, writeByteOrderMark: boolean) { + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { } } function getErrorsBaseline(compilerResult: CompileProjectFilesResult) { var inputFiles = ts.map(ts.filter(compilerResult.program.getSourceFiles(), - sourceFile => sourceFile.filename !== "lib.d.ts"), + sourceFile => sourceFile.fileName !== "lib.d.ts"), sourceFile => { - return { unitName: sourceFile.filename, content: sourceFile.text }; + return { unitName: sourceFile.fileName, content: sourceFile.text }; }); var diagnostics = ts.map(compilerResult.errors, error => Harness.Compiler.getMinimalDiagnostic(error)); @@ -348,7 +344,7 @@ class ProjectRunner extends RunnerBase { baselineCheck: testCase.baselineCheck, runTest: testCase.runTest, bug: testCase.bug, - resolvedInputFiles: ts.map(compilerResult.program.getSourceFiles(), inputFile => inputFile.filename), + resolvedInputFiles: ts.map(compilerResult.program.getSourceFiles(), inputFile => inputFile.fileName), emittedFiles: ts.map(compilerResult.outputFiles, outputFile => outputFile.emittedFileName) }; diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts index d22048db996..49ca796448a 100644 --- a/src/harness/runnerbase.ts +++ b/src/harness/runnerbase.ts @@ -22,7 +22,7 @@ class RunnerBase { throw new Error('method not implemented'); } - /** Replaces instances of full paths with filenames only */ + /** Replaces instances of full paths with fileNames only */ static removeFullPaths(path: string) { var fixedPath = path; diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index b506cdd66b6..b66322f8390 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -26,7 +26,10 @@ module RWC { var otherFiles: { unitName: string; content: string; }[] = []; var compilerResult: Harness.Compiler.CompilerResult; var compilerOptions: ts.CompilerOptions; - var baselineOpts: Harness.Baseline.BaselineOptions = { Subfolder: 'rwc' }; + var baselineOpts: Harness.Baseline.BaselineOptions = { + Subfolder: 'rwc', + Baselinefolder: 'internal/baselines' + }; var baseName = /(.*)\/(.*).json/.exec(ts.normalizeSlashes(jsonPath))[2]; var currentDirectory: string; @@ -56,7 +59,7 @@ module RWC { runWithIOLog(ioLog, () => { harnessCompiler.reset(); // Load the files - ts.forEach(opts.filenames, fileName => { + ts.forEach(opts.fileNames, fileName => { inputFiles.push(getHarnessCompilerInputUnit(fileName)); }); @@ -170,7 +173,7 @@ module RWC { } class RWCRunner extends RunnerBase { - private static sourcePath = "tests/cases/rwc/"; + private static sourcePath = "internal/cases/rwc/"; /** Setup the runner's tests so that they are ready to be executed by the harness * The first test should be a describe/it block that sets up the harness's compiler instance appropriately @@ -183,7 +186,7 @@ class RWCRunner extends RunnerBase { } } - private runTest(jsonFilename: string) { - RWC.runRWCTest(jsonFilename); + private runTest(jsonFileName: string) { + RWC.runRWCTest(jsonFileName); } } \ No newline at end of file diff --git a/src/harness/test262Runner.ts b/src/harness/test262Runner.ts index 24be77922f9..0091da5e911 100644 --- a/src/harness/test262Runner.ts +++ b/src/harness/test262Runner.ts @@ -3,7 +3,7 @@ /// class Test262BaselineRunner extends RunnerBase { - private static basePath = 'tests/cases/test262'; + private static basePath = 'internal/cases/test262'; private static helpersFilePath = 'tests/cases/test262-harness/helpers.d.ts'; private static helperFile = { unitName: Test262BaselineRunner.helpersFilePath, @@ -15,7 +15,10 @@ class Test262BaselineRunner extends RunnerBase { target: ts.ScriptTarget.Latest, module: ts.ModuleKind.CommonJS }; - private static baselineOptions: Harness.Baseline.BaselineOptions = { Subfolder: 'test262' }; + private static baselineOptions: Harness.Baseline.BaselineOptions = { + Subfolder: 'test262', + Baselinefolder: 'internal/baselines' + }; private static getTestFilePath(filename: string): string { return Test262BaselineRunner.basePath + "/" + filename; diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 332173d218f..1d8b3efef68 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -12,10 +12,12 @@ class TypeWriterWalker { private checker: ts.TypeChecker; - constructor(private program: ts.Program) { + constructor(private program: ts.Program, fullTypeCheck: boolean) { // Consider getting both the diagnostics checker and the non-diagnostics checker to verify // they are consistent. - this.checker = program.getTypeChecker(/*produceDiagnostics:*/ true); + this.checker = fullTypeCheck + ? program.getDiagnosticsProducingTypeChecker() + : program.getTypeChecker(); } public getTypes(fileName: string): TypeWriterResult[] { diff --git a/src/lib/intl.d.ts b/src/lib/intl.d.ts index 73672bd8dea..dfa6f0990d4 100644 --- a/src/lib/intl.d.ts +++ b/src/lib/intl.d.ts @@ -82,7 +82,7 @@ declare module Intl { second?: string; timeZoneName?: string; formatMatcher?: string; - hour12: boolean; + hour12?: boolean; } interface ResolvedDateTimeFormatOptions { diff --git a/src/services/compiler/diagnostics.ts b/src/services/compiler/diagnostics.ts deleted file mode 100644 index 5114f83f9e5..00000000000 --- a/src/services/compiler/diagnostics.ts +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// - -module TypeScript { - export interface Logger { - log(s: string): void; - } - - export class NullLogger implements Logger { - public log(s: string): void { - } - } -} \ No newline at end of file diff --git a/src/services/compiler/emitter.ts b/src/services/compiler/emitter.ts deleted file mode 100644 index 8de5e64dbba..00000000000 --- a/src/services/compiler/emitter.ts +++ /dev/null @@ -1,3797 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// - -module TypeScript { - export enum EmitContainer { - Prog, - Module, - DynamicModule, - Class, - Constructor, - Function, - Args, - Interface, - } - - export class EmitState { - public column: number; - public line: number; - public container: EmitContainer; - - constructor() { - this.column = 0; - this.line = 0; - this.container = EmitContainer.Prog; - } - } - - export class EmitOptions { - private _diagnostic: Diagnostic = null; - - private _settings: ImmutableCompilationSettings = null; - private _commonDirectoryPath = ""; - private _sharedOutputFile = ""; - private _sourceRootDirectory = ""; - private _sourceMapRootDirectory = ""; - private _outputDirectory = ""; - - public diagnostic(): Diagnostic { return this._diagnostic; } - - public commonDirectoryPath() { return this._commonDirectoryPath; } - public sharedOutputFile() { return this._sharedOutputFile; } - public sourceRootDirectory() { return this._sourceRootDirectory; } - public sourceMapRootDirectory() { return this._sourceMapRootDirectory; } - public outputDirectory() { return this._outputDirectory; } - - public compilationSettings() { return this._settings; } - - constructor(compiler: TypeScriptCompiler, public resolvePath: (path: string) => string) { - var settings = compiler.compilationSettings(); - this._settings = settings; - - // If the document is an external module, then report if the the user has not - // provided the right command line option. - if (settings.moduleGenTarget() === ModuleGenTarget.Unspecified) { - var fileNames = compiler.fileNames(); - for (var i = 0, n = fileNames.length; i < n; i++) { - var document = compiler.getDocument(fileNames[i]); - if (!document.isDeclareFile() && document.syntaxTree().isExternalModule()) { - var errorSpan = externalModuleIndicatorSpan(document.syntaxTree()); - this._diagnostic = new Diagnostic(document.fileName, document.lineMap(), errorSpan.start(), errorSpan.length(), - DiagnosticCode.Cannot_compile_external_modules_unless_the_module_flag_is_provided); - - return; - } - } - } - - if (!settings.mapSourceFiles()) { - // Error to specify --mapRoot or --sourceRoot without mapSourceFiles - if (settings.mapRoot()) { - if (settings.sourceRoot()) { - this._diagnostic = new Diagnostic(null, null, 0, 0, DiagnosticCode.Options_mapRoot_and_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } - else { - this._diagnostic = new Diagnostic(null, null, 0, 0, DiagnosticCode.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } - } - else if (settings.sourceRoot()) { - this._diagnostic = new Diagnostic(null, null, 0, 0, DiagnosticCode.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option, null); - return; - } - } - - this._sourceMapRootDirectory = convertToDirectoryPath(switchToForwardSlashes(settings.mapRoot())); - this._sourceRootDirectory = convertToDirectoryPath(switchToForwardSlashes(settings.sourceRoot())); - - if (settings.outFileOption() || - settings.outDirOption() || - settings.mapRoot() || - settings.sourceRoot()) { - - if (settings.outFileOption()) { - this._sharedOutputFile = switchToForwardSlashes(resolvePath(settings.outFileOption())); - } - - if (settings.outDirOption()) { - this._outputDirectory = convertToDirectoryPath(switchToForwardSlashes(resolvePath(settings.outDirOption()))); - } - - // Parse the directory structure - if (this._outputDirectory || this._sourceMapRootDirectory || this.sourceRootDirectory) { - this.determineCommonDirectoryPath(compiler); - } - } - } - - private determineCommonDirectoryPath(compiler: TypeScriptCompiler): void { - var commonComponents: string[] = []; - var commonComponentsLength = -1; - - var fileNames = compiler.fileNames(); - for (var i = 0, len = fileNames.length; i < len; i++) { - var fileName = fileNames[i]; - var document = compiler.getDocument(fileNames[i]); - var sourceUnit = document.sourceUnit(); - - if (!document.isDeclareFile()) { - var fileComponents = filePathComponents(fileName); - if (commonComponentsLength === -1) { - // First time at finding common path - // So common path = directory of file - commonComponents = fileComponents; - commonComponentsLength = commonComponents.length; - } - else { - var updatedPath = false; - for (var j = 0; j < commonComponentsLength && j < fileComponents.length; j++) { - if (commonComponents[j] !== fileComponents[j]) { - // The new components = 0 ... j -1 - commonComponentsLength = j; - updatedPath = true; - - if (j === 0) { - var isDynamicModuleCompilation = ArrayUtilities.any(fileNames, fileName => { - document = compiler.getDocument(fileName); - return !document.isDeclareFile() && document.syntaxTree().isExternalModule(); - }); - - if (this._outputDirectory || // there is --outDir specified - this._sourceRootDirectory || // there is --sourceRoot specified - (this._sourceMapRootDirectory && // there is --map Specified and there would be multiple js files generated - (!this._sharedOutputFile || isDynamicModuleCompilation))) { - // Its error to not have common path - this._diagnostic = new Diagnostic(null, null, 0, 0, DiagnosticCode.Cannot_find_the_common_subdirectory_path_for_the_input_files, null); - return; - } - - return; - } - - break; - } - } - - // If the fileComponent path completely matched and less than already found update the length - if (!updatedPath && fileComponents.length < commonComponentsLength) { - commonComponentsLength = fileComponents.length; - } - } - } - } - - this._commonDirectoryPath = commonComponents.slice(0, commonComponentsLength).join("/") + "/"; - } - } - - export class Indenter { - static indentStep: number = 4; - static indentStepString: string = " "; - static indentStrings: string[] = []; - public indentAmt: number = 0; - - public increaseIndent() { - this.indentAmt += Indenter.indentStep; - } - - public decreaseIndent() { - this.indentAmt -= Indenter.indentStep; - } - - public getIndent() { - var indentString = Indenter.indentStrings[this.indentAmt]; - if (indentString === undefined) { - indentString = ""; - for (var i = 0; i < this.indentAmt; i = i + Indenter.indentStep) { - indentString += Indenter.indentStepString; - } - Indenter.indentStrings[this.indentAmt] = indentString; - } - return indentString; - } - } - - export function lastParameterIsRest(parameters: ParameterSyntax[]): boolean { - return parameters.length > 0 && (parameters[parameters.length - 1]).dotDotDotToken !== null; - } - - export class Emitter { - public globalThisCapturePrologueEmitted = false; - public extendsPrologueEmitted = false; - public thisClassNode: ClassDeclarationSyntax = null; - public inArrowFunction: boolean = false; - public moduleName = ""; - public emitState = new EmitState(); - public indenter = new Indenter(); - public sourceMapper: SourceMapper = null; - public captureThisStmtString = "var _this = this;"; - private currentVariableDeclaration: VariableDeclarationSyntax; - private declStack: PullDecl[] = []; - private exportAssignment: ExportAssignmentSyntax = null; - private inWithBlock = false; - - public document: Document = null; - - // If we choose to detach comments from an element (for example, the Copyright comments), - // then keep track of that element so that we don't emit all on the comments on it when - // we visit it. - private detachedCommentsElement: ISyntaxElement = null; - - constructor(public emittingFileName: string, - public outfile: TextWriter, - public emitOptions: EmitOptions, - private semanticInfoChain: SemanticInfoChain) { - } - - private pushDecl(decl: PullDecl) { - if (decl) { - this.declStack[this.declStack.length] = decl; - } - } - - private popDecl(decl: PullDecl) { - if (decl) { - this.declStack.length--; - } - } - - private getEnclosingDecl() { - var declStackLen = this.declStack.length; - var enclosingDecl = declStackLen > 0 ? this.declStack[declStackLen - 1] : null; - return enclosingDecl; - } - - public setExportAssignment(exportAssignment: ExportAssignmentSyntax) { - this.exportAssignment = exportAssignment; - } - - public getExportAssignment() { - return this.exportAssignment; - } - - public setDocument(document: Document) { - this.document = document; - } - - public shouldEmitImportDeclaration(importDeclAST: ImportDeclarationSyntax) { - var isExternalModuleReference = importDeclAST.moduleReference.kind() === SyntaxKind.ExternalModuleReference; - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var isExported = hasFlag(importDecl.flags, PullElementFlags.Exported); - var isAmdCodeGen = this.emitOptions.compilationSettings().moduleGenTarget() === ModuleGenTarget.Asynchronous; - - // 1) Any internal reference needs to check if the emit can happen - // 2) External module reference with export modifier always needs to be emitted - // 3) commonjs needs the var declaration for the import declaration - if (isExternalModuleReference && !isExported && isAmdCodeGen) { - return false; - } - - var importSymbol = importDecl.getSymbol(this.semanticInfoChain); - if (importSymbol.isUsedAsValue()) { - return true; - } - - if (importDeclAST.moduleReference.kind() !== SyntaxKind.ExternalModuleReference) { - var canBeUsedExternally = isExported || importSymbol.typeUsedExternally() || importSymbol.isUsedInExportedAlias(); - if (!canBeUsedExternally && !this.document.syntaxTree().isExternalModule()) { - // top level import in non-external module are visible across the whole global module - canBeUsedExternally = hasFlag(importDecl.getParentDecl().kind, PullElementKind.Script | PullElementKind.DynamicModule); - } - - if (canBeUsedExternally) { - if (importSymbol.getExportAssignedValueSymbol()) { - return true; - } - - var containerSymbol = importSymbol.getExportAssignedContainerSymbol(); - if (containerSymbol && containerSymbol.getInstanceSymbol()) { - return true; - } - } - } - - return false; - } - - public emitImportDeclaration(importDeclAST: ImportDeclarationSyntax) { - var isExternalModuleReference = importDeclAST.moduleReference.kind() === SyntaxKind.ExternalModuleReference; - var importDecl = this.semanticInfoChain.getDeclForAST(importDeclAST); - var isExported = hasFlag(importDecl.flags, PullElementFlags.Exported); - var isAmdCodeGen = this.emitOptions.compilationSettings().moduleGenTarget() === ModuleGenTarget.Asynchronous; - - this.emitComments(importDeclAST, true); - - var importSymbol = importDecl.getSymbol(this.semanticInfoChain); - - var parentSymbol = importSymbol.getContainer(); - var parentKind = parentSymbol ? parentSymbol.kind : PullElementKind.None; - var associatedParentSymbol = parentSymbol ? parentSymbol.getAssociatedContainerType() : null; - var associatedParentSymbolKind = associatedParentSymbol ? associatedParentSymbol.kind : PullElementKind.None; - - var needsPropertyAssignment = false; - var usePropertyAssignmentInsteadOfVarDecl = false; - var moduleNamePrefix: string; - - if (isExported && - (parentKind === PullElementKind.Container || - parentKind === PullElementKind.DynamicModule || - associatedParentSymbolKind === PullElementKind.Container || - associatedParentSymbolKind === PullElementKind.DynamicModule)) { - if (importSymbol.getExportAssignedTypeSymbol() || importSymbol.getExportAssignedContainerSymbol()) { - // Type or container assignment that is exported - needsPropertyAssignment = true; - } - else { - var valueSymbol = importSymbol.getExportAssignedValueSymbol(); - if (valueSymbol && - (valueSymbol.kind === PullElementKind.Method || valueSymbol.kind === PullElementKind.Function)) { - needsPropertyAssignment = true; - } - else { - usePropertyAssignmentInsteadOfVarDecl = true; - } - } - - // Calculate what name prefix to use - if (this.emitState.container === EmitContainer.DynamicModule) { - moduleNamePrefix = "exports." - } - else { - moduleNamePrefix = this.moduleName + "."; - } - } - - if (isAmdCodeGen && isExternalModuleReference) { - // For amdCode gen of exported external module reference, do not emit var declaration - // Emit the property assignment since it is exported - needsPropertyAssignment = true; - } - else { - this.recordSourceMappingStart(importDeclAST); - if (usePropertyAssignmentInsteadOfVarDecl) { - this.writeToOutput(moduleNamePrefix); - } - else { - this.writeToOutput("var "); - } - this.writeToOutput(importDeclAST.identifier.text() + " = "); - var aliasAST = importDeclAST.moduleReference; - - if (isExternalModuleReference) { - this.writeToOutput("require(" + (aliasAST).stringLiteral.text() + ")"); - } - else { - this.emitJavascript((aliasAST).moduleName, false); - } - - this.recordSourceMappingEnd(importDeclAST); - this.writeToOutput(";"); - - if (needsPropertyAssignment) { - this.writeLineToOutput(""); - this.emitIndent(); - } - } - - if (needsPropertyAssignment) { - this.writeToOutputWithSourceMapRecord(moduleNamePrefix + importDeclAST.identifier.text() + " = " + importDeclAST.identifier.text(), importDeclAST); - this.writeToOutput(";"); - } - this.emitComments(importDeclAST, false); - } - - public createSourceMapper(document: Document, jsFileName: string, jsFile: TextWriter, sourceMapOut: TextWriter, resolvePath: (path: string) => string) { - this.sourceMapper = new SourceMapper(jsFile, sourceMapOut, document, jsFileName, this.emitOptions, resolvePath); - } - - public setSourceMapperNewSourceFile(document: Document) { - this.sourceMapper.setNewSourceFile(document, this.emitOptions); - } - - private updateLineAndColumn(s: string) { - var lineNumbers = TextUtilities.parseLineStarts(s); - if (lineNumbers.length > 1) { - // There are new lines in the string, update the line and column number accordingly - this.emitState.line += lineNumbers.length - 1; - this.emitState.column = s.length - lineNumbers[lineNumbers.length - 1]; - } - else { - // No new lines in the string - this.emitState.column += s.length; - } - } - - public writeToOutputWithSourceMapRecord(s: string, astSpan: ISyntaxElement) { - if (astSpan) { - this.recordSourceMappingStart(astSpan); - } - - this.writeToOutput(s); - - if (astSpan) { - this.recordSourceMappingEnd(astSpan); - } - } - - public writeToOutput(s: string) { - this.outfile.Write(s); - this.updateLineAndColumn(s); - } - - public writeLineToOutput(s: string, force = false) { - // No need to print a newline if we're already at the start of the line. - if (!force && s === "" && this.emitState.column === 0) { - return; - } - - this.outfile.WriteLine(s); - this.updateLineAndColumn(s); - this.emitState.column = 0; - this.emitState.line++; - } - - public writeCaptureThisStatement(ast: ISyntaxElement) { - this.emitIndent(); - this.writeToOutputWithSourceMapRecord(this.captureThisStmtString, ast); - this.writeLineToOutput(""); - } - - public setContainer(c: number): number { - var temp = this.emitState.container; - this.emitState.container = c; - return temp; - } - - private getIndentString() { - return this.indenter.getIndent(); - } - - public emitIndent() { - this.writeToOutput(this.getIndentString()); - } - - public emitComment(comment: Comment, trailing: boolean, first: boolean, noLeadingSpace = false) { - if (this.emitOptions.compilationSettings().removeComments()) { - return; - } - - var text = getTrimmedTextLines(comment); - var emitColumn = this.emitState.column; - - if (emitColumn === 0) { - this.emitIndent(); - } - else if (trailing && first && !noLeadingSpace) { - this.writeToOutput(" "); - } - - if (comment.kind() === SyntaxKind.MultiLineCommentTrivia) { - this.recordSourceMappingCommentStart(comment); - this.writeToOutput(text[0]); - - if (text.length > 1 || comment.endsLine) { - for (var i = 1; i < text.length; i++) { - this.writeLineToOutput(""); - this.emitIndent(); - this.writeToOutput(text[i]); - } - this.recordSourceMappingCommentEnd(comment); - this.writeLineToOutput(""); - // Fall through - } - else { - this.recordSourceMappingCommentEnd(comment); - this.writeToOutput(" "); - return; - } - } - else { - this.recordSourceMappingCommentStart(comment); - this.writeToOutput(text[0]); - this.recordSourceMappingCommentEnd(comment); - this.writeLineToOutput(""); - // Fall through - } - - if (!trailing && emitColumn !== 0) { - // If we were indented before, stay indented after. - this.emitIndent(); - } - } - - private text(): ISimpleText { - return this.document.syntaxTree().text; - } - - public emitComments(ast: ISyntaxElement, pre: boolean, onlyPinnedOrTripleSlashComments: boolean = false) { - // Emitting the comments for the exprssion inside an arrow function is handled specially - // in emitFunctionBodyStatements. We don't want to emit those comments a second time. - if (ast && !isShared(ast) && ast.kind() !== SyntaxKind.Block) { - if (ast.parent.kind() === SyntaxKind.SimpleArrowFunctionExpression || ast.parent.kind() === SyntaxKind.ParenthesizedArrowFunctionExpression) { - return; - } - } - - if (pre) { - var preComments = TypeScript.ASTHelpers.preComments(ast, this.text()); - - if (preComments && ast === this.detachedCommentsElement) { - // We're emitting the comments for the first script element. Skip any - // copyright comments, as we'll already have emitted those. - var detachedComments = this.getDetachedComments(ast); - preComments = preComments.slice(detachedComments.length); - this.detachedCommentsElement = null; - } - - // We're emitting comments on an elided element. Only keep the comment if it is - // a triple slash or pinned comment. - if (preComments && onlyPinnedOrTripleSlashComments) { - preComments = ArrayUtilities.where(preComments, c => this.isPinnedOrTripleSlash(c)); - } - - this.emitCommentsArray(preComments, /*trailing:*/ false); - } - else { - this.emitCommentsArray(ASTHelpers.postComments(ast, this.text()), /*trailing:*/ true); - } - } - - private isPinnedOrTripleSlash(comment: Comment): boolean { - var fullText = comment.fullText(); - if (fullText.match(tripleSlashReferenceRegExp)) { - return true; - } - else { - return fullText.indexOf("/*!") === 0; - } - } - - private emitCommentsArray(comments: Comment[], trailing: boolean, noLeadingSpace = false): void { - if (!this.emitOptions.compilationSettings().removeComments() && comments) { - for (var i = 0, n = comments.length; i < n; i++) { - this.emitComment(comments[i], trailing, /*first:*/ i === 0, noLeadingSpace); - } - } - } - - public emitObjectLiteralExpression(objectLiteral: ObjectLiteralExpressionSyntax) { - this.recordSourceMappingStart(objectLiteral); - - // Try to preserve the newlines between elements that the user had. - this.writeToken(objectLiteral.openBraceToken); - this.emitCommaSeparatedList(objectLiteral, objectLiteral.propertyAssignments, /*buffer:*/ " ", /*preserveNewLines:*/ true); - this.writeToken(objectLiteral.closeBraceToken); - - this.recordSourceMappingEnd(objectLiteral); - } - - public emitArrayLiteralExpression(arrayLiteral: ArrayLiteralExpressionSyntax) { - this.recordSourceMappingStart(arrayLiteral); - - // Try to preserve the newlines between elements that the user had. - this.writeToken(arrayLiteral.openBracketToken); - this.emitCommaSeparatedList(arrayLiteral, arrayLiteral.expressions, /*buffer:*/ "", /*preserveNewLines:*/ true); - this.writeToken(arrayLiteral.closeBracketToken); - - this.recordSourceMappingEnd(arrayLiteral); - } - - public emitObjectCreationExpression(objectCreationExpression: ObjectCreationExpressionSyntax) { - this.recordSourceMappingStart(objectCreationExpression); - this.writeToken(objectCreationExpression.newKeyword); - this.writeToOutput(" "); - var target = objectCreationExpression.expression; - - this.emit(target); - if (objectCreationExpression.argumentList) { - this.recordSourceMappingStart(objectCreationExpression.argumentList); - this.writeToken(objectCreationExpression.argumentList.openParenToken); - this.emitCommaSeparatedList(objectCreationExpression.argumentList, objectCreationExpression.argumentList.arguments, /*buffer:*/ "", /*preserveNewLines:*/ false); - this.writeToken(objectCreationExpression.argumentList.closeParenToken); - this.recordSourceMappingEnd(objectCreationExpression.argumentList); - } - - this.recordSourceMappingEnd(objectCreationExpression); - } - - public getConstantDecl(dotExpr: MemberAccessExpressionSyntax): PullEnumElementDecl { - var pullSymbol = this.semanticInfoChain.getSymbolForAST(dotExpr); - if (pullSymbol && pullSymbol.kind === PullElementKind.EnumMember) { - var pullDecls = pullSymbol.getDeclarations(); - if (pullDecls.length === 1) { - var pullDecl = pullDecls[0]; - if (pullDecl.kind === PullElementKind.EnumMember) { - return pullDecl; - } - } - } - - return null; - } - - public tryEmitConstant(dotExpr: MemberAccessExpressionSyntax) { - var propertyName = dotExpr.name; - var boundDecl = this.getConstantDecl(dotExpr); - if (boundDecl) { - var value = boundDecl.constantValue; - if (value !== null) { - this.recordSourceMappingStart(dotExpr); - this.writeToOutput(value.toString()); - var comment = " /* "; - comment += propertyName.text(); - comment += " */"; - this.writeToOutput(comment); - this.recordSourceMappingEnd(dotExpr); - return true; - } - } - - return false; - } - - public emitInvocationExpression(callNode: InvocationExpressionSyntax) { - this.recordSourceMappingStart(callNode); - var target = callNode.expression; - var args = callNode.argumentList.arguments; - - if (target.kind() === SyntaxKind.MemberAccessExpression && (target).expression.kind() === SyntaxKind.SuperKeyword) { - this.emit(target); - this.writeToOutput(".call"); - this.recordSourceMappingStart(args); - this.writeToken(callNode.argumentList.openParenToken); - this.emitThis(); - if (args && args.length > 0) { - this.writeToOutput(", "); - this.emitCommaSeparatedList(callNode.argumentList, args, /*buffer:*/ "", /*preserveNewLines:*/ false); - } - } - else { - if (callNode.expression.kind() === SyntaxKind.SuperKeyword && this.emitState.container === EmitContainer.Constructor) { - this.writeToOutput("_super.call"); - } - else { - this.emitJavascript(target, false); - } - this.recordSourceMappingStart(args); - this.writeToken(callNode.argumentList.openParenToken); - if (callNode.expression.kind() === SyntaxKind.SuperKeyword && this.emitState.container === EmitContainer.Constructor) { - this.writeToOutput("this"); - if (args && args.length > 0) { - this.writeToOutput(", "); - } - } - this.emitCommaSeparatedList(callNode.argumentList, args, /*buffer:*/ "", /*preserveNewLines:*/ false); - } - - this.writeToken(callNode.argumentList.closeParenToken); - this.recordSourceMappingEnd(args); - this.recordSourceMappingEnd(callNode); - } - - private emitParameterList(list: ParameterListSyntax): void { - this.writeToken(list.openParenToken); - this.emitCommentsArray(ASTHelpers.convertTokenTrailingComments(list.openParenToken, this.text()), /*trailing:*/ true, /*noLeadingSpace:*/ true); - this.emitFunctionParameters(list.parameters, list.parameters); - this.writeToken(list.closeParenToken); - } - - private emitFunctionParameters(ast: ISyntaxElement, parameters: ParameterSyntax[]): void { - var argsLen = 0; - - if (parameters) { - this.emitComments(ast, true); - - var tempContainer = this.setContainer(EmitContainer.Args); - argsLen = parameters.length; - var printLen = argsLen; - if (lastParameterIsRest(parameters)) { - printLen--; - } - for (var i = 0; i < printLen; i++) { - var arg = parameters[i]; - this.emit(arg); - - if (i < (printLen - 1)) { - this.writeToOutput(", "); - if (parameters) { - this.emitCommentsArray(ASTHelpers.convertTokenTrailingComments(parameters.separatorAt(i), this.text()), /*trailing:*/ true, /*noLeadingSpace:*/ true); - } - } - } - this.setContainer(tempContainer); - - this.emitComments(ast, false); - } - } - - private emitFunctionBodyStatements(name: string, funcDecl: ISyntaxElement, parameters: ParameterSyntax[], block: BlockSyntax, bodyExpression: ISyntaxElement): void { - this.writeLineToOutput(" {"); - if (name) { - this.recordSourceMappingNameStart(name); - } - - this.indenter.increaseIndent(); - - if (block) { - // We want any detached statements at the start of hte block to stay at the start. - // This is important for features like VSDoc which place their comments inside a - // block, but can't have them preceded by things like "var _this = this" when we - // emit. - - this.emitDetachedComments(block.statements); - } - - // Parameter list parameters with defaults could capture this - if (this.shouldCaptureThis(funcDecl)) { - this.writeCaptureThisStatement(funcDecl); - } - - if (parameters) { - this.emitDefaultValueAssignments(parameters); - this.emitRestParameterInitializer(parameters); - } - - if (block) { - this.emitList(block.statements); - this.emitCommentsArray(ASTHelpers.convertTokenLeadingComments(block.closeBraceToken, this.text()), /*trailing:*/ false); - } - else { - // Copy any comments before the body of the arrow function to the return statement. - // This is necessary for emitting correctness so we don't emit something like this: - // - // return - // // foo - // this.foo(); - // - // Because of ASI, this gets parsed as "return;" which is *not* what we want for - // proper semantics. - //var preComments = bodyExpression.preComments(); - //var postComments = bodyExpression.postComments(); - - //bodyExpression.setPreComments(null); - //bodyExpression.setPostComments(null); - - this.emitIndent(); - this.emitCommentsArray(ASTHelpers.preComments(bodyExpression, this.text()), /*trailing:*/ false); - this.writeToOutput("return "); - this.emit(bodyExpression); - this.writeLineToOutput(";"); - this.emitCommentsArray(ASTHelpers.preComments(bodyExpression, this.text()), /*trailing:*/ true); - - //bodyExpression.setPreComments(preComments); - //bodyExpression.setPostComments(postComments); - } - - this.indenter.decreaseIndent(); - this.emitIndent(); - - if (block) { - this.writeToken(block.closeBraceToken); - } - else { - this.writeToOutputWithSourceMapRecord("}", bodyExpression); - } - - if (name) { - this.recordSourceMappingNameEnd(); - } - } - - private emitDefaultValueAssignments(parameters: ParameterSyntax[]): void { - var n = parameters.length; - if (lastParameterIsRest(parameters)) { - n--; - } - - for (var i = 0; i < n; i++) { - var arg = parameters[i]; - var id = arg.identifier; - var equalsValueClause = arg.equalsValueClause; - if (equalsValueClause) { - this.emitIndent(); - this.recordSourceMappingStart(arg); - this.writeToOutput("if (typeof " + id.text() + " === \"undefined\") { ");// - this.writeToken(id); - this.emitJavascript(equalsValueClause, false); - this.writeLineToOutput("; }"); - this.recordSourceMappingEnd(arg); - } - } - } - - private emitRestParameterInitializer(parameters: ParameterSyntax[]): void { - if (lastParameterIsRest(parameters)) { - var n = parameters.length; - var lastArg = parameters[n - 1]; - var id = lastArg.identifier; - this.emitIndent(); - this.recordSourceMappingStart(lastArg); - this.writeToOutput("var "); - this.writeToken(id); - this.writeLineToOutput(" = [];"); - this.recordSourceMappingEnd(lastArg); - this.emitIndent(); - this.writeToOutput("for ("); - this.writeToOutputWithSourceMapRecord("var _i = 0;", lastArg); - this.writeToOutput(" "); - this.writeToOutputWithSourceMapRecord("_i < (arguments.length - " + (n - 1) + ")", lastArg); - this.writeToOutput("; "); - this.writeToOutputWithSourceMapRecord("_i++", lastArg); - this.writeLineToOutput(") {"); - this.indenter.increaseIndent(); - this.emitIndent(); - - this.writeToOutputWithSourceMapRecord(id.text() + "[_i] = arguments[_i + " + (n - 1) + "];", lastArg); - this.writeLineToOutput(""); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeLineToOutput("}"); - } - } - - private getImportDecls(fileName: string): PullDecl[] { - var topLevelDecl = this.semanticInfoChain.topLevelDecl(this.document.fileName); - var result: PullDecl[] = []; - - var dynamicModuleDecl = topLevelDecl.getChildDecls()[0]; // Dynamic module declaration has to be present - var queue: PullDecl[] = dynamicModuleDecl.getChildDecls(); - - for (var i = 0, n = queue.length; i < n; i++) { - var decl = queue[i]; - - if (decl.kind & PullElementKind.TypeAlias) { - var importStatementAST = this.semanticInfoChain.getASTForDecl(decl); - if (importStatementAST.moduleReference.kind() === SyntaxKind.ExternalModuleReference) { // external module - var symbol = decl.getSymbol(this.semanticInfoChain); - var typeSymbol = symbol && symbol.type; - if (typeSymbol && typeSymbol !== this.semanticInfoChain.anyTypeSymbol && !typeSymbol.isError()) { - result.push(decl); - } - } - } - } - - return result; - } - - public getModuleImportAndDependencyList(sourceUnit: SourceUnitSyntax) { - var importList = ""; - var dependencyList = ""; - - var importDecls = this.getImportDecls(this.document.fileName); - - // all dependencies are quoted - if (importDecls.length) { - for (var i = 0; i < importDecls.length; i++) { - var importStatementDecl = importDecls[i]; - var importStatementSymbol = importStatementDecl.getSymbol(this.semanticInfoChain); - var importStatementAST = this.semanticInfoChain.getASTForDecl(importStatementDecl); - - if (importStatementSymbol.isUsedAsValue()) { - if (i <= importDecls.length - 1) { - dependencyList += ", "; - importList += ", "; - } - - importList += importStatementDecl.name; - dependencyList += (importStatementAST.moduleReference).stringLiteral.text(); - } - } - } - - // emit any potential amd dependencies - var amdDependencies = this.document.syntaxTree().amdDependencies(); - for (var i = 0; i < amdDependencies.length; i++) { - dependencyList += ", \"" + amdDependencies[i] + "\""; - } - - return { - importList: importList, - dependencyList: dependencyList - }; - } - - public shouldCaptureThis(ast: ISyntaxElement) { - if (ast.kind() === SyntaxKind.SourceUnit) { - var scriptDecl = this.semanticInfoChain.topLevelDecl(this.document.fileName); - return hasFlag(scriptDecl.flags, PullElementFlags.MustCaptureThis); - } - - var decl = this.semanticInfoChain.getDeclForAST(ast); - if (decl) { - return hasFlag(decl.flags, PullElementFlags.MustCaptureThis); - } - - return false; - } - - public emitEnum(moduleDecl: EnumDeclarationSyntax) { - var pullDecl = this.semanticInfoChain.getDeclForAST(moduleDecl); - this.pushDecl(pullDecl); - - var svModuleName = this.moduleName; - this.moduleName = moduleDecl.identifier.text(); - - var temp = this.setContainer(EmitContainer.Module); - var isExported = hasFlag(pullDecl.flags, PullElementFlags.Exported); - - if (!isExported) { - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("var "); - this.writeToOutputWithSourceMapRecord(this.moduleName, moduleDecl.identifier); - this.writeLineToOutput(";"); - this.recordSourceMappingEnd(moduleDecl); - this.emitIndent(); - } - - this.writeToOutput("("); - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("function ("); - this.writeToOutputWithSourceMapRecord(this.moduleName, moduleDecl.identifier); - this.writeLineToOutput(") {"); - - this.recordSourceMappingNameStart(this.moduleName); - - this.indenter.increaseIndent(); - - if (this.shouldCaptureThis(moduleDecl)) { - this.writeCaptureThisStatement(moduleDecl); - } - - this.emitSeparatedList(moduleDecl.enumElements); - this.indenter.decreaseIndent(); - this.emitIndent(); - - var parentIsDynamic = temp === EmitContainer.DynamicModule; - if (temp === EmitContainer.Prog && isExported) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(this." + this.moduleName + " || (this." + this.moduleName + " = {}));"); - } - else if (isExported || temp === EmitContainer.Prog) { - var dotMod = svModuleName !== "" ? (parentIsDynamic ? "exports" : svModuleName) + "." : svModuleName; - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(" + dotMod + this.moduleName + " || (" + dotMod + this.moduleName + " = {}));"); - } - else if (!isExported && temp !== EmitContainer.Prog) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")(" + this.moduleName + " || (" + this.moduleName + " = {}));"); - } - else { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.writeToOutput(")();"); - } - - this.recordSourceMappingEnd(moduleDecl); - if (temp !== EmitContainer.Prog && isExported) { - this.recordSourceMappingStart(moduleDecl); - if (parentIsDynamic) { - this.writeLineToOutput(""); - this.emitIndent(); - this.writeToOutput("var " + this.moduleName + " = exports." + this.moduleName + ";"); - } - else { - this.writeLineToOutput(""); - this.emitIndent(); - this.writeToOutput("var " + this.moduleName + " = " + svModuleName + "." + this.moduleName + ";"); - } - this.recordSourceMappingEnd(moduleDecl); - } - - this.setContainer(temp); - this.moduleName = svModuleName; - - this.popDecl(pullDecl); - } - - private getModuleDeclToVerifyChildNameCollision(moduleDecl: PullDecl, changeNameIfAnyDeclarationInContext: boolean) { - if (ArrayUtilities.contains(this.declStack, moduleDecl)) { - // Given decl is in the scope, we would need to check for child name collision - return moduleDecl; - } - else if (changeNameIfAnyDeclarationInContext) { - // Check if any other declaration of the given symbol is in scope - // (eg. when emitting expression of type defined from different declaration in reopened module) - var symbol = moduleDecl.getSymbol(this.semanticInfoChain); - if (symbol) { - var otherDecls = symbol.getDeclarations(); - for (var i = 0; i < otherDecls.length; i++) { - // If the other decl is in the scope, use this decl to determine which name to display - if (ArrayUtilities.contains(this.declStack, otherDecls[i])) { - return otherDecls[i]; - } - } - } - } - - return null; - } - - private hasChildNameCollision(moduleName: string, parentDecl: PullDecl) { - var childDecls = parentDecl.getChildDecls(); - return ArrayUtilities.any(childDecls, (childDecl: PullDecl) => { - var childAST = this.semanticInfoChain.getASTForDecl(childDecl); - // Enum member it can never conflict with module name as it is property of the enum - // Only if this child would be emitted we need to look further in - if (childDecl.kind != PullElementKind.EnumMember && this.shouldEmit(childAST)) { - // same name child - if (childDecl.name === moduleName) { - // collision if the parent was not class - if (parentDecl.kind != PullElementKind.Class) { - return true; - } - - // If the parent was class, we would find name collision if this was not a property/method/accessor - if (!(childDecl.kind == PullElementKind.Method || - childDecl.kind == PullElementKind.Property || - childDecl.kind == PullElementKind.SetAccessor || - childDecl.kind == PullElementKind.GetAccessor)) { - return true; - } - } - - // Check if the name collision exists in any of the children - if (this.hasChildNameCollision(moduleName, childDecl)) { - return true; - } - } - return false; - }); - } - - // Get the moduleName to write in js file - // If changeNameIfAnyDeclarationInContext is true, verify if any of the declarations for the symbol would need rename. - private getModuleName(moduleDecl: PullDecl, changeNameIfAnyDeclarationInContext?: boolean) { - var moduleName = moduleDecl.name; - var moduleDisplayName = moduleDecl.getDisplayName(); - - // If the decl is in stack it may need name change in the js file - moduleDecl = this.getModuleDeclToVerifyChildNameCollision(moduleDecl, changeNameIfAnyDeclarationInContext); - if (moduleDecl && moduleDecl.kind != PullElementKind.Enum) { - // If there is any child that would be emitted with same name as module, js files would need to use rename for the module - while (this.hasChildNameCollision(moduleName, moduleDecl)) { - // there was name collision with member which could result in faulty codegen, try rename with prepend of '_' - moduleName = "_" + moduleName; - moduleDisplayName = "_" + moduleDisplayName; - } - } - - return moduleDisplayName; - } - - private emitModuleDeclarationWorker(moduleDecl: ModuleDeclarationSyntax) { - if (moduleDecl.stringLiteral) { - this.emitSingleModuleDeclaration(moduleDecl, moduleDecl.stringLiteral); - } - else { - var moduleNames = ASTHelpers.getModuleNames(moduleDecl.name); - this.emitSingleModuleDeclaration(moduleDecl, moduleNames[0]); - } - } - - private writeToken(token: ISyntaxToken) { - if (token) { - this.writeToOutputWithSourceMapRecord(token.text(), token); - } - } - - public emitSingleModuleDeclaration(moduleDecl: ModuleDeclarationSyntax, moduleName: ISyntaxToken) { - var isLastName = ASTHelpers.isLastNameOfModule(moduleDecl, moduleName); - - if (isLastName) { - // Doc Comments on the ast belong to the innermost module being emitted. - this.emitComments(moduleDecl, true); - } - - var pullDecl = this.semanticInfoChain.getDeclForAST(moduleName); - this.pushDecl(pullDecl); - - var svModuleName = this.moduleName; - - if (moduleDecl.stringLiteral) { - this.moduleName = tokenValueText(moduleDecl.stringLiteral); - if (isTSFile(this.moduleName)) { - this.moduleName = this.moduleName.substring(0, this.moduleName.length - ".ts".length); - } - } - else { - this.moduleName = moduleName.text(); - } - - var temp = this.setContainer(EmitContainer.Module); - var isExported = hasFlag(pullDecl.flags, PullElementFlags.Exported); - - // prologue - - if (!isExported) { - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("var "); - this.writeToOutputWithSourceMapRecord(this.moduleName, moduleName); - this.writeLineToOutput(";"); - this.recordSourceMappingEnd(moduleDecl); - this.emitIndent(); - } - - this.writeToOutput("("); - this.recordSourceMappingStart(moduleDecl); - this.writeToOutput("function ("); - // Use the name that doesnt conflict with its members, - // this.moduleName needs to be updated to make sure that export member declaration is emitted correctly - this.moduleName = this.getModuleName(pullDecl); - this.writeToOutputWithSourceMapRecord(this.moduleName, moduleName); - this.writeLineToOutput(") {"); - - this.recordSourceMappingNameStart(moduleName.text()); - - this.indenter.increaseIndent(); - - if (this.shouldCaptureThis(moduleDecl)) { - this.writeCaptureThisStatement(moduleDecl); - } - - if (moduleName === moduleDecl.stringLiteral) { - this.emitList(moduleDecl.moduleElements); - } - else { - var moduleNames = ASTHelpers.getModuleNames(moduleDecl.name); - var nameIndex = moduleNames.indexOf(moduleName); - - Debug.assert(nameIndex >= 0); - - if (isLastName) { - // If we're on the innermost module, we can emit the module elements. - this.emitList(moduleDecl.moduleElements); - } - else { - // otherwise, just recurse and emit the next module in the A.B.C module name. - this.emitIndent(); - this.emitSingleModuleDeclaration(moduleDecl, moduleNames[nameIndex + 1]); - this.writeLineToOutput(""); - } - } - - this.moduleName = moduleName.text(); - this.indenter.decreaseIndent(); - this.emitIndent(); - - // epilogue - var parentIsDynamic = temp === EmitContainer.DynamicModule; - this.recordSourceMappingStart(moduleDecl.closeBraceToken); - if (temp === EmitContainer.Prog && isExported) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.closeBraceToken); - this.writeToOutput(")(this." + this.moduleName + " || (this." + this.moduleName + " = {}));"); - } - else if (isExported || temp === EmitContainer.Prog) { - var dotMod = svModuleName !== "" ? (parentIsDynamic ? "exports" : svModuleName) + "." : svModuleName; - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.closeBraceToken); - this.writeToOutput(")(" + dotMod + this.moduleName + " || (" + dotMod + this.moduleName + " = {}));"); - } - else if (!isExported && temp !== EmitContainer.Prog) { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.closeBraceToken); - this.writeToOutput(")(" + this.moduleName + " || (" + this.moduleName + " = {}));"); - } - else { - this.writeToOutput("}"); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(moduleDecl.closeBraceToken); - this.writeToOutput(")();"); - } - - this.recordSourceMappingEnd(moduleDecl); - if (temp !== EmitContainer.Prog && isExported) { - this.recordSourceMappingStart(moduleDecl); - if (parentIsDynamic) { - this.writeLineToOutput(""); - this.emitIndent(); - this.writeToOutput("var " + this.moduleName + " = exports." + this.moduleName + ";"); - } - else { - this.writeLineToOutput(""); - this.emitIndent(); - this.writeToOutput("var " + this.moduleName + " = " + svModuleName + "." + this.moduleName + ";"); - } - this.recordSourceMappingEnd(moduleDecl); - } - - this.setContainer(temp); - this.moduleName = svModuleName; - - this.popDecl(pullDecl); - - if (isLastName) { - // Comments on the module ast belong to the innermost module being emitted. - this.emitComments(moduleDecl, false); - } - } - - public emitEnumElement(varDecl: EnumElementSyntax): void { - // [[""] = ] = ""; - var pullDecl = this.semanticInfoChain.getDeclForAST(varDecl); - Debug.assert(pullDecl && pullDecl.kind === PullElementKind.EnumMember); - - this.emitComments(varDecl, true); - this.recordSourceMappingStart(varDecl); - - var representation = (varDecl.propertyName.kind() === SyntaxKind.StringLiteral) - ? varDecl.propertyName.text() - : ('"' + tokenValueText(varDecl.propertyName) + '"'); - - this.writeToOutput(this.moduleName); - this.writeToOutput('['); - this.writeToOutput(this.moduleName); - this.writeToOutput('['); - this.writeToOutput(representation); - this.writeToOutput(']'); - - if (varDecl.equalsValueClause) { - this.emit(varDecl.equalsValueClause); - } - else if (pullDecl.constantValue !== null) { - this.writeToOutput(' = '); - this.writeToOutput(pullDecl.constantValue.toString()); - } - else { - this.writeToOutput(' = null'); - } - - this.writeToOutput('] = '); - this.writeToOutput(representation); - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - this.writeToOutput(';'); - } - - public emitElementAccessExpression(expression: ElementAccessExpressionSyntax) { - this.recordSourceMappingStart(expression); - this.emit(expression.expression); - this.writeToken(expression.openBracketToken); - this.emit(expression.argumentExpression); - this.writeToken(expression.closeBracketToken); - this.recordSourceMappingEnd(expression); - } - - public emitSimpleArrowFunctionExpression(arrowFunction: SimpleArrowFunctionExpressionSyntax): void { - this.emitAnyArrowFunctionExpression(arrowFunction, arrowFunction.block, arrowFunction.expression); - } - - public emitParenthesizedArrowFunctionExpression(arrowFunction: ParenthesizedArrowFunctionExpressionSyntax): void { - this.emitAnyArrowFunctionExpression(arrowFunction, arrowFunction.block, arrowFunction.expression); - } - - private emitAnyArrowFunctionExpression(arrowFunction: ISyntaxElement, block: BlockSyntax, expression: ISyntaxElement): void { - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = true; - - var temp = this.setContainer(EmitContainer.Function); - - this.recordSourceMappingStart(arrowFunction); - - // Start - var pullDecl = this.semanticInfoChain.getDeclForAST(arrowFunction); - this.pushDecl(pullDecl); - - this.emitComments(arrowFunction, true); - - this.recordSourceMappingStart(arrowFunction); - this.writeToOutput("function "); - - var parameters: ParameterSyntax[] = null; - if (arrowFunction.kind() === SyntaxKind.ParenthesizedArrowFunctionExpression) { - var parenthesizedArrowFunction = arrowFunction; - - parameters = parenthesizedArrowFunction.callSignature.parameterList.parameters; - this.emitParameterList(parenthesizedArrowFunction.callSignature.parameterList); - } - else { - var parameter = (arrowFunction).parameter; - parameters = [parameter]; - this.writeToOutput("("); - this.emitFunctionParameters(parameter, parameters); - this.writeToOutput(")"); - } - - this.emitFunctionBodyStatements(/*funcName:*/ null, arrowFunction, parameters, block, expression); - - this.recordSourceMappingEnd(arrowFunction); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(arrowFunction); - - this.emitComments(arrowFunction, false); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - } - - public emitConstructor(funcDecl: ConstructorDeclarationSyntax) { - if (!funcDecl.block) { - return; - } - var temp = this.setContainer(EmitContainer.Constructor); - - this.recordSourceMappingStart(funcDecl); - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.emitComments(funcDecl, true); - - this.recordSourceMappingStart(funcDecl); - this.writeToOutput("function "); - this.writeToOutput(this.thisClassNode.identifier.text()); - - this.emitParameterList(funcDecl.callSignature.parameterList); - this.writeLineToOutput(" {"); - - this.recordSourceMappingNameStart("constructor"); - this.indenter.increaseIndent(); - - var parameters = funcDecl.callSignature.parameterList.parameters; - this.emitDefaultValueAssignments(parameters); - this.emitRestParameterInitializer(parameters); - - if (this.shouldCaptureThis(funcDecl)) { - this.writeCaptureThisStatement(funcDecl); - } - - this.emitConstructorStatements(funcDecl); - this.emitCommentsArray(ASTHelpers.convertTokenLeadingComments(funcDecl.block.closeBraceToken, this.text()), /*trailing:*/ false); - - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToken(funcDecl.block.closeBraceToken); - - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(funcDecl); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.popDecl(pullDecl); - this.setContainer(temp); - } - - public emitGetAccessor(accessor: GetAccessorSyntax): void { - this.recordSourceMappingStart(accessor); - this.writeToOutput("get "); - - var temp = this.setContainer(EmitContainer.Function); - - this.recordSourceMappingStart(accessor); - - var pullDecl = this.semanticInfoChain.getDeclForAST(accessor); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(accessor); - - var accessorSymbol = PullHelpers.getAccessorSymbol(accessor, this.semanticInfoChain); - var container = accessorSymbol.getContainer(); - var containerKind = container.kind; - - this.recordSourceMappingNameStart(accessor.propertyName.text()); - this.writeToOutput(accessor.propertyName.text()); - this.emitParameterList(accessor.callSignature.parameterList); - - this.emitFunctionBodyStatements(null, accessor, accessor.callSignature.parameterList.parameters, accessor.block, /*bodyExpression:*/ null); - - this.recordSourceMappingEnd(accessor); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(accessor); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.recordSourceMappingEnd(accessor); - } - - public emitSetAccessor(accessor: SetAccessorSyntax): void { - this.recordSourceMappingStart(accessor); - this.writeToOutput("set "); - - var temp = this.setContainer(EmitContainer.Function); - - this.recordSourceMappingStart(accessor); - - var pullDecl = this.semanticInfoChain.getDeclForAST(accessor); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(accessor); - - var accessorSymbol = PullHelpers.getAccessorSymbol(accessor, this.semanticInfoChain); - var container = accessorSymbol.getContainer(); - var containerKind = container.kind; - - this.recordSourceMappingNameStart(accessor.propertyName.text()); - this.writeToOutput(accessor.propertyName.text()); - - this.emitParameterList(accessor.callSignature.parameterList); - - this.emitFunctionBodyStatements(null, accessor, accessor.callSignature.parameterList.parameters, accessor.block, /*bodyExpression:*/ null); - - this.recordSourceMappingEnd(accessor); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(accessor); - - this.popDecl(pullDecl); - this.setContainer(temp); - this.recordSourceMappingEnd(accessor); - } - - public emitFunctionExpression(funcDecl: FunctionExpressionSyntax): void { - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = false; - - var temp = this.setContainer(EmitContainer.Function); - - var funcName = funcDecl.identifier ? funcDecl.identifier.text() : null;//.getNameText(); - - this.recordSourceMappingStart(funcDecl); - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcDecl); - this.writeToken(funcDecl.functionKeyword); - this.writeToOutput(" "); - - //var id = funcDecl.getNameText(); - if (funcDecl.identifier) { - this.writeToOutputWithSourceMapRecord(funcDecl.identifier.text(), funcDecl.identifier); - } - - this.emitParameterList(funcDecl.callSignature.parameterList); - this.emitFunctionBodyStatements(funcName, funcDecl, funcDecl.callSignature.parameterList.parameters, funcDecl.block, /*bodyExpression:*/ null); - - this.recordSourceMappingEnd(funcDecl); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.popDecl(pullDecl); - - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - } - - public emitFunction(funcDecl: FunctionDeclarationSyntax) { - if (funcDecl.block === null) { - return; - } - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = false; - - var temp = this.setContainer(EmitContainer.Function); - - var funcName = funcDecl.identifier.text(); - - this.recordSourceMappingStart(funcDecl); - - var printName = funcDecl.identifier !== null - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.emitComments(funcDecl, true); - - this.recordSourceMappingStart(funcDecl); - this.writeToken(funcDecl.functionKeyword); - this.writeToOutput(" "); - - if (printName) { - var id = funcDecl.identifier.text(); - if (id) { - if (funcDecl.identifier) { - this.recordSourceMappingStart(funcDecl.identifier); - } - this.writeToOutput(id); - if (funcDecl.identifier) { - this.recordSourceMappingEnd(funcDecl.identifier); - } - } - } - - this.emitParameterList(funcDecl.callSignature.parameterList); - - var parameters = funcDecl.callSignature.parameterList.parameters; - this.emitFunctionBodyStatements(funcDecl.identifier.text(), funcDecl, parameters, funcDecl.block, /*bodyExpression:*/ null); - - this.recordSourceMappingEnd(funcDecl); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.popDecl(pullDecl); - - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - - if (funcDecl.block) { - var pullFunctionDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - if ((this.emitState.container === EmitContainer.Module || this.emitState.container === EmitContainer.DynamicModule) && pullFunctionDecl && hasFlag(pullFunctionDecl.flags, PullElementFlags.Exported)) { - this.writeLineToOutput(""); - this.emitIndent(); - var modName = this.emitState.container === EmitContainer.Module ? this.moduleName : "exports"; - this.recordSourceMappingStart(funcDecl); - this.writeToOutput(modName + "." + funcName + " = " + funcName + ";"); - this.recordSourceMappingEnd(funcDecl); - } - } - } - - public emitAmbientVarDecl(varDecl: VariableDeclaratorSyntax) { - this.recordSourceMappingStart(this.currentVariableDeclaration); - if (varDecl.equalsValueClause) { - this.emitComments(varDecl, true); - this.recordSourceMappingStart(varDecl); - this.writeToOutputWithSourceMapRecord(varDecl.propertyName.text(), varDecl.propertyName); - this.emitJavascript(varDecl.equalsValueClause, false); - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - } - } - - // Emits "var " if it is allowed - public emitVarDeclVar() { - if (this.currentVariableDeclaration) { - this.writeToOutput("var "); - } - } - - public emitVariableDeclaration(declaration: VariableDeclarationSyntax) { - var varDecl = declaration.variableDeclarators[0]; - - var symbol = this.semanticInfoChain.getSymbolForAST(varDecl); - - var parentSymbol = symbol ? symbol.getContainer() : null; - var parentKind = parentSymbol ? parentSymbol.kind : PullElementKind.None; - - this.emitComments(declaration, true); - - var pullVarDecl = this.semanticInfoChain.getDeclForAST(varDecl); - var isAmbientWithoutInit = pullVarDecl && hasFlag(pullVarDecl.flags, PullElementFlags.Ambient) && varDecl.equalsValueClause === null; - if (!isAmbientWithoutInit) { - var prevVariableDeclaration = this.currentVariableDeclaration; - this.currentVariableDeclaration = declaration; - - for (var i = 0, n = declaration.variableDeclarators.length; i < n; i++) { - var declarator = declaration.variableDeclarators[i]; - - if (i > 0) { - this.writeToOutput(", "); - } - - this.emit(declarator); - } - this.currentVariableDeclaration = prevVariableDeclaration; - - // Declarator emit would take care of emitting start of the variable declaration start - this.recordSourceMappingEnd(declaration); - } - - this.emitComments(declaration, false); - } - - private emitMemberVariableDeclaration(varDecl: MemberVariableDeclarationSyntax) { - Debug.assert(!hasModifier(varDecl.modifiers, PullElementFlags.Static) && varDecl.variableDeclarator.equalsValueClause); - - var pullDecl = this.semanticInfoChain.getDeclForAST(varDecl); - this.pushDecl(pullDecl); - - this.emitComments(varDecl, true); - this.recordSourceMappingStart(varDecl); - - var varDeclName = varDecl.variableDeclarator.propertyName.text(); - var quotedOrNumber = isQuoted(varDeclName) || varDecl.variableDeclarator.propertyName.kind() !== SyntaxKind.IdentifierName; - - var symbol = this.semanticInfoChain.getSymbolForAST(varDecl); - var parentSymbol = symbol ? symbol.getContainer() : null; - var parentDecl = pullDecl && pullDecl.getParentDecl(); - - if (quotedOrNumber) { - this.writeToOutput("this["); - } - else { - this.writeToOutput("this."); - } - - this.writeToOutputWithSourceMapRecord(varDecl.variableDeclarator.propertyName.text(), varDecl.variableDeclarator.propertyName); - - if (quotedOrNumber) { - this.writeToOutput("]"); - } - - if (varDecl.variableDeclarator.equalsValueClause) { - // Ensure we have a fresh var list count when recursing into the variable - // initializer. We don't want our current list of variables to affect how we - // emit nested variable lists. - var prevVariableDeclaration = this.currentVariableDeclaration; - this.emit(varDecl.variableDeclarator.equalsValueClause); - this.currentVariableDeclaration = prevVariableDeclaration; - } - - // class - if (this.emitState.container !== EmitContainer.Args) { - this.writeToOutput(";"); - } - - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - - this.popDecl(pullDecl); - } - - public emitVariableDeclarator(varDecl: VariableDeclaratorSyntax) { - var pullDecl = this.semanticInfoChain.getDeclForAST(varDecl); - this.pushDecl(pullDecl); - if (pullDecl && (pullDecl.flags & PullElementFlags.Ambient) === PullElementFlags.Ambient) { - this.emitAmbientVarDecl(varDecl); - } - else { - this.emitComments(varDecl, true); - this.recordSourceMappingStart(this.currentVariableDeclaration); - this.recordSourceMappingStart(varDecl); - - var varDeclName = varDecl.propertyName.text(); - - var symbol = this.semanticInfoChain.getSymbolForAST(varDecl); - var parentSymbol = symbol ? symbol.getContainer() : null; - var parentDecl = pullDecl && pullDecl.getParentDecl(); - var parentIsModule = parentDecl && (parentDecl.flags & PullElementFlags.SomeInitializedModule); - - if (parentIsModule) { - // module - if (!hasFlag(pullDecl.flags, PullElementFlags.Exported)/* && !varDecl.isProperty() */) { - this.emitVarDeclVar(); - } - else { - if (this.emitState.container === EmitContainer.DynamicModule) { - this.writeToOutput("exports."); - } - else { - this.writeToOutput(this.moduleName + "."); - } - } - } - else { - this.emitVarDeclVar(); - } - - this.writeToOutputWithSourceMapRecord(varDecl.propertyName.text(), varDecl.propertyName); - - if (varDecl.equalsValueClause) { - // Ensure we have a fresh var list count when recursing into the variable - // initializer. We don't want our current list of variables to affect how we - // emit nested variable lists. - var prevVariableDeclaration = this.currentVariableDeclaration; - this.emit(varDecl.equalsValueClause); - this.currentVariableDeclaration = prevVariableDeclaration; - } - - this.recordSourceMappingEnd(varDecl); - this.emitComments(varDecl, false); - } - this.currentVariableDeclaration = undefined; - this.popDecl(pullDecl); - } - - private symbolIsUsedInItsEnclosingContainer(symbol: PullSymbol, dynamic = false) { - var symDecls = symbol.getDeclarations(); - - if (symDecls.length) { - var enclosingDecl = this.getEnclosingDecl(); - if (enclosingDecl) { - var parentDecl = symDecls[0].getParentDecl(); - if (parentDecl) { - var symbolDeclarationEnclosingContainer = parentDecl; - var enclosingContainer = enclosingDecl; - - // compute the closing container of the symbol's declaration - while (symbolDeclarationEnclosingContainer) { - if (symbolDeclarationEnclosingContainer.kind === (dynamic ? PullElementKind.DynamicModule : PullElementKind.Container)) { - break; - } - symbolDeclarationEnclosingContainer = symbolDeclarationEnclosingContainer.getParentDecl(); - } - - // if the symbol in question is not a global, compute the nearest - // enclosing declaration from the point of usage - if (symbolDeclarationEnclosingContainer) { - while (enclosingContainer) { - if (enclosingContainer.kind === (dynamic ? PullElementKind.DynamicModule : PullElementKind.Container)) { - break; - } - - enclosingContainer = enclosingContainer.getParentDecl(); - } - } - - if (symbolDeclarationEnclosingContainer && enclosingContainer) { - var same = symbolDeclarationEnclosingContainer === enclosingContainer; - - // initialized module object variables are bound to their parent's decls - if (!same && symbol.anyDeclHasFlag(PullElementFlags.InitializedModule)) { - same = symbolDeclarationEnclosingContainer === enclosingContainer.getParentDecl(); - } - - return same; - } - } - } - } - - return false; - } - - // In some cases, when emitting a name, the emitter needs to qualify a symbol - // name by first emitting its parent's name. This generally happens when the - // name referenced is in scope in TypeScript, but not in Javascript. This is true - // in any of the following 3 cases: - // - It is an enum member, even if accessed from within the enum declaration in which it is defined - // - It is an exported var, even if accessed from within the module declaration in which it is defined - // - It is an exported member of the current module, but is never defined in this particular module - // declaration (i.e. it is only defined in other components of the same merged module) - private shouldQualifySymbolNameWithParentName(symbol: PullSymbol): boolean { - var enclosingContextDeclPath = this.declStack; - var symbolDeclarations = symbol.getDeclarations(); - for (var i = 0; i < symbolDeclarations.length; i++) { - var currentDecl = symbolDeclarations[i]; - var declParent = currentDecl.getParentDecl(); - - if (currentDecl.kind === PullElementKind.EnumMember) { - return true; - } - - // All decls of the same symbol must agree on whether they are exported - // If one decl is not exported, none of them are, and it is safe to - // assume it is just a local - if (!hasFlag(currentDecl.flags, PullElementFlags.Exported)) { - return false; - } - - // Section 10.6: - // When a variable is exported, all references to the variable in the body of the - // module are replaced with - // .< VariableName> - if (currentDecl.kind === PullElementKind.Variable && !hasFlag(currentDecl.flags, PullElementFlags.ImplicitVariable)) { - return true; - } - - if (ArrayUtilities.contains(this.declStack, declParent)) { - return false; - } - } - - return true; - } - - // Get the symbol information to be used for emitting the ast - private getSymbolForEmit(ast: ISyntaxElement) { - var pullSymbol = this.semanticInfoChain.getSymbolForAST(ast); - var pullSymbolAlias = this.semanticInfoChain.getAliasSymbolForAST(ast); - if (pullSymbol && pullSymbolAlias) { - var symbolToCompare = isTypesOnlyLocation(ast) ? - pullSymbolAlias.getExportAssignedTypeSymbol() : - pullSymbolAlias.getExportAssignedValueSymbol(); - - if (pullSymbol === symbolToCompare) { - pullSymbol = pullSymbolAlias; - pullSymbolAlias = null; - } - } - return { symbol: pullSymbol, aliasSymbol: pullSymbolAlias }; - } - - public emitName(name: ISyntaxToken, addThis: boolean) { - this.emitComments(name, true); - this.recordSourceMappingStart(name); - if (name.text().length > 0) { - var symbolForEmit = this.getSymbolForEmit(name); - var pullSymbol = symbolForEmit.symbol; - if (!pullSymbol) { - pullSymbol = this.semanticInfoChain.anyTypeSymbol; - } - var pullSymbolAlias = symbolForEmit.aliasSymbol; - var pullSymbolKind = pullSymbol.kind; - var isLocalAlias = pullSymbolAlias && (pullSymbolAlias.getDeclarations()[0].getParentDecl() === this.getEnclosingDecl()); - if (addThis && (this.emitState.container !== EmitContainer.Args) && pullSymbol) { - var pullSymbolContainer = pullSymbol.getContainer(); - - if (pullSymbolContainer) { - var pullSymbolContainerKind = pullSymbolContainer.kind; - - if (PullHelpers.symbolIsModule(pullSymbolContainer) || pullSymbolContainerKind === PullElementKind.Enum || - pullSymbolContainer.anyDeclHasFlag(PullElementFlags.InitializedModule | PullElementFlags.Enum)) { - var needToEmitParentName = this.shouldQualifySymbolNameWithParentName(pullSymbol); - if (needToEmitParentName) { - var parentDecl = pullSymbol.getDeclarations()[0].getParentDecl(); - Debug.assert(parentDecl && !parentDecl.isRootDecl()); - this.writeToOutput(this.getModuleName(parentDecl, /* changeNameIfAnyDeclarationInContext */ true) + "."); - } - } - else if (pullSymbolContainerKind === PullElementKind.DynamicModule || - pullSymbolContainer.anyDeclHasFlag(PullElementFlags.InitializedDynamicModule)) { - if (pullSymbolKind === PullElementKind.Property) { - // If dynamic module - this.writeToOutput("exports."); - } - else if (pullSymbol.anyDeclHasFlag(PullElementFlags.Exported) && - !isLocalAlias && - !pullSymbol.anyDeclHasFlag(PullElementFlags.ImplicitVariable) && - pullSymbol.kind !== PullElementKind.ConstructorMethod && - pullSymbol.kind !== PullElementKind.Class && - pullSymbol.kind !== PullElementKind.Enum) { - this.writeToOutput("exports."); - } - } - } - } - - this.writeToOutput(name.text()); - } - - this.recordSourceMappingEnd(name); - this.emitComments(name, false); - } - - public recordSourceMappingNameStart(name: string) { - if (this.sourceMapper) { - var nameIndex = -1; - if (name) { - if (this.sourceMapper.currentNameIndex.length > 0) { - var parentNameIndex = this.sourceMapper.currentNameIndex[this.sourceMapper.currentNameIndex.length - 1]; - if (parentNameIndex !== -1) { - name = this.sourceMapper.names[parentNameIndex] + "." + name; - } - } - - // Look if there already exists name - var nameIndex = this.sourceMapper.names.length - 1; - for (nameIndex; nameIndex >= 0; nameIndex--) { - if (this.sourceMapper.names[nameIndex] === name) { - break; - } - } - - if (nameIndex === -1) { - nameIndex = this.sourceMapper.names.length; - this.sourceMapper.names.push(name); - } - } - this.sourceMapper.currentNameIndex.push(nameIndex); - } - } - - public recordSourceMappingNameEnd() { - if (this.sourceMapper) { - this.sourceMapper.currentNameIndex.pop(); - } - } - - private recordSourceMappingStart(ast: ISyntaxElement) { - if (this.sourceMapper && ASTHelpers.isValidAstNode(ast)) { - var text = this.text(); - this.recordSourceMappingSpanStart(ast, start(ast, text), end(ast, text)); - } - } - - private recordSourceMappingCommentStart(comment: Comment) { - this.recordSourceMappingSpanStart(comment, comment.start(), comment.end()); - } - - private recordSourceMappingSpanStart(ast: any, start: number, end: number) { - if (this.sourceMapper && ast && start !== -1 && end !== -1) { - var lineCol = { line: -1, character: -1 }; - var sourceMapping = new SourceMapping(); - sourceMapping.start.emittedColumn = this.emitState.column; - sourceMapping.start.emittedLine = this.emitState.line; - // REVIEW: check time consumed by this binary search (about two per leaf statement) - var lineMap = this.document.lineMap(); - lineMap.fillLineAndCharacterFromPosition(start, lineCol); - sourceMapping.start.sourceColumn = lineCol.character; - sourceMapping.start.sourceLine = lineCol.line + 1; - lineMap.fillLineAndCharacterFromPosition(end, lineCol); - sourceMapping.end.sourceColumn = lineCol.character; - sourceMapping.end.sourceLine = lineCol.line + 1; - - Debug.assert(!isNaN(sourceMapping.start.emittedColumn)); - Debug.assert(!isNaN(sourceMapping.start.emittedLine)); - Debug.assert(!isNaN(sourceMapping.start.sourceColumn)); - Debug.assert(!isNaN(sourceMapping.start.sourceLine)); - Debug.assert(!isNaN(sourceMapping.end.sourceColumn)); - Debug.assert(!isNaN(sourceMapping.end.sourceLine)); - - if (this.sourceMapper.currentNameIndex.length > 0) { - sourceMapping.nameIndex = this.sourceMapper.currentNameIndex[this.sourceMapper.currentNameIndex.length - 1]; - } - // Set parent and child relationship - var siblings = this.sourceMapper.currentMappings[this.sourceMapper.currentMappings.length - 1]; - siblings.push(sourceMapping); - this.sourceMapper.currentMappings.push(sourceMapping.childMappings); - this.sourceMapper.increaseMappingLevel(ast); - } - } - - private recordSourceMappingEnd(ast: ISyntaxElement) { - if (this.sourceMapper && ASTHelpers.isValidAstNode(ast)) { - var text = this.text(); - this.recordSourceMappingSpanEnd(ast, start(ast, text), end(ast, text)); - } - } - - private recordSourceMappingCommentEnd(ast: Comment) { - if (this.sourceMapper && ASTHelpers.isValidSpan(ast)) { - this.recordSourceMappingSpanEnd(ast, ast.start(), ast.end()); - } - } - - private recordSourceMappingSpanEnd(ast: any, start: number, end: number) { - if (this.sourceMapper && ast && start !== -1 && end !== -1) { - // Pop source mapping childs - this.sourceMapper.currentMappings.pop(); - - // Get the last source mapping from sibling list = which is the one we are recording end for - var siblings = this.sourceMapper.currentMappings[this.sourceMapper.currentMappings.length - 1]; - var sourceMapping = siblings[siblings.length - 1]; - - sourceMapping.end.emittedColumn = this.emitState.column; - sourceMapping.end.emittedLine = this.emitState.line; - - Debug.assert(!isNaN(sourceMapping.end.emittedColumn)); - Debug.assert(!isNaN(sourceMapping.end.emittedLine)); - - this.sourceMapper.decreaseMappingLevel(ast); - } - } - - // Note: may throw exception. - public getOutputFiles(): OutputFile[] { - // Output a source mapping. As long as we haven't gotten any errors yet. - var result: OutputFile[] = []; - if (this.sourceMapper !== null) { - this.sourceMapper.emitSourceMapping(); - result.push(this.sourceMapper.getOutputFile()); - } - - result.push(this.outfile.getOutputFile()); - return result; - } - - private emitParameterPropertyAndMemberVariableAssignments(): void { - // emit any parameter properties first - var constructorDecl = getLastConstructor(this.thisClassNode); - - if (constructorDecl) { - for (var i = 0, n = constructorDecl.callSignature.parameterList.parameters.length; i < n; i++) { - var parameter = constructorDecl.callSignature.parameterList.parameters[i]; - - var parameterDecl = this.semanticInfoChain.getDeclForAST(parameter); - if (hasFlag(parameterDecl.flags, PullElementFlags.PropertyParameter)) { - this.emitIndent(); - this.recordSourceMappingStart(parameter); - this.writeToOutputWithSourceMapRecord("this." + parameter.identifier.text(), parameter.identifier); - this.writeToOutput(" = "); - this.writeToOutputWithSourceMapRecord(parameter.identifier.text(), parameter.identifier); - this.writeLineToOutput(";"); - this.recordSourceMappingEnd(parameter); - } - } - } - - for (var i = 0, n = this.thisClassNode.classElements.length; i < n; i++) { - if (this.thisClassNode.classElements[i].kind() === SyntaxKind.MemberVariableDeclaration) { - var varDecl = this.thisClassNode.classElements[i]; - if (!hasModifier(varDecl.modifiers, PullElementFlags.Static) && varDecl.variableDeclarator.equalsValueClause) { - this.emitIndent(); - this.emitMemberVariableDeclaration(varDecl); - this.writeLineToOutput(""); - } - } - } - } - - private isOnSameLine(pos1: number, pos2: number): boolean { - if (pos1 < 0 || pos2 < 0) { - // Missing element. Assume it's on the same line as the other element. - return true; - } - - var lineMap = this.document.lineMap(); - return lineMap.getLineNumberFromPosition(pos1) === lineMap.getLineNumberFromPosition(pos2); - } - - private emitCommaSeparatedList(parent: ISyntaxElement, list: T[], buffer: string, preserveNewLines: boolean): void { - if (list === null || list.length === 0) { - return; - } - - // If the first element isn't on hte same line as the parent node, then we need to - // start with a newline. - var text = this.text(); - var startLine = preserveNewLines && !this.isOnSameLine(end(parent, text), end(list[0], text)); - - if (preserveNewLines) { - // Any elements on a new line will have to be indented. - this.indenter.increaseIndent(); - } - - // If we're starting on a newline, then emit an actual newline. Otherwise write out - // the buffer character before hte first element. - if (startLine) { - this.writeLineToOutput(""); - } - else { - this.writeToOutput(buffer); - } - - for (var i = 0, n = list.length; i < n; i++) { - var emitNode = list[i]; - - // Write out the element, emitting an indent if we're on a new line. - this.emitJavascript(emitNode, startLine); - - if (i < (n - 1)) { - // If the next element start on a different line than this element ended on, - // then we want to start on a newline. Emit the comma with a newline. - // Otherwise, emit the comma with the space. - startLine = preserveNewLines && !this.isOnSameLine(end(emitNode, text), start(list[i + 1], text)); - if (startLine) { - this.writeLineToOutput(","); - } - else { - this.writeToOutput(", "); - } - } - } - - if (preserveNewLines) { - // We're done with all the elements. Return the indent back to where it was. - this.indenter.decreaseIndent(); - } - - // If the last element isn't on the same line as the parent, then emit a newline - // after the last element and emit our indent so the list's terminator will be - // on the right line. Otherwise, emit the buffer string between the last value - // and the terminator. - if (preserveNewLines && !this.isOnSameLine(end(parent, text), end(list[list.length - 1], text))) { - this.writeLineToOutput(""); - this.emitIndent(); - } - else { - this.writeToOutput(buffer); - } - } - - public emitList(list: T[], useNewLineSeparator = true, startInclusive = 0, endExclusive = list.length) { - if (list === null) { - return; - } - - this.emitComments(list, true); - var lastEmittedNode: ISyntaxElement = null; - - for (var i = startInclusive; i < endExclusive; i++) { - var node = list[i]; - - if (this.shouldEmit(node)) { - this.emitSpaceBetweenConstructs(lastEmittedNode, node); - - this.emitJavascript(node, true); - if (useNewLineSeparator) { - this.writeLineToOutput(""); - } - - lastEmittedNode = node; - } - } - - this.emitComments(list, false); - } - - public emitSeparatedList(list: T[], useNewLineSeparator = true, startInclusive = 0, endExclusive = list.length) { - if (list === null) { - return; - } - - this.emitComments(list, true); - var lastEmittedNode: ISyntaxElement = null; - - for (var i = startInclusive; i < endExclusive; i++) { - var node = list[i]; - - if (this.shouldEmit(node)) { - this.emitSpaceBetweenConstructs(lastEmittedNode, node); - - this.emitJavascript(node, true); - if (useNewLineSeparator) { - this.writeLineToOutput(""); - } - - lastEmittedNode = node; - } - } - - this.emitComments(list, false); - } - - private isDirectivePrologueElement(node: ISyntaxElement) { - if (node.kind() === SyntaxKind.ExpressionStatement) { - var exprStatement = node; - return exprStatement.expression.kind() === SyntaxKind.StringLiteral; - } - - return false; - } - - // If these two constructs had more than one line between them originally, then emit at - // least one blank line between them. - public emitSpaceBetweenConstructs(node1: ISyntaxElement, node2: ISyntaxElement): void { - if (node1 === null || node2 === null) { - return; - } - - var text = this.text(); - if (start(node1, text) === -1 || end(node1, text) === -1 || start(node2, text) === -1 || end(node2, text) === -1) { - return; - } - - var lineMap = this.document.lineMap(); - var node1EndLine = lineMap.getLineNumberFromPosition(end(node1, text)); - var node2StartLine = lineMap.getLineNumberFromPosition(start(node2, text)); - - if ((node2StartLine - node1EndLine) > 1) { - this.writeLineToOutput("", /*force:*/ true); - } - } - - // We consider a sequence of comments to be a detached from an ast if there are no blank lines - // between them, and there is a blank line after the last one and the node they're attached - // to. - private getDetachedComments(element: ISyntaxElement): Comment[] { - var text = this.text(); - var preComments = TypeScript.ASTHelpers.preComments(element, text); - if (preComments) { - var lineMap = this.document.lineMap(); - - var detachedComments: Comment[] = []; - var lastComment: Comment = null; - - for (var i = 0, n = preComments.length; i < n; i++) { - var comment = preComments[i]; - - if (lastComment) { - var lastCommentLine = lineMap.getLineNumberFromPosition(lastComment.end()); - var commentLine = lineMap.getLineNumberFromPosition(comment.start()); - - if (commentLine >= lastCommentLine + 2) { - // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so - // far. - return detachedComments; - } - } - - detachedComments.push(comment); - lastComment = comment; - } - - // All comments look like they could have been part of the copyright header. Make - // sure there is at least one blank line between it and the node. If not, it's not - // a copyright header. - var lastCommentLine = lineMap.getLineNumberFromPosition(ArrayUtilities.last(detachedComments).end()); - var astLine = lineMap.getLineNumberFromPosition(start(element, text)); - if (astLine >= lastCommentLine + 2) { - return detachedComments; - } - } - - // No usable copyright comments found. - return []; - } - - private emitPossibleCopyrightHeaders(script: SourceUnitSyntax): void { - this.emitDetachedComments(script.moduleElements); - } - - private emitDetachedComments(list: ISyntaxNodeOrToken[]): void { - if (list.length > 0) { - var firstElement = childAt(list, 0); - - this.detachedCommentsElement = firstElement; - this.emitCommentsArray(this.getDetachedComments(this.detachedCommentsElement), /*trailing:*/ false); - } - } - - public emitScriptElements(sourceUnit: SourceUnitSyntax) { - var list = sourceUnit.moduleElements; - - this.emitPossibleCopyrightHeaders(sourceUnit); - - // First, emit all the prologue elements. - for (var i = 0, n = list.length; i < n; i++) { - var node = list[i]; - - if (!this.isDirectivePrologueElement(node)) { - break; - } - - this.emitJavascript(node, true); - this.writeLineToOutput(""); - } - - // Now emit __extends or a _this capture if necessary. - this.emitPrologue(sourceUnit); - - var isExternalModule = this.document.syntaxTree().isExternalModule(); - var isNonElidedExternalModule = isExternalModule && !ASTHelpers.scriptIsElided(sourceUnit); - if (isNonElidedExternalModule) { - this.recordSourceMappingStart(sourceUnit); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === ModuleGenTarget.Asynchronous) { // AMD - var dependencyList = "[\"require\", \"exports\""; - var importList = "require, exports"; - - var importAndDependencyList = this.getModuleImportAndDependencyList(sourceUnit); - importList += importAndDependencyList.importList; - dependencyList += importAndDependencyList.dependencyList + "]"; - - this.writeLineToOutput("define(" + dependencyList + "," + " function(" + importList + ") {"); - } - } - - if (isExternalModule) { - var temp = this.setContainer(EmitContainer.DynamicModule); - - var svModuleName = this.moduleName; - this.moduleName = syntaxTree(sourceUnit).fileName(); - if (TypeScript.isTSFile(this.moduleName)) { - this.moduleName = this.moduleName.substring(0, this.moduleName.length - ".ts".length); - } - - // if the external module has an "export =" identifier, we'll - // set it in the ExportAssignment emit method - this.setExportAssignment(null); - - if(this.emitOptions.compilationSettings().moduleGenTarget() === ModuleGenTarget.Asynchronous) { - this.indenter.increaseIndent(); - } - - var externalModule = this.semanticInfoChain.getDeclForAST(this.document.sourceUnit()); - - if (hasFlag(externalModule.flags, PullElementFlags.MustCaptureThis)) { - this.writeCaptureThisStatement(sourceUnit); - } - - this.pushDecl(externalModule); - } - - this.emitList(list, /*useNewLineSeparator:*/ true, /*startInclusive:*/ i, /*endExclusive:*/ n); - - if (isExternalModule) { - if (this.emitOptions.compilationSettings().moduleGenTarget() === ModuleGenTarget.Asynchronous) { - this.indenter.decreaseIndent(); - } - - if (isNonElidedExternalModule) { - var exportAssignment = this.getExportAssignment(); - var exportAssignmentIdentifierText = exportAssignment ? exportAssignment.identifier.text() : null; - var exportAssignmentValueSymbol = (externalModule.getSymbol(this.semanticInfoChain)).getExportAssignedValueSymbol(); - - if (this.emitOptions.compilationSettings().moduleGenTarget() === ModuleGenTarget.Asynchronous) { // AMD - if (exportAssignmentIdentifierText && exportAssignmentValueSymbol && !(exportAssignmentValueSymbol.kind & PullElementKind.SomeTypeReference)) { - // indent was decreased for AMD above - this.indenter.increaseIndent(); - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("return " + exportAssignmentIdentifierText, exportAssignment); - this.writeLineToOutput(";"); - this.indenter.decreaseIndent(); - } - this.writeToOutput("});"); - } - else if (exportAssignmentIdentifierText && exportAssignmentValueSymbol && !(exportAssignmentValueSymbol.kind & PullElementKind.SomeTypeReference)) { - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("module.exports = " + exportAssignmentIdentifierText, exportAssignment); - this.writeToOutput(";"); - } - - this.recordSourceMappingEnd(sourceUnit); - this.writeLineToOutput(""); - } - - this.setContainer(temp); - this.moduleName = svModuleName; - this.popDecl(externalModule); - } - } - - public emitConstructorStatements(funcDecl: ConstructorDeclarationSyntax) { - var list = funcDecl.block.statements; - - if (list === null) { - return; - } - - this.emitComments(list, true); - - var emitPropertyAssignmentsAfterSuperCall = ASTHelpers.getExtendsHeritageClause(this.thisClassNode.heritageClauses) !== null; - var propertyAssignmentIndex = emitPropertyAssignmentsAfterSuperCall ? 1 : 0; - var lastEmittedNode: ISyntaxElement = null; - - for (var i = 0, n = list.length; i < n; i++) { - // In some circumstances, class property initializers must be emitted immediately after the 'super' constructor - // call which, in these cases, must be the first statement in the constructor body - if (i === propertyAssignmentIndex) { - this.emitParameterPropertyAndMemberVariableAssignments(); - } - - var node = list[i]; - - if (this.shouldEmit(node)) { - this.emitSpaceBetweenConstructs(lastEmittedNode, node); - - this.emitJavascript(node, true); - this.writeLineToOutput(""); - - lastEmittedNode = node; - } - } - - if (i === propertyAssignmentIndex) { - this.emitParameterPropertyAndMemberVariableAssignments(); - } - - this.emitComments(list, false); - } - - // tokenId is the id the preceding token - public emitJavascript(ast: ISyntaxElement, startLine: boolean) { - if (ast === null) { - return; - } - - if (startLine && - this.indenter.indentAmt > 0) { - - this.emitIndent(); - } - - this.emit(ast); - } - - public emitAccessorMemberDeclaration(funcDecl: ISyntaxElement, name: ISyntaxToken, className: string, isProto: boolean) { - if (funcDecl.kind() !== SyntaxKind.GetAccessor) { - var accessorSymbol = PullHelpers.getAccessorSymbol(funcDecl, this.semanticInfoChain); - if (accessorSymbol.getGetter()) { - return; - } - } - - this.emitIndent(); - this.recordSourceMappingStart(funcDecl); - - this.writeToOutput("Object.defineProperty(" + className); - if (isProto) { - this.writeToOutput(".prototype, "); - } - else { - this.writeToOutput(", "); - } - - var functionName = name.text(); - if (isQuoted(functionName)) { - this.writeToOutput(functionName); - } - else { - this.writeToOutput('"' + functionName + '"'); - } - - this.writeLineToOutput(", {"); - - this.indenter.increaseIndent(); - - var accessors = PullHelpers.getGetterAndSetterFunction(funcDecl, this.semanticInfoChain); - if (accessors.getter) { - this.emitIndent(); - this.recordSourceMappingStart(accessors.getter); - this.emitComments(accessors.getter, true); - this.writeToOutput("get: "); - this.emitAccessorBody(accessors.getter, accessors.getter.callSignature.parameterList, accessors.getter.block); - this.writeLineToOutput(","); - } - - if (accessors.setter) { - this.emitIndent(); - this.recordSourceMappingStart(accessors.setter); - this.emitComments(accessors.setter, true); - this.writeToOutput("set: "); - this.emitAccessorBody(accessors.setter, accessors.setter.callSignature.parameterList, accessors.setter.block); - this.writeLineToOutput(","); - } - - this.emitIndent(); - this.writeLineToOutput("enumerable: true,"); - this.emitIndent(); - this.writeLineToOutput("configurable: true"); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeLineToOutput("});"); - this.recordSourceMappingEnd(funcDecl); - } - - private emitAccessorBody(funcDecl: ISyntaxElement, parameterList: ParameterListSyntax, block: BlockSyntax): void { - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcDecl); - this.writeToOutput("function "); - this.emitParameterList(parameterList); - - var parameters = parameterList.parameters; - this.emitFunctionBodyStatements(null, funcDecl, parameters, block, /*bodyExpression:*/ null); - - this.recordSourceMappingEnd(funcDecl); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(funcDecl); - this.popDecl(pullDecl); - } - - public emitClass(classDecl: ClassDeclarationSyntax) { - var pullDecl = this.semanticInfoChain.getDeclForAST(classDecl); - this.pushDecl(pullDecl); - - var svClassNode = this.thisClassNode; - this.thisClassNode = classDecl; - var className = classDecl.identifier.text(); - this.emitComments(classDecl, true); - var temp = this.setContainer(EmitContainer.Class); - - this.recordSourceMappingStart(classDecl); - this.writeToOutput("var " + className); - - var hasBaseClass = ASTHelpers.getExtendsHeritageClause(classDecl.heritageClauses) !== null; - var baseTypeReference: ISyntaxElement = null; - var varDecl: VariableDeclaratorSyntax = null; - - if (hasBaseClass) { - this.writeLineToOutput(" = (function (_super) {"); - } - else { - this.writeLineToOutput(" = (function () {"); - } - - this.recordSourceMappingNameStart(className); - this.indenter.increaseIndent(); - - if (hasBaseClass) { - baseTypeReference = ASTHelpers.getExtendsHeritageClause(classDecl.heritageClauses).typeNames[0]; - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("__extends(" + className + ", _super)", baseTypeReference); - this.writeLineToOutput(";"); - } - - this.emitIndent(); - - var constrDecl = getLastConstructor(classDecl); - - // output constructor - if (constrDecl) { - // declared constructor - this.emit(constrDecl); - this.writeLineToOutput(""); - } - else { - this.recordSourceMappingStart(classDecl); - // default constructor - this.indenter.increaseIndent(); - this.writeLineToOutput("function " + classDecl.identifier.text() + "() {"); - this.recordSourceMappingNameStart("constructor"); - if (hasBaseClass) { - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("_super.apply(this, arguments)", baseTypeReference); - this.writeLineToOutput(";"); - } - - if (this.shouldCaptureThis(classDecl)) { - this.writeCaptureThisStatement(classDecl); - } - - this.emitParameterPropertyAndMemberVariableAssignments(); - - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToken(classDecl.closeBraceToken); - this.writeLineToOutput(""); - - this.recordSourceMappingNameEnd(); - this.recordSourceMappingEnd(classDecl); - } - - this.emitClassMembers(classDecl); - - this.emitIndent(); - this.writeToOutputWithSourceMapRecord("return " + className + ";", classDecl.closeBraceToken); - this.writeLineToOutput(""); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToken(classDecl.closeBraceToken); - this.recordSourceMappingNameEnd(); - this.recordSourceMappingStart(classDecl); - this.writeToOutput(")("); - if (hasBaseClass) { - this.emitJavascript(baseTypeReference, /*startLine:*/ false); - } - this.writeToOutput(");"); - this.recordSourceMappingEnd(classDecl); - - if ((temp === EmitContainer.Module || temp === EmitContainer.DynamicModule) && hasFlag(pullDecl.flags, PullElementFlags.Exported)) { - this.writeLineToOutput(""); - this.emitIndent(); - var modName = temp === EmitContainer.Module ? this.moduleName : "exports"; - this.writeToOutputWithSourceMapRecord(modName + "." + className + " = " + className + ";", classDecl); - } - - this.recordSourceMappingEnd(classDecl); - this.emitComments(classDecl, false); - this.setContainer(temp); - this.thisClassNode = svClassNode; - - this.popDecl(pullDecl); - } - - private emitClassMembers(classDecl: ClassDeclarationSyntax): void { - // First, emit all the functions. - var lastEmittedMember: ISyntaxElement = null; - - for (var i = 0, n = classDecl.classElements.length; i < n; i++) { - var memberDecl = classDecl.classElements[i]; - - if (memberDecl.kind() === SyntaxKind.GetAccessor) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - var getter = memberDecl; - this.emitAccessorMemberDeclaration(getter, getter.propertyName, classDecl.identifier.text(), - !hasModifier(getter.modifiers, PullElementFlags.Static)); - lastEmittedMember = memberDecl; - } - else if (memberDecl.kind() === SyntaxKind.SetAccessor) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - var setter = memberDecl; - this.emitAccessorMemberDeclaration(setter, setter.propertyName, classDecl.identifier.text(), - !hasModifier(setter.modifiers, PullElementFlags.Static)); - lastEmittedMember = memberDecl; - } - else if (memberDecl.kind() === SyntaxKind.MemberFunctionDeclaration) { - - var memberFunction = memberDecl; - - if (memberFunction.block) { - this.emitSpaceBetweenConstructs(lastEmittedMember, memberDecl); - - this.emitClassMemberFunctionDeclaration(classDecl, memberFunction); - lastEmittedMember = memberDecl; - } - } - } - - // Now emit all the statics. - for (var i = 0, n = classDecl.classElements.length; i < n; i++) { - var memberDecl = classDecl.classElements[i]; - - if (memberDecl.kind() === SyntaxKind.MemberVariableDeclaration) { - var varDecl = memberDecl; - - if (hasModifier(varDecl.modifiers, PullElementFlags.Static) && varDecl.variableDeclarator.equalsValueClause) { - this.emitSpaceBetweenConstructs(lastEmittedMember, varDecl); - - this.emitIndent(); - this.recordSourceMappingStart(varDecl); - - this.emitComments(varDecl, true); - var varDeclName = varDecl.variableDeclarator.propertyName.text(); - if (isQuoted(varDeclName) || varDecl.variableDeclarator.propertyName.kind() !== SyntaxKind.IdentifierName) { - this.writeToOutput(classDecl.identifier.text() + "[" + varDeclName + "]"); - } - else { - this.writeToOutput(classDecl.identifier.text() + "." + varDeclName); - } - - this.emit(varDecl.variableDeclarator.equalsValueClause); - - this.recordSourceMappingEnd(varDecl); - this.writeLineToOutput(";"); - - lastEmittedMember = varDecl; - } - } - } - } - - private emitClassMemberFunctionDeclaration(classDecl: ClassDeclarationSyntax, funcDecl: MemberFunctionDeclarationSyntax): void { - this.emitIndent(); - this.recordSourceMappingStart(funcDecl); - this.emitComments(funcDecl, true); - var functionName = funcDecl.propertyName.text(); - - this.writeToOutput(classDecl.identifier.text()); - - if (!hasModifier(funcDecl.modifiers, PullElementFlags.Static)) { - this.writeToOutput(".prototype"); - } - - if (isQuoted(functionName) || funcDecl.propertyName.kind() !== SyntaxKind.IdentifierName) { - this.writeToOutput("[" + functionName + "] = "); - } - else { - this.writeToOutput("." + functionName + " = "); - } - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcDecl); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcDecl); - this.writeToOutput("function "); - - this.emitParameterList(funcDecl.callSignature.parameterList); - - var parameters = funcDecl.callSignature.parameterList.parameters; - this.emitFunctionBodyStatements(funcDecl.propertyName.text(), funcDecl, parameters, funcDecl.block, /*bodyExpression:*/ null); - - this.recordSourceMappingEnd(funcDecl); - - this.emitComments(funcDecl, false); - - this.recordSourceMappingEnd(funcDecl); - this.popDecl(pullDecl); - - this.writeLineToOutput(";"); - } - - private requiresExtendsBlock(moduleElements: IModuleElementSyntax[]): boolean { - for (var i = 0, n = moduleElements.length; i < n; i++) { - var moduleElement = moduleElements[i]; - - if (moduleElement.kind() === SyntaxKind.ModuleDeclaration) { - var moduleAST = moduleElement; - - if (!hasModifier(moduleAST.modifiers, PullElementFlags.Ambient) && this.requiresExtendsBlock(moduleAST.moduleElements)) { - return true; - } - } - else if (moduleElement.kind() === SyntaxKind.ClassDeclaration) { - var classDeclaration = moduleElement; - - if (!hasModifier(classDeclaration.modifiers, PullElementFlags.Ambient) && ASTHelpers.getExtendsHeritageClause(classDeclaration.heritageClauses) !== null) { - return true; - } - } - } - - return false; - } - - public emitPrologue(sourceUnit: SourceUnitSyntax) { - if (!this.extendsPrologueEmitted) { - if (this.requiresExtendsBlock(sourceUnit.moduleElements)) { - this.extendsPrologueEmitted = true; - this.writeLineToOutput("var __extends = this.__extends || function (d, b) {"); - this.writeLineToOutput(" for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];"); - this.writeLineToOutput(" function __() { this.constructor = d; }"); - this.writeLineToOutput(" __.prototype = b.prototype;"); - this.writeLineToOutput(" d.prototype = new __();"); - this.writeLineToOutput("};"); - } - } - - if (!this.globalThisCapturePrologueEmitted) { - if (this.shouldCaptureThis(sourceUnit)) { - this.globalThisCapturePrologueEmitted = true; - this.writeLineToOutput(this.captureThisStmtString); - } - } - } - - public emitThis() { - if (!this.inWithBlock && this.inArrowFunction) { - this.writeToOutput("_this"); - } - else { - this.writeToOutput("this"); - } - } - - public emitBlockOrStatement(node: ISyntaxElement): void { - if (node.kind() === SyntaxKind.Block) { - this.emit(node); - } - else { - this.writeLineToOutput(""); - this.indenter.increaseIndent(); - this.emitJavascript(node, true); - this.indenter.decreaseIndent(); - } - } - - public emitLiteralExpression(expression: ISyntaxToken): void { - switch (expression.kind()) { - case SyntaxKind.NullKeyword: - this.writeToken(expression); - break; - case SyntaxKind.FalseKeyword: - this.writeToken(expression); - break; - case SyntaxKind.TrueKeyword: - this.writeToken(expression); - break; - default: - throw Errors.abstract(); - } - } - - public emitThisExpression(expression: ISyntaxToken): void { - if (!this.inWithBlock && this.inArrowFunction) { - this.writeToOutputWithSourceMapRecord("_this", expression); - } - else { - this.writeToken(expression); - } - } - - public emitSuperExpression(expression: ISyntaxToken): void { - if (PullHelpers.isInStaticMemberContext(expression, this.semanticInfoChain)) { - this.writeToOutputWithSourceMapRecord("_super", expression); - } - else { - this.writeToOutputWithSourceMapRecord("_super.prototype", expression); - } - } - - private hasTrailingComment(token: ISyntaxToken) { - return token.hasTrailingTrivia() && token.trailingTrivia().hasComment(); - } - - public emitParenthesizedExpression(parenthesizedExpression: ParenthesizedExpressionSyntax): void { - var omitParentheses = false; - - if (parenthesizedExpression.expression.kind() === SyntaxKind.CastExpression && !this.hasTrailingComment(parenthesizedExpression.openParenToken)) { - var castedExpression = (parenthesizedExpression.expression).expression; - - // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; - while (castedExpression.kind() == SyntaxKind.CastExpression) { - castedExpression = (castedExpression).expression; - } - - // We have an expression of the form: (SubExpr) - // Emitting this as (SubExpr) is really not desirable. Just emit the subexpr as is. - // We cannot generalize this rule however, as omitting the parentheses could cause change in the semantics of the generated - // code if the casted expression has a lower precedence than the rest of the expression, e.g.: - // (new A).foo should be emitted as (new A).foo and not new A.foo - // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() - // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - // Parenthesis can be safelly removed from: - // Literals - // MemberAccessExpressions - // ElementAccessExpressions - // InvocationExpression, only if they are not part of an object creation (new) expression; e.g.: - // new (A()) removing the parentheses would result in calling A as a constructor, instead of calling the - // result of the function invocation A() as a constructor - switch (castedExpression.kind()) { - case SyntaxKind.ParenthesizedExpression: - case SyntaxKind.IdentifierName: - case SyntaxKind.NullKeyword: - case SyntaxKind.ThisKeyword: - case SyntaxKind.StringLiteral: - case SyntaxKind.NumericLiteral: - case SyntaxKind.RegularExpressionLiteral: - case SyntaxKind.TrueKeyword: - case SyntaxKind.FalseKeyword: - case SyntaxKind.ArrayLiteralExpression: - case SyntaxKind.ObjectLiteralExpression: - case SyntaxKind.MemberAccessExpression: - case SyntaxKind.ElementAccessExpression: - omitParentheses = true; - break; - - case SyntaxKind.InvocationExpression: - if (parenthesizedExpression.parent.kind() !== SyntaxKind.ObjectCreationExpression) { - omitParentheses = true; - } - - break; - } - } - - if (omitParentheses) { - this.emit(parenthesizedExpression.expression); - } - else { - this.recordSourceMappingStart(parenthesizedExpression); - this.writeToken(parenthesizedExpression.openParenToken); - this.emitCommentsArray(ASTHelpers.convertTokenTrailingComments(parenthesizedExpression.openParenToken, this.text()), /*trailing:*/ false); - this.emit(parenthesizedExpression.expression); - this.writeToken(parenthesizedExpression.closeParenToken); - this.recordSourceMappingEnd(parenthesizedExpression); - } - } - - public emitCastExpression(expression: CastExpressionSyntax): void { - this.emit(expression.expression); - } - - public emitPrefixUnaryExpression(expression: PrefixUnaryExpressionSyntax): void { - var nodeType = expression.kind(); - - this.recordSourceMappingStart(expression); - switch (nodeType) { - case SyntaxKind.LogicalNotExpression: - this.writeToken(expression.operatorToken); - this.emit(expression.operand); - break; - case SyntaxKind.BitwiseNotExpression: - this.writeToken(expression.operatorToken); - this.emit(expression.operand); - break; - case SyntaxKind.NegateExpression: - this.writeToken(expression.operatorToken); - if (expression.operand.kind() === SyntaxKind.NegateExpression || expression.operand.kind() === SyntaxKind.PreDecrementExpression) { - this.writeToOutput(" "); - } - this.emit(expression.operand); - break; - case SyntaxKind.PlusExpression: - this.writeToken(expression.operatorToken); - if (expression.operand.kind() === SyntaxKind.PlusExpression || expression.operand.kind() === SyntaxKind.PreIncrementExpression) { - this.writeToOutput(" "); - } - this.emit(expression.operand); - break; - case SyntaxKind.PreIncrementExpression: - this.writeToOutputWithSourceMapRecord("++", expression.operatorToken); - this.emit(expression.operand); - break; - case SyntaxKind.PreDecrementExpression: - this.writeToOutputWithSourceMapRecord("--", expression.operatorToken); - this.emit(expression.operand); - break; - default: - throw Errors.abstract(); - } - - this.recordSourceMappingEnd(expression); - } - - public emitPostfixUnaryExpression(expression: PostfixUnaryExpressionSyntax): void { - var nodeType = expression.kind(); - - this.recordSourceMappingStart(expression); - switch (nodeType) { - case SyntaxKind.PostIncrementExpression: - this.emit(expression.operand); - this.writeToOutputWithSourceMapRecord("++", expression.operatorToken); - break; - case SyntaxKind.PostDecrementExpression: - this.emit(expression.operand); - this.writeToOutputWithSourceMapRecord("--", expression.operatorToken); - break; - default: - throw Errors.abstract(); - } - - this.recordSourceMappingEnd(expression); - } - - public emitTypeOfExpression(expression: TypeOfExpressionSyntax): void { - this.recordSourceMappingStart(expression); - this.writeToken(expression.typeOfKeyword); - this.writeToOutput(" "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - } - - public emitDeleteExpression(expression: DeleteExpressionSyntax): void { - this.recordSourceMappingStart(expression); - this.writeToken(expression.deleteKeyword); - this.writeToOutput(" "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - } - - public emitVoidExpression(expression: VoidExpressionSyntax): void { - this.recordSourceMappingStart(expression); - this.writeToken(expression.voidKeyword); - this.writeToOutput(" "); - this.emit(expression.expression); - this.recordSourceMappingEnd(expression); - } - - private canEmitDottedNameMemberAccessExpression(expression: MemberAccessExpressionSyntax) { - var memberExpressionNodeType = expression.expression.kind(); - - // If the memberAccess is of Name or another member access, we could potentially emit the symbol using the this memberAccessSymol - if (memberExpressionNodeType === SyntaxKind.IdentifierName || memberExpressionNodeType == SyntaxKind.MemberAccessExpression) { - var memberAccessSymbol = this.getSymbolForEmit(expression).symbol; - var memberAccessExpressionSymbol = this.getSymbolForEmit(expression.expression).symbol; - if (memberAccessSymbol && memberAccessExpressionSymbol // We have symbols resolved for this expression and access - && !this.semanticInfoChain.getAliasSymbolForAST(expression.expression) // The access is not off alias - && (PullHelpers.symbolIsModule(memberAccessExpressionSymbol) || memberAccessExpressionSymbol.kind === PullElementKind.Enum || - memberAccessExpressionSymbol.anyDeclHasFlag(PullElementFlags.InitializedModule | PullElementFlags.Enum))) { // container is module - - // If the memberAccess is in the context of the container, we could use the symbol to emit this expression - var memberAccessSymbolKind = memberAccessSymbol.kind; - if (memberAccessSymbolKind === PullElementKind.Property - || memberAccessSymbolKind === PullElementKind.EnumMember - || (memberAccessSymbol.anyDeclHasFlag(PullElementFlags.Exported) && memberAccessSymbolKind === PullElementKind.Variable && !memberAccessSymbol.anyDeclHasFlag(PullElementFlags.InitializedModule | PullElementFlags.Enum)) - || ((memberAccessSymbol.anyDeclHasFlag(PullElementFlags.Exported) && !this.symbolIsUsedInItsEnclosingContainer(memberAccessSymbol)))) { - - // If the expression is member access, we need to verify it as well - if (memberExpressionNodeType === SyntaxKind.MemberAccessExpression) { - return this.canEmitDottedNameMemberAccessExpression(expression.expression); - } - - return true; - } - } - } - - return false; - } - - // Emit the member access expression using the declPath - private emitDottedNameMemberAccessExpression(expression: MemberAccessExpressionSyntax) { - this.recordSourceMappingStart(expression); - if (expression.expression.kind() === SyntaxKind.MemberAccessExpression) { - // Emit the dotted name access expression - this.emitDottedNameMemberAccessExpressionRecurse(expression.expression); - } - else { // Name - this.emitName(expression.expression, /*addThis*/ true); - } - - this.writeToken(expression.dotToken); - this.emitName(expression.name, /*addThis*/ false); - - this.recordSourceMappingEnd(expression); - } - - // Set the right indices for the recursive member access expression before emitting it using the decl path - private emitDottedNameMemberAccessExpressionRecurse(expression: MemberAccessExpressionSyntax) { - this.emitComments(expression, true); - this.emitDottedNameMemberAccessExpression(expression); - this.emitComments(expression, false); - } - - public emitMemberAccessExpression(expression: MemberAccessExpressionSyntax): void { - if (!this.tryEmitConstant(expression)) { - // If the expression is dotted name of the modules, emit it using decl path so the name could be resolved correctly. - if (this.canEmitDottedNameMemberAccessExpression(expression)) { - this.emitDottedNameMemberAccessExpression(expression); - } - else { - this.recordSourceMappingStart(expression); - this.emit(expression.expression); - this.writeToken(expression.dotToken); - this.emitName(expression.name, false); - this.recordSourceMappingEnd(expression); - } - } - } - - public emitQualifiedName(name: QualifiedNameSyntax): void { - this.recordSourceMappingStart(name); - - this.emit(name.left); - this.writeToken(name.dotToken); - this.emitName(name.right, false); - - this.recordSourceMappingEnd(name); - } - - public emitBinaryExpression(expression: BinaryExpressionSyntax): void { - this.recordSourceMappingStart(expression); - switch (expression.kind()) { - case SyntaxKind.CommaExpression: - this.emit(expression.left); - this.writeToken(expression.operatorToken); - this.writeToOutput(" "); - this.emit(expression.right); - break; - default: - { - this.emit(expression.left); - var binOp = SyntaxFacts.getText(SyntaxFacts.getOperatorTokenFromBinaryExpression(expression.kind())); - this.writeToOutput(" "); - this.writeToOutputWithSourceMapRecord(binOp, expression.operatorToken); - this.writeToOutput(" "); - this.emit(expression.right); - } - } - this.recordSourceMappingEnd(expression); - } - - public emitSimplePropertyAssignment(property: SimplePropertyAssignmentSyntax): void { - this.recordSourceMappingStart(property); - this.emit(property.propertyName); - - this.writeToken(property.colonToken); - this.writeToOutput(" "); - this.emitCommentsArray(ASTHelpers.convertTokenTrailingComments(property.colonToken, this.text()), /*trailing:*/ true, /*noLeadingSpace:*/ true); - - this.emit(property.expression); - this.recordSourceMappingEnd(property); - } - - public emitFunctionPropertyAssignment(funcProp: FunctionPropertyAssignmentSyntax): void { - this.recordSourceMappingStart(funcProp); - - this.emit(funcProp.propertyName); - this.writeToOutput(": "); - - var pullFunctionDecl = this.semanticInfoChain.getDeclForAST(funcProp); - - var savedInArrowFunction = this.inArrowFunction; - this.inArrowFunction = false; - - var temp = this.setContainer(EmitContainer.Function); - var funcName = funcProp.propertyName; - - var pullDecl = this.semanticInfoChain.getDeclForAST(funcProp); - this.pushDecl(pullDecl); - - this.recordSourceMappingStart(funcProp); - this.writeToOutput("function "); - - //this.recordSourceMappingStart(funcProp.propertyName); - //this.writeToOutput(funcProp.propertyName.actualText); - //this.recordSourceMappingEnd(funcProp.propertyName); - - this.emitParameterList(funcProp.callSignature.parameterList); - - this.emitFunctionBodyStatements(funcProp.propertyName.text(), funcProp, - funcProp.callSignature.parameterList.parameters, funcProp.block, /*bodyExpression:*/ null); - - this.recordSourceMappingEnd(funcProp); - - // The extra call is to make sure the caller's funcDecl end is recorded, since caller wont be able to record it - this.recordSourceMappingEnd(funcProp); - - this.emitComments(funcProp, false); - - this.popDecl(pullDecl); - - this.setContainer(temp); - this.inArrowFunction = savedInArrowFunction; - } - - public emitConditionalExpression(expression: ConditionalExpressionSyntax): void { - this.emit(expression.condition); - this.writeToOutput(" "); - this.writeToken(expression.questionToken); - this.writeToOutput(" "); - this.emit(expression.whenTrue); - this.writeToOutput(" "); - this.writeToken(expression.colonToken); - this.writeToOutput(" "); - this.emit(expression.whenFalse); - } - - public emitThrowStatement(statement: ThrowStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.throwKeyword); - this.writeToOutput(" "); - this.emit(statement.expression); - this.writeToOutputWithSourceMapRecord(";", statement.semicolonToken); - this.recordSourceMappingEnd(statement); - } - - public emitExpressionStatement(statement: ExpressionStatementSyntax): void { - var isArrowExpression = statement.expression.kind() === SyntaxKind.SimpleArrowFunctionExpression || statement.expression.kind() === SyntaxKind.ParenthesizedArrowFunctionExpression; - - this.recordSourceMappingStart(statement); - if (isArrowExpression) { - this.writeToOutput("("); - } - - this.emit(statement.expression); - - if (isArrowExpression) { - this.writeToOutput(")"); - } - - this.writeToOutputWithSourceMapRecord(";", statement.semicolonToken); - this.recordSourceMappingEnd(statement); - } - - public emitLabeledStatement(statement: LabeledStatementSyntax): void { - this.writeToOutputWithSourceMapRecord(statement.identifier.text(), statement.identifier); - this.writeToken(statement.colonToken); - this.writeLineToOutput(""); - this.emitJavascript(statement.statement, /*startLine:*/ true); - } - - public emitBlock(block: BlockSyntax): void { - this.recordSourceMappingStart(block); - this.writeLineToOutput(" {"); - this.indenter.increaseIndent(); - if (block.statements) { - this.emitList(block.statements); - } - this.emitCommentsArray(ASTHelpers.convertTokenLeadingComments(block.closeBraceToken, this.text()), /*trailing:*/ false); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToken(block.closeBraceToken); - this.recordSourceMappingEnd(block); - } - - public emitBreakStatement(jump: BreakStatementSyntax): void { - this.recordSourceMappingStart(jump); - this.writeToken(jump.breakKeyword); - - if (jump.identifier) { - this.writeToOutput(" "); - this.writeToOutputWithSourceMapRecord(jump.identifier.text(), jump.identifier); - } - - this.writeToOutputWithSourceMapRecord(";", jump.semicolonToken); - this.recordSourceMappingEnd(jump); - } - - public emitContinueStatement(jump: ContinueStatementSyntax): void { - this.recordSourceMappingStart(jump); - this.writeToken(jump.continueKeyword); - - if (jump.identifier) { - this.writeToOutput(" "); - this.writeToOutputWithSourceMapRecord(jump.identifier.text(), jump.identifier); - } - - this.writeToOutputWithSourceMapRecord(";", jump.semicolonToken); - this.recordSourceMappingEnd(jump); - } - - public emitWhileStatement(statement: WhileStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.whileKeyword); - this.writeToOutput(" "); - this.writeToken(statement.openParenToken); - this.emit(statement.condition); - this.writeToken(statement.closeParenToken); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - } - - public emitDoStatement(statement: DoStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.doKeyword); - this.emitBlockOrStatement(statement.statement); - this.writeToOutput(" "); - this.writeToken(statement.whileKeyword); - this.writeToken(statement.openParenToken); - this.emit(statement.condition); - this.writeToken(statement.closeParenToken); - this.writeToOutputWithSourceMapRecord(";", statement.semicolonToken); - this.recordSourceMappingEnd(statement); - } - - public emitIfStatement(statement: IfStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.ifKeyword); - this.writeToOutput(" "); - this.writeToken(statement.openParenToken); - this.emit(statement.condition); - this.writeToken(statement.closeParenToken); - - this.emitBlockOrStatement(statement.statement); - - if (statement.elseClause) { - if (statement.statement.kind() !== SyntaxKind.Block) { - this.writeLineToOutput(""); - this.emitIndent(); - } - else { - this.writeToOutput(" "); - } - - this.emit(statement.elseClause); - } - this.recordSourceMappingEnd(statement); - } - - public emitElseClause(elseClause: ElseClauseSyntax): void { - this.writeToken(elseClause.elseKeyword); - if (elseClause.statement.kind() === SyntaxKind.IfStatement) { - this.writeToOutput(" "); - this.emit(elseClause.statement); - } - else { - this.emitBlockOrStatement(elseClause.statement); - } - } - - public emitReturnStatement(statement: ReturnStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.returnKeyword); - if (statement.expression) { - this.writeToOutput(" "); - this.emit(statement.expression); - } - - this.writeToOutputWithSourceMapRecord(";", statement.semicolonToken); - this.recordSourceMappingEnd(statement); - } - - public emitForInStatement(statement: ForInStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.forKeyword); - this.writeToOutput(" "); - this.writeToken(statement.openParenToken); - - if (statement.left) { - this.emit(statement.left); - } - else { - this.emit(statement.variableDeclaration); - } - this.writeToOutput(" "); - this.writeToken(statement.inKeyword); - this.writeToOutput(" "); - this.emit(statement.expression); - this.writeToken(statement.closeParenToken); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - } - - public emitForStatement(statement: ForStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.forKeyword); - this.writeToOutput(" "); - this.writeToken(statement.openParenToken); - - if (statement.variableDeclaration) { - this.emit(statement.variableDeclaration); - } - else if (statement.initializer) { - this.emit(statement.initializer); - } - - this.writeToken(statement.firstSemicolonToken); - this.writeToOutput(" "); - this.emitJavascript(statement.condition, false); - this.writeToken(statement.secondSemicolonToken); - if (statement.incrementor) { - this.writeToOutput(" "); - this.emitJavascript(statement.incrementor, false); - } - this.writeToken(statement.closeParenToken); - this.emitBlockOrStatement(statement.statement); - this.recordSourceMappingEnd(statement); - } - - public emitWithStatement(statement: WithStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.withKeyword); - this.writeToOutput(" "); - this.writeToken(statement.openParenToken); - if (statement.condition) { - this.emit(statement.condition); - } - - this.writeToken(statement.closeParenToken); - var prevInWithBlock = this.inWithBlock; - this.inWithBlock = true; - this.emitBlockOrStatement(statement.statement); - this.inWithBlock = prevInWithBlock; - this.recordSourceMappingEnd(statement); - } - - public emitSwitchStatement(statement: SwitchStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.switchKeyword); - this.writeToOutput(" "); - this.writeToken(statement.openParenToken); - this.emit(statement.expression); - this.writeToken(statement.closeParenToken); - this.writeLineToOutput(" {"); - this.indenter.increaseIndent(); - this.emitList(statement.switchClauses, /*useNewLineSeparator:*/ false); - this.indenter.decreaseIndent(); - this.emitIndent(); - this.writeToken(statement.closeBraceToken); - this.recordSourceMappingEnd(statement); - } - - public emitCaseSwitchClause(clause: CaseSwitchClauseSyntax): void { - this.recordSourceMappingStart(clause); - this.writeToken(clause.caseKeyword); - this.writeToOutput(" "); - this.emit(clause.expression); - this.writeToken(clause.colonToken); - - this.emitSwitchClauseBody(clause.colonToken, clause.statements); - this.recordSourceMappingEnd(clause); - } - - private emitSwitchClauseBody(colonToken: ISyntaxToken, body: IStatementSyntax[]): void { - var text = this.text(); - if (body.length === 1 && childAt(body, 0).kind() === SyntaxKind.Block) { - // The case statement was written with curly braces, so emit it with the appropriate formatting - this.emit(childAt(body, 0)); - this.writeLineToOutput(""); - } - else if (body.length === 1 && this.isOnSameLine(end(colonToken, text), start(body[0], text))) { - this.writeToOutput(" "); - this.emit(childAt(body, 0)); - this.writeLineToOutput(""); - } - else { - // No curly braces. Format in the expected way - this.writeLineToOutput(""); - this.indenter.increaseIndent(); - this.emit(body); - this.indenter.decreaseIndent(); - } - } - - public emitDefaultSwitchClause(clause: DefaultSwitchClauseSyntax): void { - this.recordSourceMappingStart(clause); - this.writeToken(clause.defaultKeyword); - this.writeToken(clause.colonToken); - - this.emitSwitchClauseBody(clause.colonToken, clause.statements); - this.recordSourceMappingEnd(clause); - } - - public emitTryStatement(statement: TryStatementSyntax): void { - this.recordSourceMappingStart(statement); - this.writeToken(statement.tryKeyword); - this.writeToOutput(" "); - this.emit(statement.block); - this.emitJavascript(statement.catchClause, false); - - if (statement.finallyClause) { - this.emit(statement.finallyClause); - } - this.recordSourceMappingEnd(statement); - } - - public emitCatchClause(clause: CatchClauseSyntax): void { - this.writeToOutput(" "); - this.recordSourceMappingStart(clause); - this.writeToken(clause.catchKeyword); - this.writeToOutput(" "); - this.writeToken(clause.openParenToken); - this.emit(clause.identifier); - this.writeToken(clause.closeParenToken); - this.emit(clause.block); - this.recordSourceMappingEnd(clause); - } - - public emitFinallyClause(clause: FinallyClauseSyntax): void { - this.writeToOutput(" "); - this.writeToken(clause.finallyKeyword); - this.emit(clause.block); - } - - public emitDebuggerStatement(statement: DebuggerStatementSyntax): void { - this.writeToken(statement.debuggerKeyword); - this.writeToOutputWithSourceMapRecord(";", statement.semicolonToken); - } - - public emitNumericLiteral(literal: ISyntaxToken): void { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - } - - public emitRegularExpressionLiteral(literal: ISyntaxToken): void { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - } - - public emitStringLiteral(literal: ISyntaxToken): void { - this.writeToOutputWithSourceMapRecord(literal.text(), literal); - } - - public emitEqualsValueClause(clause: EqualsValueClauseSyntax): void { - this.writeToOutput(" "); - this.writeToken(clause.equalsToken); - this.writeToOutput(" "); - this.emitCommentsArray(ASTHelpers.convertTokenTrailingComments(clause.equalsToken, this.text()), /*trailing:*/ true, /*noLeadingSpace:*/ true); - - this.emit(clause.value); - } - - private emitParameter(parameter: ParameterSyntax): void { - this.writeToOutputWithSourceMapRecord(parameter.identifier.text(), parameter); - } - - public emitConstructorDeclaration(declaration: ConstructorDeclarationSyntax): void { - if (declaration.block) { - this.emitConstructor(declaration); - } - else { - this.emitComments(declaration, /*pre:*/ true, /*onlyPinnedOrTripleSlashComments:*/ true); - } - } - - public shouldEmitFunctionDeclaration(declaration: FunctionDeclarationSyntax): boolean { - return ASTHelpers.preComments(declaration, this.text()) !== null || (!hasModifier(declaration.modifiers, PullElementFlags.Ambient) && declaration.block !== null); - } - - public emitFunctionDeclaration(declaration: FunctionDeclarationSyntax): void { - if (!hasModifier(declaration.modifiers, PullElementFlags.Ambient) && declaration.block !== null) { - this.emitFunction(declaration); - } - else { - this.emitComments(declaration, /*pre:*/ true, /*onlyPinnedOrTripleSlashComments:*/ true); - } - } - - private emitSourceUnit(sourceUnit: SourceUnitSyntax): void { - if (!this.document.isDeclareFile()) { - var pullDecl = this.semanticInfoChain.getDeclForAST(sourceUnit); - this.pushDecl(pullDecl); - this.emitScriptElements(sourceUnit); - this.popDecl(pullDecl); - - this.emitCommentsArray(ASTHelpers.convertTokenLeadingComments(sourceUnit.endOfFileToken, this.text()), /*trailing:*/ false); - } - } - - public shouldEmitEnumDeclaration(declaration: EnumDeclarationSyntax): boolean { - return ASTHelpers.preComments(declaration, this.text()) !== null || !ASTHelpers.enumIsElided(declaration); - } - - public emitEnumDeclaration(declaration: EnumDeclarationSyntax): void { - if (!ASTHelpers.enumIsElided(declaration)) { - this.emitComments(declaration, true); - this.emitEnum(declaration); - this.emitComments(declaration, false); - } - else { - this.emitComments(declaration, true, /*onlyPinnedOrTripleSlashComments:*/ true); - } - } - - public shouldEmitModuleDeclaration(declaration: ModuleDeclarationSyntax): boolean { - return ASTHelpers.preComments(declaration, this.text()) !== null || !ASTHelpers.moduleIsElided(declaration); - } - - private emitModuleDeclaration(declaration: ModuleDeclarationSyntax): void { - if (!ASTHelpers.moduleIsElided(declaration)) { - this.emitModuleDeclarationWorker(declaration); - } - else { - this.emitComments(declaration, true, /*onlyPinnedOrTripleSlashComments:*/ true); - } - } - - public shouldEmitClassDeclaration(declaration: ClassDeclarationSyntax): boolean { - return ASTHelpers.preComments(declaration, this.text()) !== null || !hasModifier(declaration.modifiers, PullElementFlags.Ambient); - } - - public emitClassDeclaration(declaration: ClassDeclarationSyntax): void { - if (!hasModifier(declaration.modifiers, PullElementFlags.Ambient)) { - this.emitClass(declaration); - } - else { - this.emitComments(declaration, /*pre:*/ true, /*onlyPinnedOrTripleSlashComments:*/ true); - } - } - - public shouldEmitInterfaceDeclaration(declaration: InterfaceDeclarationSyntax): boolean { - return ASTHelpers.preComments(declaration, this.text()) !== null; - } - - public emitInterfaceDeclaration(declaration: InterfaceDeclarationSyntax): void { - this.emitComments(declaration, /*pre:*/ true, /*onlyPinnedOrTripleSlashComments:*/ true); - } - - private firstVariableDeclarator(statement: VariableStatementSyntax): VariableDeclaratorSyntax { - return statement.variableDeclaration.variableDeclarators[0]; - } - - private isNotAmbientOrHasInitializer(variableStatement: VariableStatementSyntax): boolean { - return !hasModifier(variableStatement.modifiers, PullElementFlags.Ambient) || this.firstVariableDeclarator(variableStatement).equalsValueClause !== null; - } - - public shouldEmitVariableStatement(statement: VariableStatementSyntax): boolean { - return ASTHelpers.preComments(statement, this.text()) !== null || this.isNotAmbientOrHasInitializer(statement); - } - - public emitVariableStatement(statement: VariableStatementSyntax): void { - if (this.isNotAmbientOrHasInitializer(statement)) { - this.emitComments(statement, true); - this.emit(statement.variableDeclaration); - this.writeToOutputWithSourceMapRecord(";", statement.semicolonToken); - this.emitComments(statement, false); - } - else { - this.emitComments(statement, /*pre:*/ true, /*onlyPinnedOrTripleSlashComments:*/ true); - } - } - - public emitGenericType(type: GenericTypeSyntax): void { - this.emit(type.name); - } - - private shouldEmit(ast: ISyntaxElement): boolean { - if (!ast) { - return false; - } - - switch (ast.kind()) { - case SyntaxKind.ImportDeclaration: - return this.shouldEmitImportDeclaration(ast); - case SyntaxKind.ClassDeclaration: - return this.shouldEmitClassDeclaration(ast); - case SyntaxKind.InterfaceDeclaration: - return this.shouldEmitInterfaceDeclaration(ast); - case SyntaxKind.FunctionDeclaration: - return this.shouldEmitFunctionDeclaration(ast); - case SyntaxKind.ModuleDeclaration: - return this.shouldEmitModuleDeclaration(ast); - case SyntaxKind.VariableStatement: - return this.shouldEmitVariableStatement(ast); - case SyntaxKind.OmittedExpression: - return false; - case SyntaxKind.EnumDeclaration: - return this.shouldEmitEnumDeclaration(ast); - } - - return true; - } - - private emit(ast: ISyntaxElement): void { - if (!ast) { - return; - } - - switch (ast.kind()) { - case SyntaxKind.SeparatedList: - return this.emitSeparatedList(ast); - case SyntaxKind.List: - return this.emitList(ast); - case SyntaxKind.SourceUnit: - return this.emitSourceUnit(ast); - case SyntaxKind.ImportDeclaration: - return this.emitImportDeclaration(ast); - case SyntaxKind.ExportAssignment: - return this.setExportAssignment(ast); - case SyntaxKind.ClassDeclaration: - return this.emitClassDeclaration(ast); - case SyntaxKind.InterfaceDeclaration: - return this.emitInterfaceDeclaration(ast); - case SyntaxKind.IdentifierName: - return this.emitName(ast, true); - case SyntaxKind.VariableDeclarator: - return this.emitVariableDeclarator(ast); - case SyntaxKind.SimpleArrowFunctionExpression: - return this.emitSimpleArrowFunctionExpression(ast); - case SyntaxKind.ParenthesizedArrowFunctionExpression: - return this.emitParenthesizedArrowFunctionExpression(ast); - case SyntaxKind.FunctionDeclaration: - return this.emitFunctionDeclaration(ast); - case SyntaxKind.ModuleDeclaration: - return this.emitModuleDeclaration(ast); - case SyntaxKind.VariableDeclaration: - return this.emitVariableDeclaration(ast); - case SyntaxKind.GenericType: - return this.emitGenericType(ast); - case SyntaxKind.ConstructorDeclaration: - return this.emitConstructorDeclaration(ast); - case SyntaxKind.EnumDeclaration: - return this.emitEnumDeclaration(ast); - case SyntaxKind.EnumElement: - return this.emitEnumElement(ast); - case SyntaxKind.FunctionExpression: - return this.emitFunctionExpression(ast); - case SyntaxKind.VariableStatement: - return this.emitVariableStatement(ast); - } - - this.emitComments(ast, true); - this.emitWorker(ast); - this.emitComments(ast, false); - } - - private emitWorker(ast: ISyntaxElement): void { - if (!ast) { - return; - } - - switch (ast.kind()) { - case SyntaxKind.NumericLiteral: - return this.emitNumericLiteral(ast); - case SyntaxKind.RegularExpressionLiteral: - return this.emitRegularExpressionLiteral(ast); - case SyntaxKind.StringLiteral: - return this.emitStringLiteral(ast); - case SyntaxKind.FalseKeyword: - case SyntaxKind.NullKeyword: - case SyntaxKind.TrueKeyword: - return this.emitLiteralExpression(ast); - case SyntaxKind.ThisKeyword: - return this.emitThisExpression(ast); - case SyntaxKind.SuperKeyword: - return this.emitSuperExpression(ast); - case SyntaxKind.ParenthesizedExpression: - return this.emitParenthesizedExpression(ast); - case SyntaxKind.ArrayLiteralExpression: - return this.emitArrayLiteralExpression(ast); - case SyntaxKind.PostDecrementExpression: - case SyntaxKind.PostIncrementExpression: - return this.emitPostfixUnaryExpression(ast); - case SyntaxKind.LogicalNotExpression: - case SyntaxKind.BitwiseNotExpression: - case SyntaxKind.NegateExpression: - case SyntaxKind.PlusExpression: - case SyntaxKind.PreIncrementExpression: - case SyntaxKind.PreDecrementExpression: - return this.emitPrefixUnaryExpression(ast); - case SyntaxKind.InvocationExpression: - return this.emitInvocationExpression(ast); - case SyntaxKind.ElementAccessExpression: - return this.emitElementAccessExpression(ast); - case SyntaxKind.MemberAccessExpression: - return this.emitMemberAccessExpression(ast); - case SyntaxKind.QualifiedName: - return this.emitQualifiedName(ast); - case SyntaxKind.CommaExpression: - case SyntaxKind.AssignmentExpression: - case SyntaxKind.AddAssignmentExpression: - case SyntaxKind.SubtractAssignmentExpression: - case SyntaxKind.MultiplyAssignmentExpression: - case SyntaxKind.DivideAssignmentExpression: - case SyntaxKind.ModuloAssignmentExpression: - case SyntaxKind.AndAssignmentExpression: - case SyntaxKind.ExclusiveOrAssignmentExpression: - case SyntaxKind.OrAssignmentExpression: - case SyntaxKind.LeftShiftAssignmentExpression: - case SyntaxKind.SignedRightShiftAssignmentExpression: - case SyntaxKind.UnsignedRightShiftAssignmentExpression: - case SyntaxKind.LogicalOrExpression: - case SyntaxKind.LogicalAndExpression: - case SyntaxKind.BitwiseOrExpression: - case SyntaxKind.BitwiseExclusiveOrExpression: - case SyntaxKind.BitwiseAndExpression: - case SyntaxKind.EqualsWithTypeConversionExpression: - case SyntaxKind.NotEqualsWithTypeConversionExpression: - case SyntaxKind.EqualsExpression: - case SyntaxKind.NotEqualsExpression: - case SyntaxKind.LessThanExpression: - case SyntaxKind.GreaterThanExpression: - case SyntaxKind.LessThanOrEqualExpression: - case SyntaxKind.GreaterThanOrEqualExpression: - case SyntaxKind.InstanceOfExpression: - case SyntaxKind.InExpression: - case SyntaxKind.LeftShiftExpression: - case SyntaxKind.SignedRightShiftExpression: - case SyntaxKind.UnsignedRightShiftExpression: - case SyntaxKind.MultiplyExpression: - case SyntaxKind.DivideExpression: - case SyntaxKind.ModuloExpression: - case SyntaxKind.AddExpression: - case SyntaxKind.SubtractExpression: - return this.emitBinaryExpression(ast); - case SyntaxKind.ConditionalExpression: - return this.emitConditionalExpression(ast); - case SyntaxKind.EqualsValueClause: - return this.emitEqualsValueClause(ast); - case SyntaxKind.Parameter: - return this.emitParameter(ast); - case SyntaxKind.Block: - return this.emitBlock(ast); - case SyntaxKind.ElseClause: - return this.emitElseClause(ast); - case SyntaxKind.IfStatement: - return this.emitIfStatement(ast); - case SyntaxKind.ExpressionStatement: - return this.emitExpressionStatement(ast); - case SyntaxKind.GetAccessor: - return this.emitGetAccessor(ast); - case SyntaxKind.SetAccessor: - return this.emitSetAccessor(ast); - case SyntaxKind.ThrowStatement: - return this.emitThrowStatement(ast); - case SyntaxKind.ReturnStatement: - return this.emitReturnStatement(ast); - case SyntaxKind.ObjectCreationExpression: - return this.emitObjectCreationExpression(ast); - case SyntaxKind.SwitchStatement: - return this.emitSwitchStatement(ast); - case SyntaxKind.CaseSwitchClause: - return this.emitCaseSwitchClause(ast); - case SyntaxKind.DefaultSwitchClause: - return this.emitDefaultSwitchClause(ast); - case SyntaxKind.BreakStatement: - return this.emitBreakStatement(ast); - case SyntaxKind.ContinueStatement: - return this.emitContinueStatement(ast); - case SyntaxKind.ForStatement: - return this.emitForStatement(ast); - case SyntaxKind.ForInStatement: - return this.emitForInStatement(ast); - case SyntaxKind.WhileStatement: - return this.emitWhileStatement(ast); - case SyntaxKind.WithStatement: - return this.emitWithStatement(ast); - case SyntaxKind.CastExpression: - return this.emitCastExpression(ast); - case SyntaxKind.ObjectLiteralExpression: - return this.emitObjectLiteralExpression(ast); - case SyntaxKind.SimplePropertyAssignment: - return this.emitSimplePropertyAssignment(ast); - case SyntaxKind.FunctionPropertyAssignment: - return this.emitFunctionPropertyAssignment(ast); - case SyntaxKind.EmptyStatement: - return this.writeToken((ast).semicolonToken); - case SyntaxKind.TryStatement: - return this.emitTryStatement(ast); - case SyntaxKind.CatchClause: - return this.emitCatchClause(ast); - case SyntaxKind.FinallyClause: - return this.emitFinallyClause(ast); - case SyntaxKind.LabeledStatement: - return this.emitLabeledStatement(ast); - case SyntaxKind.DoStatement: - return this.emitDoStatement(ast); - case SyntaxKind.TypeOfExpression: - return this.emitTypeOfExpression(ast); - case SyntaxKind.DeleteExpression: - return this.emitDeleteExpression(ast); - case SyntaxKind.VoidExpression: - return this.emitVoidExpression(ast); - case SyntaxKind.DebuggerStatement: - return this.emitDebuggerStatement(ast); - } - } - } - - export function getLastConstructor(classDecl: ClassDeclarationSyntax): ConstructorDeclarationSyntax { - for (var i = classDecl.classElements.length - 1; i >= 0; i--) { - var child = classDecl.classElements[i]; - - if (child.kind() === SyntaxKind.ConstructorDeclaration) { - return child; - } - } - - return null; - } - - export function getTrimmedTextLines(comment: Comment): string[] { - if (comment.kind() === SyntaxKind.MultiLineCommentTrivia) { - return comment.fullText().split("\n").map(s => s.trim()); - } - else { - return [comment.fullText().trim()]; - } - } -} \ No newline at end of file diff --git a/src/services/compiler/optionsParser.ts b/src/services/compiler/optionsParser.ts deleted file mode 100644 index 6c2a15813d5..00000000000 --- a/src/services/compiler/optionsParser.ts +++ /dev/null @@ -1,266 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// - -module TypeScript { - export interface IOptions { - name?: string; - flag?: boolean; - short?: string; - usage?: { - locCode: string; // DiagnosticCode - args: string[] - }; - set?: (s: string) => void; - type?: string; // DiagnosticCode - experimental?: boolean; - } - - export class OptionsParser { - private DEFAULT_SHORT_FLAG = "-"; - private DEFAULT_LONG_FLAG = "--"; - - private printedVersion: boolean = false; - - // Find the option record for the given string. Returns null if not found. - private findOption(arg: string) { - var upperCaseArg = arg && arg.toUpperCase(); - - for (var i = 0; i < this.options.length; i++) { - var current = this.options[i]; - - if (upperCaseArg === (current.short && current.short.toUpperCase()) || - upperCaseArg === (current.name && current.name.toUpperCase())) { - return current; - } - } - - return null; - } - - public unnamed: string[] = []; - - public options: IOptions[] = []; - - constructor(public host: IEnvironment, public version: string) { - } - - public printUsage() { - this.printVersion(); - - var optionsWord = getLocalizedText(DiagnosticCode.options, null); - var fileWord = getLocalizedText(DiagnosticCode.file1, null); - var tscSyntax = "tsc [" + optionsWord + "] [" + fileWord + " ..]"; - var syntaxHelp = getLocalizedText(DiagnosticCode.Syntax_0, [tscSyntax]); - this.host.standardOut.WriteLine(syntaxHelp); - this.host.standardOut.WriteLine(""); - this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Examples, null) + " tsc hello.ts"); - this.host.standardOut.WriteLine(" tsc --out foo.js foo.ts"); - this.host.standardOut.WriteLine(" tsc @args.txt"); - this.host.standardOut.WriteLine(""); - this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Options, null)); - - var output: string[][] = []; - var maxLength = 0; - var i = 0; - - this.options = this.options.sort(function (a, b) { - var aName = a.name.toLowerCase(); - var bName = b.name.toLowerCase(); - - if (aName > bName) { - return 1; - } else if (aName < bName) { - return -1; - } else { - return 0; - } - }); - - // Build up output array - for (i = 0; i < this.options.length; i++) { - var option = this.options[i]; - - if (option.experimental) { - continue; - } - - if (!option.usage) { - break; - } - - var usageString = " "; - var type = option.type ? (" " + TypeScript.getLocalizedText(option.type, null)) : ""; - - if (option.short) { - usageString += this.DEFAULT_SHORT_FLAG + option.short + type + ", "; - } - - usageString += this.DEFAULT_LONG_FLAG + option.name + type; - - output.push([usageString, TypeScript.getLocalizedText(option.usage.locCode, option.usage.args)]); - - if (usageString.length > maxLength) { - maxLength = usageString.length; - } - } - - var fileDescription = getLocalizedText(DiagnosticCode.Insert_command_line_options_and_files_from_a_file, null); - output.push([" @<" + fileWord + ">", fileDescription]); - - // Print padded output - for (i = 0; i < output.length; i++) { - this.host.standardOut.WriteLine(output[i][0] + (new Array(maxLength - output[i][0].length + 3)).join(" ") + output[i][1]); - } - } - - public printVersion() { - if (!this.printedVersion) { - this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Version_0, [this.version])); - this.printedVersion = true; - } - } - - public option(name: string, config: IOptions, short?: string) { - if (!config) { - config = short; - short = null; - } - - config.name = name; - config.short = short; - config.flag = false; - - this.options.push(config); - } - - public flag(name: string, config: IOptions, short?: string) { - if (!config) { - config = short; - short = null; - } - - config.name = name; - config.short = short; - config.flag = true; - - this.options.push(config); - } - - // Parse an arguments string - public parseString(argString: string) { - var position = 0; - var tokens = argString.match(/\s+|"|[^\s"]+/g); - - function peek() { - return tokens[position]; - } - - function consume() { - return tokens[position++]; - } - - function consumeQuotedString() { - var value = ''; - consume(); // skip opening quote. - - var token = peek(); - - while (token && token !== '"') { - consume(); - - value += token; - - token = peek(); - } - - consume(); // skip ending quote; - - return value; - } - - var args: string[] = []; - var currentArg = ''; - - while (position < tokens.length) { - var token = peek(); - - if (token === '"') { - currentArg += consumeQuotedString(); - } else if (token.match(/\s/)) { - if (currentArg.length > 0) { - args.push(currentArg); - currentArg = ''; - } - - consume(); - } else { - consume(); - currentArg += token; - } - } - - if (currentArg.length > 0) { - args.push(currentArg); - } - - this.parse(args); - } - - // Parse arguments as they come from the platform: split into arguments. - public parse(args: string[]) { - var position = 0; - - function consume() { - return args[position++]; - } - - while (position < args.length) { - var current = consume(); - var match = current.match(/^(--?|@)(.*)/); - var value: any = null; - - if (match) { - if (match[1] === '@') { - this.parseString(this.host.readFile(match[2], null).contents); - } else { - var arg = match[2]; - var option = this.findOption(arg); - - if (option === null) { - this.host.standardOut.WriteLine(getDiagnosticMessage(DiagnosticCode.Unknown_compiler_option_0, [arg])); - this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"])); - } else { - if (!option.flag) { - value = consume(); - if (value === undefined) { - // No value provided - this.host.standardOut.WriteLine(getDiagnosticMessage(DiagnosticCode.Option_0_specified_without_1, [arg, getLocalizedText(option.type, null)])); - this.host.standardOut.WriteLine(getLocalizedText(DiagnosticCode.Use_the_0_flag_to_see_options, ["--help"])); - continue; - } - } - - option.set(value); - } - } - } else { - this.unnamed.push(current); - } - } - } - } -} \ No newline at end of file diff --git a/src/services/compiler/tsc.ts b/src/services/compiler/tsc.ts deleted file mode 100644 index acd4fb40e6a..00000000000 --- a/src/services/compiler/tsc.ts +++ /dev/null @@ -1,736 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// -/// -/// - -module TypeScript { - class SourceFile { - constructor(public scriptSnapshot: IScriptSnapshot, public byteOrderMark: ByteOrderMark) { - } - } - - class DiagnosticsLogger implements ILogger { - constructor(public ioHost: IEnvironment) { - } - public information(): boolean { return false; } - public debug(): boolean { return false; } - public warning(): boolean { return false; } - public error(): boolean { return false; } - public fatal(): boolean { return false; } - public log(s: string): void { - this.ioHost.standardOut.WriteLine(s); - } - } - - export class BatchCompiler implements IReferenceResolverHost { - public compilerVersion = "1.0.1.0"; - private inputFiles: string[] = []; - private compilationSettings: ImmutableCompilationSettings; - private resolvedFiles: IResolvedFile[] = []; - private fileNameToSourceFile = new StringHashTable(); - private hasErrors: boolean = false; - private logger: ILogger = null; - - constructor(private ioHost: IEnvironment) { - } - - // Begin batch compilation - public batchCompile() { - // Parse command line options - if (this.parseOptions()) { - var start = new Date().getTime(); - - if (this.compilationSettings.gatherDiagnostics()) { - this.logger = new DiagnosticsLogger(this.ioHost); - } else { - this.logger = new NullLogger(); - } - - if (this.compilationSettings.watch()) { - // Watch will cause the program to stick around as long as the files exist - this.watchFiles(); - return; - } - - // Resolve the compilation environemnt - this.resolve(); - - this.compile(); - - if (this.compilationSettings.gatherDiagnostics()) { - this.logger.log(""); - this.logger.log("File resolution time: " + TypeScript.fileResolutionTime); - this.logger.log(" file read: " + TypeScript.fileResolutionIOTime); - this.logger.log(" scan imports: " + TypeScript.fileResolutionScanImportsTime); - this.logger.log(" import search: " + TypeScript.fileResolutionImportFileSearchTime); - this.logger.log(" get lib.d.ts: " + TypeScript.fileResolutionGetDefaultLibraryTime); - - this.logger.log("SyntaxTree parse time: " + TypeScript.syntaxTreeParseTime); - this.logger.log("Syntax Diagnostics time: " + TypeScript.syntaxDiagnosticsTime); - this.logger.log("Create declarations time: " + TypeScript.createDeclarationsTime); - this.logger.log(""); - this.logger.log("Type check time: " + TypeScript.typeCheckTime); - this.logger.log(""); - this.logger.log("Emit time: " + TypeScript.emitTime); - this.logger.log("Declaration emit time: " + TypeScript.declarationEmitTime); - - this.logger.log("Total number of symbols created: " + TypeScript.pullSymbolID); - this.logger.log("Specialized types created: " + TypeScript.nSpecializationsCreated); - this.logger.log("Specialized signatures created: " + TypeScript.nSpecializedSignaturesCreated); - - this.logger.log(" IsExternallyVisibleTime: " + TypeScript.declarationEmitIsExternallyVisibleTime); - this.logger.log(" TypeSignatureTime: " + TypeScript.declarationEmitTypeSignatureTime); - this.logger.log(" GetBoundDeclTypeTime: " + TypeScript.declarationEmitGetBoundDeclTypeTime); - this.logger.log(" IsOverloadedCallSignatureTime: " + TypeScript.declarationEmitIsOverloadedCallSignatureTime); - this.logger.log(" FunctionDeclarationGetSymbolTime: " + TypeScript.declarationEmitFunctionDeclarationGetSymbolTime); - this.logger.log(" GetBaseTypeTime: " + TypeScript.declarationEmitGetBaseTypeTime); - this.logger.log(" GetAccessorFunctionTime: " + TypeScript.declarationEmitGetAccessorFunctionTime); - this.logger.log(" GetTypeParameterSymbolTime: " + TypeScript.declarationEmitGetTypeParameterSymbolTime); - this.logger.log(" GetImportDeclarationSymbolTime: " + TypeScript.declarationEmitGetImportDeclarationSymbolTime); - - this.logger.log("Emit write file time: " + TypeScript.emitWriteFileTime); - - this.logger.log("Compiler resolve path time: " + TypeScript.compilerResolvePathTime); - this.logger.log("Compiler directory name time: " + TypeScript.compilerDirectoryNameTime); - this.logger.log("Compiler directory exists time: " + TypeScript.compilerDirectoryExistsTime); - this.logger.log("Compiler file exists time: " + TypeScript.compilerFileExistsTime); - - this.logger.log("IO host resolve path time: " + TypeScript.ioHostResolvePathTime); - this.logger.log("IO host directory name time: " + TypeScript.ioHostDirectoryNameTime); - this.logger.log("IO host create directory structure time: " + TypeScript.ioHostCreateDirectoryStructureTime); - this.logger.log("IO host write file time: " + TypeScript.ioHostWriteFileTime); - - this.logger.log("Node make directory time: " + TypeScript.nodeMakeDirectoryTime); - this.logger.log("Node writeFileSync time: " + TypeScript.nodeWriteFileSyncTime); - this.logger.log("Node createBuffer time: " + TypeScript.nodeCreateBufferTime); - - this.logger.log("Total time: " + (new Date().getTime() - start)); - } - } - - // Exit with the appropriate error code - this.ioHost.quit(this.hasErrors ? 1 : 0); - } - - private resolve() { - // Resolve file dependencies, if requested - var includeDefaultLibrary = !this.compilationSettings.noLib(); - var resolvedFiles: IResolvedFile[] = []; - - var start = new Date().getTime(); - - if (!this.compilationSettings.noResolve()) { - // Resolve references - var resolutionResults = ReferenceResolver.resolve(this.inputFiles, this, this.compilationSettings.useCaseSensitiveFileResolution()); - resolvedFiles = resolutionResults.resolvedFiles; - - // Only include the library if useDefaultLib is set to true and did not see any 'no-default-lib' comments - includeDefaultLibrary = !this.compilationSettings.noLib() && !resolutionResults.seenNoDefaultLibTag; - - // Populate any diagnostic messages generated during resolution - resolutionResults.diagnostics.forEach(d => this.addDiagnostic(d)); - } - else { - for (var i = 0, n = this.inputFiles.length; i < n; i++) { - var inputFile = this.inputFiles[i]; - var referencedFiles: string[] = []; - var importedFiles: string[] = []; - - // If declaration files are going to be emitted, preprocess the file contents and add in referenced files as well - if (this.compilationSettings.generateDeclarationFiles()) { - var references = getReferencedFiles(inputFile, this.getScriptSnapshot(inputFile)); - for (var j = 0; j < references.length; j++) { - referencedFiles.push(references[j].path); - } - - inputFile = this.resolvePath(inputFile); - } - - resolvedFiles.push({ - path: inputFile, - referencedFiles: referencedFiles, - importedFiles: importedFiles - }); - } - } - - var defaultLibStart = new Date().getTime(); - if (includeDefaultLibrary) { - var libraryResolvedFile: IResolvedFile = { - path: this.getDefaultLibraryFilePath(), - referencedFiles: [], - importedFiles: [] - }; - - // Prepend the library to the resolved list - resolvedFiles = [libraryResolvedFile].concat(resolvedFiles); - } - TypeScript.fileResolutionGetDefaultLibraryTime += new Date().getTime() - defaultLibStart; - - this.resolvedFiles = resolvedFiles; - - TypeScript.fileResolutionTime = new Date().getTime() - start; - } - - // Returns true if compilation failed from some reason. - private compile(): void { - var compiler = new TypeScriptCompiler(this.logger, this.compilationSettings); - - this.resolvedFiles.forEach(resolvedFile => { - var sourceFile = this.getSourceFile(resolvedFile.path); - compiler.addFile(resolvedFile.path, sourceFile.scriptSnapshot, sourceFile.byteOrderMark, /*version:*/ 0, /*isOpen:*/ false, resolvedFile.referencedFiles); - }); - - for (var it = compiler.compile((path: string) => this.resolvePath(path)); it.moveNext();) { - var result = it.current(); - - result.diagnostics.forEach(d => this.addDiagnostic(d)); - if (!this.tryWriteOutputFiles(result.outputFiles)) { - return; - } - } - } - - // Parse command line options - private parseOptions() { - var opts = new OptionsParser(this.ioHost, this.compilerVersion); - - var mutableSettings = new CompilationSettings(); - opts.option('out', { - usage: { - locCode: DiagnosticCode.Concatenate_and_emit_output_to_single_file, - args: null - }, - type: DiagnosticCode.file2, - set: (str) => { - mutableSettings.outFileOption = str; - } - }); - - opts.option('outDir', { - usage: { - locCode: DiagnosticCode.Redirect_output_structure_to_the_directory, - args: null - }, - type: DiagnosticCode.DIRECTORY, - set: (str) => { - mutableSettings.outDirOption = str; - } - }); - - opts.flag('sourcemap', { - usage: { - locCode: DiagnosticCode.Generates_corresponding_0_file, - args: ['.map'] - }, - set: () => { - mutableSettings.mapSourceFiles = true; - } - }); - - opts.option('mapRoot', { - usage: { - locCode: DiagnosticCode.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - args: null - }, - type: DiagnosticCode.LOCATION, - set: (str) => { - mutableSettings.mapRoot = str; - } - }); - - opts.option('sourceRoot', { - usage: { - locCode: DiagnosticCode.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - args: null - }, - type: DiagnosticCode.LOCATION, - set: (str) => { - mutableSettings.sourceRoot = str; - } - }); - - opts.flag('declaration', { - usage: { - locCode: DiagnosticCode.Generates_corresponding_0_file, - args: ['.d.ts'] - }, - set: () => { - mutableSettings.generateDeclarationFiles = true; - } - }, 'd'); - - if (this.ioHost.watchFile) { - opts.flag('watch', { - usage: { - locCode: DiagnosticCode.Watch_input_files, - args: null - }, - set: () => { - mutableSettings.watch = true; - } - }, 'w'); - } - - opts.flag('propagateEnumConstants', { - experimental: true, - set: () => { mutableSettings.propagateEnumConstants = true; } - }); - - opts.flag('removeComments', { - usage: { - locCode: DiagnosticCode.Do_not_emit_comments_to_output, - args: null - }, - set: () => { - mutableSettings.removeComments = true; - } - }); - - opts.flag('noResolve', { - experimental: true, - usage: { - locCode: DiagnosticCode.Skip_resolution_and_preprocessing, - args: null - }, - set: () => { - mutableSettings.noResolve = true; - } - }); - - opts.flag('noLib', { - experimental: true, - set: () => { - mutableSettings.noLib = true; - } - }); - - opts.flag('diagnostics', { - experimental: true, - set: () => { - mutableSettings.gatherDiagnostics = true; - } - }); - - opts.option('target', { - usage: { - locCode: DiagnosticCode.Specify_ECMAScript_target_version_0_default_or_1, - args: ['ES3', 'ES5'] - }, - type: DiagnosticCode.VERSION, - set: (type) => { - type = type.toLowerCase(); - - if (type === 'es3') { - mutableSettings.codeGenTarget = LanguageVersion.EcmaScript3; - } - else if (type === 'es5') { - mutableSettings.codeGenTarget = LanguageVersion.EcmaScript5; - } - else { - this.addDiagnostic( - new Diagnostic(null, null, 0, 0, DiagnosticCode.Argument_for_0_option_must_be_1_or_2, ["target", "ES3", "ES5"])); - } - } - }, 't'); - - opts.option('module', { - usage: { - locCode: DiagnosticCode.Specify_module_code_generation_0_or_1, - args: ['commonjs', 'amd'] - }, - type: DiagnosticCode.KIND, - set: (type) => { - type = type.toLowerCase(); - - if (type === 'commonjs') { - mutableSettings.moduleGenTarget = ModuleGenTarget.Synchronous; - } - else if (type === 'amd') { - mutableSettings.moduleGenTarget = ModuleGenTarget.Asynchronous; - } - else { - this.addDiagnostic( - new Diagnostic(null, null, 0, 0, DiagnosticCode.Argument_for_0_option_must_be_1_or_2, ["module", "commonjs", "amd"])); - } - } - }, 'm'); - - var needsHelp = false; - opts.flag('help', { - usage: { - locCode: DiagnosticCode.Print_this_message, - args: null - }, - set: () => { - needsHelp = true; - } - }, 'h'); - - opts.flag('useCaseSensitiveFileResolution', { - experimental: true, - set: () => { - mutableSettings.useCaseSensitiveFileResolution = true; - } - }); - var shouldPrintVersionOnly = false; - opts.flag('version', { - usage: { - locCode: DiagnosticCode.Print_the_compiler_s_version_0, - args: [this.compilerVersion] - }, - set: () => { - shouldPrintVersionOnly = true; - } - }, 'v'); - - var locale: string = null; - opts.option('locale', { - experimental: true, - usage: { - locCode: DiagnosticCode.Specify_locale_for_errors_and_messages_For_example_0_or_1, - args: ['en', 'ja-jp'] - }, - type: DiagnosticCode.STRING, - set: (value) => { - locale = value; - } - }); - - opts.flag('noImplicitAny', { - usage: { - locCode: DiagnosticCode.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - args: null - }, - set: () => { - mutableSettings.noImplicitAny = true; - } - }); - - if (Environment.supportsCodePage()) { - opts.option('codepage', { - usage: { - locCode: DiagnosticCode.Specify_the_codepage_to_use_when_opening_source_files, - args: null - }, - type: DiagnosticCode.NUMBER, - set: (arg) => { - mutableSettings.codepage = parseInt(arg, 10); - } - }); - } - - opts.parse(this.ioHost.arguments); - - this.compilationSettings = ImmutableCompilationSettings.fromCompilationSettings(mutableSettings); - - if (locale) { - if (!this.setLocale(locale)) { - return false; - } - } - - this.inputFiles.push.apply(this.inputFiles, opts.unnamed); - - if (shouldPrintVersionOnly) { - opts.printVersion(); - return false; - } - // If no source files provided to compiler - print usage information - else if (this.inputFiles.length === 0 || needsHelp) { - opts.printUsage(); - return false; - } - - return !this.hasErrors; - } - - private setLocale(locale: string): boolean { - var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); - if (!matchResult) { - this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, ['en', 'ja-jp'])); - return false; - } - - var language = matchResult[1]; - var territory = matchResult[3]; - - // First try the entire locale, then fall back to just language if that's all we have. - if (!this.setLanguageAndTerritory(language, territory) && - !this.setLanguageAndTerritory(language, null)) { - - this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Unsupported_locale_0, [locale])); - return false; - } - - return true; - } - - private setLanguageAndTerritory(language: string, territory: string): boolean { - - var compilerFilePath = this.ioHost.executingFilePath(); - var containingDirectoryPath = this.ioHost.directoryName(compilerFilePath); - - var filePath = IOUtils.combine(containingDirectoryPath, language); - if (territory) { - filePath = filePath + "-" + territory; - } - - filePath = this.resolvePath(IOUtils.combine(filePath, "diagnosticMessages.generated.json")); - - if (!this.fileExists(filePath)) { - return false; - } - - var fileContents = this.ioHost.readFile(filePath, this.compilationSettings.codepage()); - TypeScript.LocalizedDiagnosticMessages = JSON.parse(fileContents.contents); - return true; - } - - // Handle -watch switch - private watchFiles() { - if (!this.ioHost.watchFile) { - this.addDiagnostic( - new Diagnostic(null, null, 0, 0, DiagnosticCode.Current_host_does_not_support_0_option, ['-w[atch]'])); - return; - } - - var lastResolvedFileSet: string[] = [] - var watchers: { [x: string]: IFileWatcher; } = {}; - var firstTime = true; - - var addWatcher = (fileName: string) => { - if (!watchers[fileName]) { - var watcher = this.ioHost.watchFile(fileName, onWatchedFileChange); - watchers[fileName] = watcher; - } - }; - - var removeWatcher = (fileName: string) => { - if (watchers[fileName]) { - watchers[fileName].close(); - delete watchers[fileName]; - } - }; - - var onWatchedFileChange = () => { - // Clean errors for previous compilation - this.hasErrors = false; - - // Clear out any source file data we've cached. - this.fileNameToSourceFile = new StringHashTable(); - - // Resolve file dependencies, if requested - this.resolve(); - - // Check if any new files were added to the environment as a result of the file change - var oldFiles = lastResolvedFileSet; - var newFiles = this.resolvedFiles.map(resolvedFile => resolvedFile.path).sort(); - - var i = 0, j = 0; - while (i < oldFiles.length && j < newFiles.length) { - - var compareResult = oldFiles[i].localeCompare(newFiles[j]); - if (compareResult === 0) { - // No change here - i++; - j++; - } - else if (compareResult < 0) { - // Entry in old list does not exist in the new one, it was removed - removeWatcher(oldFiles[i]); - i++; - } - else { - // Entry in new list does exist in the new one, it was added - addWatcher(newFiles[j]); - j++; - } - } - - // All remaining unmatched items in the old list have been removed - for (var k = i; k < oldFiles.length; k++) { - removeWatcher(oldFiles[k]); - } - - // All remaing unmatched items in the new list have been added - for (k = j; k < newFiles.length; k++) { - addWatcher(newFiles[k]); - } - - // Update the state - lastResolvedFileSet = newFiles; - - // Print header - if (!firstTime) { - var fileNames = ""; - for (var k = 0; k < lastResolvedFileSet.length; k++) { - fileNames += Environment.newLine + " " + lastResolvedFileSet[k]; - } - this.ioHost.standardError.WriteLine(getLocalizedText(DiagnosticCode.NL_Recompiling_0, [fileNames])); - } - else { - firstTime = false; - } - - // Trigger a new compilation - this.compile(); - }; - - // Switch to using stdout for all error messages - this.ioHost.standardOut = this.ioHost.standardOut; - - onWatchedFileChange(); - } - - private getSourceFile(fileName: string): SourceFile { - var sourceFile: SourceFile = this.fileNameToSourceFile.lookup(fileName); - if (!sourceFile) { - // Attempt to read the file - var fileInformation: FileInformation; - - try { - fileInformation = this.ioHost.readFile(fileName, this.compilationSettings.codepage()); - } - catch (e) { - this.addDiagnostic(new Diagnostic(null, null, 0, 0, DiagnosticCode.Cannot_read_file_0_1, [fileName, e.message])); - fileInformation = new FileInformation("", ByteOrderMark.None); - } - - var snapshot = ScriptSnapshot.fromString(fileInformation.contents); - var sourceFile = new SourceFile(snapshot, fileInformation.byteOrderMark); - this.fileNameToSourceFile.add(fileName, sourceFile); - } - - return sourceFile; - } - - private getDefaultLibraryFilePath(): string { - var compilerFilePath = this.ioHost.executingFilePath(); - var containingDirectoryPath = this.ioHost.directoryName(compilerFilePath); - var libraryFilePath = this.resolvePath(IOUtils.combine(containingDirectoryPath, "lib.d.ts")); - - return libraryFilePath; - } - - /// IReferenceResolverHost methods - getScriptSnapshot(fileName: string): IScriptSnapshot { - return this.getSourceFile(fileName).scriptSnapshot; - } - - resolveRelativePath(path: string, directory: string): string { - var unQuotedPath = stripStartAndEndQuotes(path); - var normalizedPath: string; - - if (isRooted(unQuotedPath) || !directory) { - normalizedPath = unQuotedPath; - } else { - normalizedPath = IOUtils.combine(directory, unQuotedPath); - } - - // get the absolute path - normalizedPath = this.resolvePath(normalizedPath); - - // Switch to forward slashes - normalizedPath = switchToForwardSlashes(normalizedPath); - - return normalizedPath; - } - - private fileExistsCache = createIntrinsicsObject(); - - fileExists(path: string): boolean { - var exists = this.fileExistsCache[path]; - if (exists === undefined) { - var start = new Date().getTime(); - exists = this.ioHost.fileExists(path); - this.fileExistsCache[path] = exists; - TypeScript.compilerFileExistsTime += new Date().getTime() - start; - } - - return exists; - } - - getParentDirectory(path: string): string { - var start = new Date().getTime(); - var result = this.ioHost.directoryName(path); - TypeScript.compilerDirectoryNameTime += new Date().getTime() - start; - - return result; - } - - - private addDiagnostic(diagnostic: Diagnostic): void { - var diagnosticInfo = diagnostic.info(); - if (diagnosticInfo.category === DiagnosticCategory.Error) { - this.hasErrors = true; - } - - this.ioHost.standardError.Write(TypeScriptCompiler.getFullDiagnosticText(diagnostic, path => this.resolvePath(path))); - } - - private tryWriteOutputFiles(outputFiles: OutputFile[]): boolean { - for (var i = 0, n = outputFiles.length; i < n; i++) { - var outputFile = outputFiles[i]; - - try { - this.writeFile(outputFile.name, outputFile.text, outputFile.writeByteOrderMark); - } - catch (e) { - this.addDiagnostic( - new Diagnostic(outputFile.name, null, 0, 0, DiagnosticCode.Emit_Error_0, [e.message])); - return false; - } - } - - return true; - } - - writeFile(fileName: string, contents: string, writeByteOrderMark: boolean): void { - var start = new Date().getTime(); - IOUtils.writeFileAndFolderStructure(this.ioHost, fileName, contents, writeByteOrderMark); - TypeScript.emitWriteFileTime += new Date().getTime() - start; - } - - directoryExists(path: string): boolean { - var start = new Date().getTime(); - var result = this.ioHost.directoryExists(path); - TypeScript.compilerDirectoryExistsTime += new Date().getTime() - start; - return result; - } - - // For performance reasons we cache the results of resolvePath. This avoids costly lookup - // on the disk once we've already resolved a path once. - private resolvePathCache = createIntrinsicsObject(); - - resolvePath(path: string): string { - var cachedValue = this.resolvePathCache[path]; - if (!cachedValue) { - var start = new Date().getTime(); - cachedValue = this.ioHost.absolutePath(path); - this.resolvePathCache[path] = cachedValue; - TypeScript.compilerResolvePathTime += new Date().getTime() - start; - } - - return cachedValue; - } - } - - // Start the batch compilation using the current hosts IO - var batch = new TypeScript.BatchCompiler(Environment); - batch.batchCompile(); -} diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index cab7547557c..969f7260744 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -120,7 +120,14 @@ module ts.formatting { function findOutermostParent(position: number, expectedTokenKind: SyntaxKind, sourceFile: SourceFile): Node { var precedingToken = findPrecedingToken(position, sourceFile); - if (!precedingToken || precedingToken.kind !== expectedTokenKind) { + + // when it is claimed that trigger character was typed at given position + // we verify that there is a token with a matching kind whose end is equal to position (because the character was just typed). + // If this condition is not hold - then trigger character was typed in some other context, + // i.e.in comment and thus should not trigger autoformatting + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { return undefined; } diff --git a/src/services/formatting/rulesProvider.ts b/src/services/formatting/rulesProvider.ts index 7ad1b65400c..25b6f1ba772 100644 --- a/src/services/formatting/rulesProvider.ts +++ b/src/services/formatting/rulesProvider.ts @@ -22,7 +22,7 @@ module ts.formatting { private activeRules: Rule[]; private rulesMap: RulesMap; - constructor(private logger: Logger) { + constructor() { this.globalRules = new Rules(); } diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 9051ee80399..771fe48219f 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -50,8 +50,9 @@ module ts.NavigationBar { case SyntaxKind.ArrayBindingPattern: forEach((node).elements, visit); break; + case SyntaxKind.BindingElement: case SyntaxKind.VariableDeclaration: - if (isBindingPattern(node)) { + if (isBindingPattern((node).name)) { visit((node).name); break; } @@ -262,17 +263,34 @@ module ts.NavigationBar { return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.functionElement); case SyntaxKind.VariableDeclaration: - if (isBindingPattern((node).name)) { - break; - } - if (isConst(node)) { - return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.constElement); - } - else if (isLet(node)) { - return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.letElement); + case SyntaxKind.BindingElement: + var variableDeclarationNode: Node; + var name: Node; + + if (node.kind === SyntaxKind.BindingElement) { + name = (node).name; + variableDeclarationNode = node; + // binding elements are added only for variable declarations + // bubble up to the containing variable declaration + while (variableDeclarationNode && variableDeclarationNode.kind !== SyntaxKind.VariableDeclaration) { + variableDeclarationNode = variableDeclarationNode.parent; + } + Debug.assert(variableDeclarationNode !== undefined); } else { - return createItem(node, getTextOfNode((node).name), ts.ScriptElementKind.variableElement); + Debug.assert(!isBindingPattern((node).name)); + variableDeclarationNode = node; + name = (node).name; + } + + if (isConst(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement); + } + else if (isLet(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement); + } + else { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); } case SyntaxKind.Constructor: @@ -386,9 +404,9 @@ module ts.NavigationBar { } hasGlobalNode = true; - var rootName = isExternalModule(node) ? - "\"" + escapeString(getBaseFilename(removeFileExtension(normalizePath(node.filename)))) + "\"" : - "" + var rootName = isExternalModule(node) + ? "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(node.fileName)))) + "\"" + : "" return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, diff --git a/src/services/resources/diagnosticCode.generated.ts b/src/services/resources/diagnosticCode.generated.ts index 86509fdd63b..1a0ac12e165 100644 --- a/src/services/resources/diagnosticCode.generated.ts +++ b/src/services/resources/diagnosticCode.generated.ts @@ -402,19 +402,13 @@ module TypeScript { Option_0_specified_without_1: "Option '{0}' specified without '{1}'", codepage_option_not_supported_on_current_platform: "'codepage' option not supported on current platform.", Concatenate_and_emit_output_to_single_file: "Concatenate and emit output to single file.", - Generates_corresponding_0_file: "Generates corresponding {0} file.", Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: "Specifies the location where debugger should locate map files instead of generated locations.", Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: "Specifies the location where debugger should locate TypeScript files instead of source locations.", Watch_input_files: "Watch input files.", Redirect_output_structure_to_the_directory: "Redirect output structure to the directory.", Do_not_emit_comments_to_output: "Do not emit comments to output.", - Skip_resolution_and_preprocessing: "Skip resolution and preprocessing.", - Specify_ECMAScript_target_version_0_default_or_1: "Specify ECMAScript target version: '{0}' (default), or '{1}'", - Specify_module_code_generation_0_or_1: "Specify module code generation: '{0}' or '{1}'", Print_this_message: "Print this message.", - Print_the_compiler_s_version_0: "Print the compiler's version: {0}", Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: "Allow use of deprecated '{0}' keyword when referencing an external module.", - Specify_locale_for_errors_and_messages_For_example_0_or_1: "Specify locale for errors and messages. For example '{0}' or '{1}'", Syntax_0: "Syntax: {0}", options: "options", file1: "file", @@ -431,7 +425,6 @@ module TypeScript { LOCATION: "LOCATION", DIRECTORY: "DIRECTORY", NUMBER: "NUMBER", - Specify_the_codepage_to_use_when_opening_source_files: "Specify the codepage to use when opening source files.", Additional_locations: "Additional locations:", This_version_of_the_Javascript_runtime_does_not_support_the_0_function: "This version of the Javascript runtime does not support the '{0}' function.", Unknown_rule: "Unknown rule.", diff --git a/src/services/services.ts b/src/services/services.ts index e662f6f2de1..fad7632843a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -9,7 +9,8 @@ /// module ts { - export var servicesVersion = "0.4" + + export var servicesVersion = "0.5" export interface Node { getSourceFile(): SourceFile; @@ -56,11 +57,14 @@ module ts { } export interface SourceFile { - isOpen: boolean; version: string; scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineStarts(): number[]; + getPositionFromLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -75,13 +79,6 @@ module ts { /** Gets the length of this script snapshot. */ getLength(): number; - /** - * This call returns the array containing the start position of every line. - * i.e."[0, 10, 55]". TODO: consider making this optional. The language service could - * always determine this (albeit in a more expensive manner). - */ - getLineStartPositions(): number[]; - /** * Gets the TextChangeRange that describe how the text changed between this text and * an older version. This information is used by the incremental parser to determine @@ -107,16 +104,10 @@ module ts { return this.text.length; } - public getLineStartPositions(): number[] { - if (!this._lineStartPositions) { - this._lineStartPositions = computeLineStarts(this.text); - } - - return this._lineStartPositions; - } - public getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange { - throw new Error("not yet implemented"); + // Text-based snapshots do not support incremental parsing. Return undefined + // to signal that to the caller. + return undefined; } } @@ -335,36 +326,44 @@ module ts { var paramTag = "@param"; var jsDocCommentParts: SymbolDisplayPart[] = []; - ts.forEach(declarations, declaration => { - var sourceFileOfDeclaration = getSourceFileOfNode(declaration); - // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === SyntaxKind.Parameter) { - ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => { - var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); - if (cleanedParamJsDocComment) { - jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); - } - }); + ts.forEach(declarations, (declaration, indexOfDeclaration) => { + // Make sure we are collecting doc comment from declaration once, + // In case of union property there might be same declaration multiple times + // which only varies in type parameter + // Eg. var a: Array | Array; a.length + // The property length will have two declarations of property length coming + // from Array - Array and Array + if (indexOf(declarations, declaration) === indexOfDeclaration) { + var sourceFileOfDeclaration = getSourceFileOfNode(declaration); + // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments + if (canUseParsedParamTagComments && declaration.kind === SyntaxKind.Parameter) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), jsDocCommentTextRange => { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedParamJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); + } + }); + } + + // If this is left side of dotted module declaration, there is no doc comments associated with this node + if (declaration.kind === SyntaxKind.ModuleDeclaration && (declaration).body.kind === SyntaxKind.ModuleDeclaration) { + return; + } + + // If this is dotted module name, get the doc comments from the parent + while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) { + declaration = declaration.parent; + } + + // Get the cleaned js doc comment text from the declaration + ts.forEach(getJsDocCommentTextRange( + declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); + } + }); } - - // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === SyntaxKind.ModuleDeclaration && (declaration).body.kind === SyntaxKind.ModuleDeclaration) { - return; - } - - // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) { - declaration = declaration.parent; - } - - // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange( - declaration.kind === SyntaxKind.VariableDeclaration ? declaration.parent.parent : declaration, sourceFileOfDeclaration), jsDocCommentTextRange => { - var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); - if (cleanedJsDocComment) { - jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); - } - }); }); return jsDocCommentParts; @@ -407,7 +406,7 @@ module ts { return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || - isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos: number, end: number, sourceFile: SourceFile) { @@ -718,28 +717,22 @@ module ts { class SourceFileObject extends NodeObject implements SourceFile { public _declarationBrand: any; - public filename: string; + public fileName: string; public text: string; public scriptSnapshot: IScriptSnapshot; + public lineMap: number[]; public statements: NodeArray; public endOfFileToken: Node; - // These methods will have their implementation provided by the implementation the - // compiler actually exports off of SourceFile. - public getLineAndCharacterFromPosition: (position: number) => LineAndCharacter; - public getPositionFromLineAndCharacter: (line: number, character: number) => number; - public getLineStarts: () => number[]; - public getSyntacticDiagnostics: () => Diagnostic[]; - public update: (newText: string, textChangeRange: TextChangeRange) => SourceFile; - public amdDependencies: string[]; public amdModuleName: string; public referencedFiles: FileReference[]; + public syntacticDiagnostics: Diagnostic[]; public referenceDiagnostics: Diagnostic[]; public parseDiagnostics: Diagnostic[]; - public semanticDiagnostics: Diagnostic[]; + public bindDiagnostics: Diagnostic[]; public hasNoDefaultLib: boolean; public externalModuleIndicator: Node; // The first node that causes this file to be an external module @@ -747,13 +740,28 @@ module ts { public identifierCount: number; public symbolCount: number; public version: string; - public isOpen: boolean; public languageVersion: ScriptTarget; public identifiers: Map; public nameTable: Map; private namedDeclarations: Declaration[]; + public update(newText: string, textChangeRange: TextChangeRange): SourceFile { + return updateSourceFile(this, newText, textChangeRange); + } + + public getLineAndCharacterFromPosition(position: number): LineAndCharacter { + return getLineAndCharacterOfPosition(this, position); + } + + public getLineStarts(): number[] { + return getLineStarts(this); + } + + public getPositionFromLineAndCharacter(line: number, character: number): number { + return getPositionFromLineAndCharacter(this, line, character); + } + public getNamedDeclarations() { if (!this.namedDeclarations) { var sourceFile = this; @@ -799,7 +807,7 @@ module ts { if ((node).name) { namedDeclarations.push(node); } - // fall through + // fall through case SyntaxKind.Constructor: case SyntaxKind.VariableStatement: case SyntaxKind.VariableDeclarationList: @@ -820,7 +828,7 @@ module ts { if (!(node.flags & NodeFlags.AccessibilityModifier)) { break; } - // fall through + // fall through case SyntaxKind.VariableDeclaration: case SyntaxKind.BindingElement: if (isBindingPattern((node).name)) { @@ -842,26 +850,22 @@ module ts { } } - export interface Logger { - log(s: string): void; - trace(s: string): void; - error(s: string): void; - } - // // Public interface of the host of a language service instance. // - export interface LanguageServiceHost extends Logger { + export interface LanguageServiceHost { getCompilationSettings(): CompilerOptions; getNewLine?(): string; getScriptFileNames(): string[]; getScriptVersion(fileName: string): string; - getScriptIsOpen(fileName: string): boolean; getScriptSnapshot(fileName: string): IScriptSnapshot; getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: CompilerOptions): string; + getDefaultLibFileName(options: CompilerOptions): string; + log? (s: string): void; + trace? (s: string): void; + error? (s: string): void; } // @@ -891,7 +895,7 @@ module ts { getRenameInfo(fileName: string, position: number): RenameInfo; findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; - + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; @@ -910,11 +914,13 @@ module ts { getEmitOutput(fileName: string): EmitOutput; - getSourceFile(filename: string): SourceFile; + getProgram(): Program; + + getSourceFile(fileName: string): SourceFile; dispose(): void; } - + export interface ClassifiedSpan { textSpan: TextSpan; classificationType: string; // ClassificationTypeNames @@ -1025,7 +1031,7 @@ module ts { text: string; kind: string; } - + export interface QuickInfo { kind: string; kindModifiers: string; @@ -1080,6 +1086,7 @@ module ts { export interface CompletionInfo { isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; // true when the current location also allows for a new identifier entries: CompletionEntry[]; } @@ -1116,7 +1123,7 @@ module ts { export interface EmitOutput { outputFiles: OutputFile[]; - emitOutputStatus: EmitReturnStatus; + emitSkipped: boolean; } export const enum OutputFileType { @@ -1164,25 +1171,80 @@ module ts { getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ export interface DocumentRegistry { + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ acquireDocument( - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, - version: string, - isOpen: boolean): SourceFile; + version: string): SourceFile; + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ updateDocument( sourceFile: SourceFile, - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, - isOpen: boolean, - textChangeRange: TextChangeRange - ): SourceFile; + textChangeRange: TextChangeRange): SourceFile; - releaseDocument(filename: string, compilationSettings: CompilerOptions): void + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void } // TODO: move these to enums @@ -1303,7 +1365,7 @@ module ts { /// Language Service interface CompletionSession { - filename: string; // the file where the completion was requested + fileName: string; // the file where the completion was requested position: number; // position in the file where the completion was requested entries: CompletionEntry[]; // entries for this completion symbols: Map; // symbols by entry name map @@ -1319,10 +1381,9 @@ module ts { // Information about a specific host file. interface HostFileInformation { - filename: string; + hostFileName: string; version: string; - isOpen: boolean; - sourceText?: IScriptSnapshot; + scriptSnapshot: IScriptSnapshot; } interface DocumentRegistryEntry { @@ -1372,9 +1433,9 @@ module ts { } export function getDefaultCompilerOptions(): CompilerOptions { - // Set "ScriptTarget.Latest" target by default for language service + // Always default to "ScriptTarget.ES5" for the language service return { - target: ScriptTarget.Latest, + target: ScriptTarget.ES5, module: ModuleKind.None, }; } @@ -1403,23 +1464,20 @@ module ts { // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. class HostCache { - private filenameToEntry: Map; + private fileNameToEntry: Map; private _compilationSettings: CompilerOptions; constructor(private host: LanguageServiceHost) { // script id => script index - this.filenameToEntry = {}; + this.fileNameToEntry = {}; - var filenames = host.getScriptFileNames(); - for (var i = 0, n = filenames.length; i < n; i++) { - var filename = filenames[i]; - this.filenameToEntry[normalizeSlashes(filename)] = { - filename: filename, - version: host.getScriptVersion(filename), - isOpen: host.getScriptIsOpen(filename) - }; + // Initialize the list with the root file names + var rootFileNames = host.getScriptFileNames(); + for (var i = 0, n = rootFileNames.length; i < n; i++) { + this.createEntry(rootFileNames[i]); } + // store the compilation settings this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); } @@ -1427,57 +1485,64 @@ module ts { return this._compilationSettings; } - public getEntry(filename: string): HostFileInformation { - filename = normalizeSlashes(filename); - return lookUp(this.filenameToEntry, filename); - } - - public contains(filename: string): boolean { - return !!this.getEntry(filename); - } - - public getHostfilename(filename: string) { - var hostCacheEntry = this.getEntry(filename); - if (hostCacheEntry) { - return hostCacheEntry.filename; + private createEntry(fileName: string) { + var entry: HostFileInformation; + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + if (scriptSnapshot) { + entry = { + hostFileName: fileName, + version: this.host.getScriptVersion(fileName), + scriptSnapshot: scriptSnapshot + }; } - return filename; + + return this.fileNameToEntry[normalizeSlashes(fileName)] = entry; } - public getFilenames(): string[] { + public getEntry(fileName: string): HostFileInformation { + return lookUp(this.fileNameToEntry, normalizeSlashes(fileName)); + } + + public contains(fileName: string): boolean { + return hasProperty(this.fileNameToEntry, normalizeSlashes(fileName)); + } + + public getOrCreateEntry(fileName: string): HostFileInformation { + if (this.contains(fileName)) { + return this.getEntry(fileName); + } + + return this.createEntry(fileName); + } + + public getRootFileNames(): string[] { var fileNames: string[] = []; - forEachKey(this.filenameToEntry, key => { - if (hasProperty(this.filenameToEntry, key)) + forEachKey(this.fileNameToEntry, key => { + if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key]) fileNames.push(key); }); return fileNames; } - public getVersion(filename: string): string { - return this.getEntry(filename).version; + public getVersion(fileName: string): string { + var file = this.getEntry(fileName); + return file && file.version; } - public isOpen(filename: string): boolean { - return this.getEntry(filename).isOpen; + public getScriptSnapshot(fileName: string): IScriptSnapshot { + var file = this.getEntry(fileName); + return file && file.scriptSnapshot; } - public getScriptSnapshot(filename: string): IScriptSnapshot { - var file = this.getEntry(filename); - if (!file.sourceText) { - file.sourceText = this.host.getScriptSnapshot(file.filename); - } - return file.sourceText; - } - - public getChangeRange(filename: string, lastKnownVersion: string, oldScriptSnapshot: IScriptSnapshot): TextChangeRange { - var currentVersion = this.getVersion(filename); + public getChangeRange(fileName: string, lastKnownVersion: string, oldScriptSnapshot: IScriptSnapshot): TextChangeRange { + var currentVersion = this.getVersion(fileName); if (lastKnownVersion === currentVersion) { return unchangedTextChangeRange; // "No changes" } - var scriptSnapshot = this.getScriptSnapshot(filename); + var scriptSnapshot = this.getScriptSnapshot(fileName); return scriptSnapshot.getChangeRange(oldScriptSnapshot); } } @@ -1487,66 +1552,71 @@ module ts { // For our syntactic only features, we also keep a cache of the syntax tree for the // currently edited file. - private currentFilename: string = ""; + private currentFileName: string = ""; private currentFileVersion: string = null; private currentSourceFile: SourceFile = null; constructor(private host: LanguageServiceHost) { } - private initialize(filename: string) { + private log(message: string) { + if (this.host.log) { + this.host.log(message); + } + } + + private initialize(fileName: string) { // ensure that both source file and syntax tree are either initialized or not initialized var start = new Date().getTime(); this.hostCache = new HostCache(this.host); - this.host.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); + this.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); - var version = this.hostCache.getVersion(filename); + var version = this.hostCache.getVersion(fileName); var sourceFile: SourceFile; - if (this.currentFilename !== filename) { - var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); + if (this.currentFileName !== fileName) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); var start = new Date().getTime(); - sourceFile = createLanguageServiceSourceFile(filename, scriptSnapshot, ScriptTarget.Latest, version, /*isOpen*/ true, /*setNodeParents;*/ true); - this.host.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents:*/ true); + this.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); } else if (this.currentFileVersion !== version) { - var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); - var editRange = this.hostCache.getChangeRange(filename, this.currentFileVersion, this.currentSourceFile.scriptSnapshot); + var editRange = this.hostCache.getChangeRange(fileName, this.currentFileVersion, this.currentSourceFile.scriptSnapshot); var start = new Date().getTime(); - sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, /*isOpen*/ true, editRange); - this.host.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start)); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + this.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start)); } if (sourceFile) { // All done, ensure state is up to date this.currentFileVersion = version; - this.currentFilename = filename; + this.currentFileName = fileName; this.currentSourceFile = sourceFile; } } - public getCurrentSourceFile(filename: string): SourceFile { - this.initialize(filename); + public getCurrentSourceFile(fileName: string): SourceFile { + this.initialize(fileName); return this.currentSourceFile; } - public getCurrentScriptSnapshot(filename: string): IScriptSnapshot { - return this.getCurrentSourceFile(filename).scriptSnapshot; + public getCurrentScriptSnapshot(fileName: string): IScriptSnapshot { + return this.getCurrentSourceFile(fileName).scriptSnapshot; } } - function setSourceFileFields(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean) { + function setSourceFileFields(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string) { sourceFile.version = version; - sourceFile.isOpen = isOpen; sourceFile.scriptSnapshot = scriptSnapshot; - } + } - export function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, isOpen: boolean, setNodeParents: boolean): SourceFile { - var sourceFile = createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); - setSourceFileFields(sourceFile, scriptSnapshot, version, isOpen); + export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile { + var sourceFile = createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); + setSourceFileFields(sourceFile, scriptSnapshot, version); // after full parsing we can use table with interned strings as name table sourceFile.nameTable = sourceFile.identifiers; return sourceFile; @@ -1554,7 +1624,7 @@ module ts { export var disableIncrementalParsing = false; - export function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, isOpen: boolean, textChangeRange: TextChangeRange): SourceFile { + export function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile { if (textChangeRange && Debug.shouldAssert(AssertionLevel.Normal)) { var oldText = sourceFile.scriptSnapshot; var newText = scriptSnapshot; @@ -1575,11 +1645,11 @@ module ts { // If we were given a text change range, and our version or open-ness changed, then // incrementally parse this file. if (textChangeRange) { - if (version !== sourceFile.version || isOpen != sourceFile.isOpen) { + if (version !== sourceFile.version) { // Once incremental parsing is ready, then just call into this function. if (!disableIncrementalParsing) { - var newSourceFile = sourceFile.update(scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange); - setSourceFileFields(newSourceFile, scriptSnapshot, version, isOpen); + var newSourceFile = updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange); + setSourceFileFields(newSourceFile, scriptSnapshot, version); // after incremental parsing nameTable might not be up-to-date // drop it so it can be lazily recreated later newSourceFile.nameTable = undefined; @@ -1589,7 +1659,7 @@ module ts { } // Otherwise, just create a new source file. - return createLanguageServiceSourceFile(sourceFile.filename, scriptSnapshot, sourceFile.languageVersion, version, isOpen, /*setNodeParents:*/ true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); } export function createDocumentRegistry(): DocumentRegistry { @@ -1630,18 +1700,17 @@ module ts { } function acquireDocument( - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, - version: string, - isOpen: boolean): SourceFile { + version: string): SourceFile { var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); - var entry = lookUp(bucket, filename); + var entry = lookUp(bucket, fileName); if (!entry) { - var sourceFile = createLanguageServiceSourceFile(filename, scriptSnapshot, compilationSettings.target, version, isOpen, /*setNodeParents:*/ false); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); - bucket[filename] = entry = { + bucket[fileName] = entry = { sourceFile: sourceFile, refCount: 0, owners: [] @@ -1654,33 +1723,32 @@ module ts { function updateDocument( sourceFile: SourceFile, - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, - isOpen: boolean, textChangeRange: TextChangeRange ): SourceFile { var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ false); Debug.assert(bucket !== undefined); - var entry = lookUp(bucket, filename); + var entry = lookUp(bucket, fileName); Debug.assert(entry !== undefined); - entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, isOpen, textChangeRange); + entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, textChangeRange); return entry.sourceFile; } - function releaseDocument(filename: string, compilationSettings: CompilerOptions): void { + function releaseDocument(fileName: string, compilationSettings: CompilerOptions): void { var bucket = getBucketForCompilationSettings(compilationSettings, false); Debug.assert(bucket !== undefined); - var entry = lookUp(bucket, filename); + var entry = lookUp(bucket, fileName); entry.refCount--; Debug.assert(entry.refCount >= 0); if (entry.refCount === 0) { - delete bucket[filename]; + delete bucket[fileName]; } } @@ -1732,7 +1800,7 @@ module ts { var importPath = scanner.getTokenValue(); var pos = scanner.getTokenPos(); importedFiles.push({ - filename: importPath, + fileName: importPath, pos: pos, end: pos + importPath.length }); @@ -1867,7 +1935,7 @@ module ts { // The position has to be: 1. in the leading trivia (before token.getStart()), and 2. within a comment return position <= token.getStart(sourceFile) && (isInsideCommentRange(getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || - isInsideCommentRange(getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + isInsideCommentRange(getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments: CommentRange[]): boolean { return forEach(comments, comment => { @@ -1909,7 +1977,7 @@ module ts { } // A cache of completion entries for keywords, these do not change between sessions - var keywordCompletions:CompletionEntry[] = []; + var keywordCompletions: CompletionEntry[] = []; for (var i = SyntaxKind.FirstKeyword; i <= SyntaxKind.LastKeyword; i++) { keywordCompletions.push({ name: tokenToString(i), @@ -1918,18 +1986,14 @@ module ts { }); } - export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry): LanguageService { + export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService { var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider: formatting.RulesProvider; - var hostCache: HostCache; // A cache of all the information about the files on the host side. var program: Program; // this checker is used to answer all LS questions except errors var typeInfoResolver: TypeChecker; - - var useCaseSensitivefilenames = false; - var sourceFilesByName: Map = {}; - var documentRegistry = documentRegistry; + var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details @@ -1938,157 +2002,142 @@ module ts { localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); } - function getCanonicalFileName(filename: string) { - return useCaseSensitivefilenames ? filename : filename.toLowerCase(); + function log(message: string) { + if (host.log) { + host.log(message); + } } - function getSourceFile(filename: string): SourceFile { - return lookUp(sourceFilesByName, getCanonicalFileName(filename)); + function getCanonicalFileName(fileName: string) { + return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); } - function getDiagnosticsProducingTypeChecker() { - return program.getTypeChecker(/*produceDiagnostics:*/ true); + function getValidSourceFile(fileName: string): SourceFile { + var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); + if (!sourceFile) { + throw new Error("Could not find file: '" + fileName + "'."); + } + return sourceFile; } function getRuleProvider(options: FormatCodeOptions) { // Ensure rules are initialized and up to date wrt to formatting options if (!ruleProvider) { - ruleProvider = new formatting.RulesProvider(host); + ruleProvider = new formatting.RulesProvider(); } ruleProvider.ensureUpToDate(options); return ruleProvider; } - function createCompilerHost(): CompilerHost { - return { - getSourceFile: (filename, languageVersion) => { - var sourceFile = getSourceFile(filename); - return sourceFile && sourceFile.getSourceFile(); - }, - getCancellationToken: () => cancellationToken, - getCanonicalFileName: (filename) => useCaseSensitivefilenames ? filename : filename.toLowerCase(), - useCaseSensitiveFileNames: () => useCaseSensitivefilenames, - getNewLine: () => { - return host.getNewLine ? host.getNewLine() : "\r\n"; - }, - getDefaultLibFilename: (options): string => { - return host.getDefaultLibFilename(options); - }, - writeFile: (filename, data, writeByteOrderMark) => { - }, - getCurrentDirectory: (): string => { - return host.getCurrentDirectory(); - } - }; - } - - function sourceFileUpToDate(sourceFile: SourceFile): boolean { - return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.filename) && sourceFile.isOpen === hostCache.isOpen(sourceFile.filename); - } - - function programUpToDate(): boolean { - // If we haven't create a program yet, then it is not up-to-date - if (!program) { - return false; - } - - // If number of files in the program do not match, it is not up-to-date - var hostFilenames = hostCache.getFilenames(); - if (program.getSourceFiles().length !== hostFilenames.length) { - return false; - } - - // If any file is not up-to-date, then the whole program is not up-to-date - for (var i = 0, n = hostFilenames.length; i < n; i++) { - if (!sourceFileUpToDate(program.getSourceFile(hostFilenames[i]))) { - return false; - } - } - - // If the compilation settings do no match, then the program is not up-to-date - return compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); - } - function synchronizeHostData(): void { - // Reset the cache at start of every refresh - hostCache = new HostCache(host); + // Get a fresh cache of the host information + var hostCache = new HostCache(host); // If the program is already up-to-date, we can reuse it if (programUpToDate()) { return; } - var compilationSettings = hostCache.compilationSettings(); - - // Now, remove any files from the compiler that are no longer in the host. - var oldProgram = program; - if (oldProgram) { - var oldSettings = program.getCompilerOptions(); - // If the language version changed, then that affects what types of things we parse. So - // we have to dump all syntax trees. - // TODO: handle propagateEnumConstants - // TODO: is module still needed - var settingsChangeAffectsSyntax = oldSettings.target !== compilationSettings.target || oldSettings.module !== compilationSettings.module; - - var changesInCompilationSettingsAffectSyntax = - oldSettings && compilationSettings && !compareDataObjects(oldSettings, compilationSettings) && settingsChangeAffectsSyntax; - var oldSourceFiles = program.getSourceFiles(); - - for (var i = 0, n = oldSourceFiles.length; i < n; i++) { - cancellationToken.throwIfCancellationRequested(); - var filename = oldSourceFiles[i].filename; - if (!hostCache.contains(filename) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(filename, oldSettings); - delete sourceFilesByName[getCanonicalFileName(filename)]; - } - } - } - - // Now, for every file the host knows about, either add the file (if the compiler - // doesn't know about it.). Or notify the compiler about any changes (if it does - // know about it.) - var hostfilenames = hostCache.getFilenames(); - for (var i = 0, n = hostfilenames.length; i < n; i++) { - var filename = hostfilenames[i]; - - var version = hostCache.getVersion(filename); - var isOpen = hostCache.isOpen(filename); - var scriptSnapshot = hostCache.getScriptSnapshot(filename); - - var sourceFile: SourceFile = getSourceFile(filename); - if (sourceFile) { - // - // If the sourceFile is the same, assume no update - // - if (sourceFileUpToDate(sourceFile)) { - continue; - } - - // Only perform incremental parsing on open files that are being edited. If a file was - // open, but is now closed, we want to re-parse entirely so we don't have any tokens that - // are holding onto expensive script snapshot instances on the host. Similarly, if a - // file was closed, then we always want to re-parse. This is so our tree doesn't keep - // the old buffer alive that represented the file on disk (as the host has moved to a - // new text buffer). - var textChangeRange: TextChangeRange = null; - if (sourceFile.isOpen && isOpen) { - textChangeRange = hostCache.getChangeRange(filename, sourceFile.version, sourceFile.scriptSnapshot); - } - - sourceFile = documentRegistry.updateDocument(sourceFile, filename, compilationSettings, scriptSnapshot, version, isOpen, textChangeRange); - } - else { - sourceFile = documentRegistry.acquireDocument(filename, compilationSettings, scriptSnapshot, version, isOpen); - } - - // Remember the new sourceFile - sourceFilesByName[getCanonicalFileName(filename)] = sourceFile; - } + var oldSettings = program && program.getCompilerOptions(); + var newSettings = hostCache.compilationSettings(); + var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; // Now create a new compiler - program = createProgram(hostfilenames, compilationSettings, createCompilerHost()); - typeInfoResolver = program.getTypeChecker(/*produceDiagnostics*/ false); + var newProgram = createProgram(hostCache.getRootFileNames(), newSettings, { + getSourceFile: getOrCreateSourceFile, + getCancellationToken: () => cancellationToken, + getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(), + useCaseSensitiveFileNames: () => useCaseSensitivefileNames, + getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n", + getDefaultLibFileName: (options) => host.getDefaultLibFileName(options), + writeFile: (fileName, data, writeByteOrderMark) => { }, + getCurrentDirectory: () => host.getCurrentDirectory() + }); + + // Release any files we have acquired in the old program but are + // not part of the new program. + if (program) { + var oldSourceFiles = program.getSourceFiles(); + for (var i = 0, n = oldSourceFiles.length; i < n; i++) { + var fileName = oldSourceFiles[i].fileName; + if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocument(fileName, oldSettings); + } + } + } + + program = newProgram; + typeInfoResolver = program.getTypeChecker(); + + return; + + function getOrCreateSourceFile(fileName: string): SourceFile { + cancellationToken.throwIfCancellationRequested(); + + // 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. + var hostFileInformation = hostCache.getOrCreateEntry(fileName); + if (!hostFileInformation) { + return undefined; + } + + // Check if the language version has changed since we last created a program; if they are the same, + // it is safe to reuse the souceFiles; if not, then the shape of the AST can change, and the oldSourceFile + // can not be reused. we have to dump all syntax trees and create new ones. + if (!changesInCompilationSettingsAffectSyntax) { + + // Check if the old program had this file already + var oldSourceFile = program && program.getSourceFile(fileName); + if (oldSourceFile) { + // This SourceFile is safe to reuse, return it + if (sourceFileUpToDate(oldSourceFile)) { + return oldSourceFile; + } + + // We have an older version of the sourceFile, incrementally parse the changes + var textChangeRange = hostCache.getChangeRange(fileName, oldSourceFile.version, oldSourceFile.scriptSnapshot); + return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange); + } + } + + // Could not find this file in the old program, create a new SourceFile for it. + return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + } + + function sourceFileUpToDate(sourceFile: SourceFile): boolean { + return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.fileName); + } + + function programUpToDate(): boolean { + // If we haven't create a program yet, then it is not up-to-date + if (!program) { + return false; + } + + // If number of files in the program do not match, it is not up-to-date + var rootFileNames = hostCache.getRootFileNames(); + if (program.getSourceFiles().length !== rootFileNames.length) { + return false; + } + + // If any file is not up-to-date, then the whole program is not up-to-date + for (var i = 0, n = rootFileNames.length; i < n; i++) { + if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { + return false; + } + } + + // If the compilation settings do no match, then the program is not up-to-date + return compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); + } + } + + function getProgram(): Program { + synchronizeHostData(); + + return program; } /** @@ -2098,47 +2147,47 @@ module ts { */ function cleanupSemanticCache(): void { if (program) { - typeInfoResolver = program.getTypeChecker(/*produceDiagnostics*/ false); + typeInfoResolver = program.getTypeChecker(); } } function dispose(): void { if (program) { forEach(program.getSourceFiles(), - (f) => { documentRegistry.releaseDocument(f.filename, program.getCompilerOptions()); }); + (f) => { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); }); } } /// Diagnostics - function getSyntacticDiagnostics(filename: string) { + function getSyntacticDiagnostics(fileName: string) { synchronizeHostData(); - filename = normalizeSlashes(filename); + fileName = normalizeSlashes(fileName); - return program.getDiagnostics(getSourceFile(filename)); + return program.getSyntacticDiagnostics(getValidSourceFile(fileName)); } /** * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ - function getSemanticDiagnostics(filename: string) { + function getSemanticDiagnostics(fileName: string) { synchronizeHostData(); - filename = normalizeSlashes(filename) - var compilerOptions = program.getCompilerOptions(); - var checker = getDiagnosticsProducingTypeChecker(); - var targetSourceFile = getSourceFile(filename); + fileName = normalizeSlashes(fileName) + var targetSourceFile = getValidSourceFile(fileName); // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. - var allDiagnostics = checker.getDiagnostics(targetSourceFile); - if (compilerOptions.declaration) { - // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface - allDiagnostics = allDiagnostics.concat(program.getDeclarationDiagnostics(targetSourceFile)); + var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile); + if (!program.getCompilerOptions().declaration) { + return semanticDiagnostics; } - return allDiagnostics + + // If '-d' is enabled, check for emitter error. One example of emitter error is export class implements non-export interface + var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile); + return semanticDiagnostics.concat(declarationDiagnostics); } function getCompilerOptionsDiagnostics() { @@ -2199,25 +2248,25 @@ module ts { }; } - function getCompletionsAtPosition(filename: string, position: number) { + function getCompletionsAtPosition(fileName: string, position: number) { synchronizeHostData(); - filename = normalizeSlashes(filename); + fileName = normalizeSlashes(fileName); var syntacticStart = new Date().getTime(); - var sourceFile = getSourceFile(filename); + var sourceFile = getValidSourceFile(fileName); var start = new Date().getTime(); var currentToken = getTokenAtPosition(sourceFile, position); - host.log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); var start = new Date().getTime(); // Completion not allowed inside comments, bail out if this is the case var insideComment = isInsideComment(sourceFile, currentToken, position); - host.log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { - host.log("Returning an empty list because completion was inside a comment."); + log("Returning an empty list because completion was inside a comment."); return undefined; } @@ -2225,19 +2274,19 @@ module ts { // Note: previousToken can be undefined if we are the beginning of the file var start = new Date().getTime(); var previousToken = findPrecedingToken(position, sourceFile); - host.log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); // The caret is at the end of an identifier; this is a partial identifier that we want to complete: e.g. a.toS| // Skip this partial identifier to the previous token if (previousToken && position <= previousToken.end && previousToken.kind === SyntaxKind.Identifier) { var start = new Date().getTime(); previousToken = findPrecedingToken(previousToken.pos, sourceFile); - host.log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); } // Check if this is a valid completion location if (previousToken && isCompletionListBlocker(previousToken)) { - host.log("Returning an empty list because completion was requested in an invalid position."); + log("Returning an empty list because completion was requested in an invalid position."); return undefined; } @@ -2260,13 +2309,13 @@ module ts { // Clear the current activeCompletionSession for this session activeCompletionSession = { - filename: filename, + fileName: fileName, position: position, entries: [], symbols: {}, typeChecker: typeInfoResolver }; - host.log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); + log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); var location = getTouchingPropertyName(sourceFile, position); // Populate the completion list @@ -2275,6 +2324,7 @@ module ts { // Right of dot member completion list var symbols: Symbol[] = []; var isMemberCompletion = true; + var isNewIdentifierLocation = false; if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression) { var symbol = typeInfoResolver.getSymbolAtLocation(node); @@ -2311,6 +2361,7 @@ module ts { if (containingObjectLiteral) { // Object literal expression, look up possible property names from contextual type isMemberCompletion = true; + isNewIdentifierLocation = true; var contextualType = typeInfoResolver.getContextualType(containingObjectLiteral); if (!contextualType) { @@ -2327,6 +2378,7 @@ module ts { else { // Get scope members isMemberCompletion = false; + isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken); /// TODO filter meaning based on the current context var symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Import; @@ -2340,10 +2392,12 @@ module ts { if (!isMemberCompletion) { Array.prototype.push.apply(activeCompletionSession.entries, keywordCompletions); } - host.log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); + log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); return { isMemberCompletion, + isNewIdentifierLocation, + isBuilder : isNewIdentifierDefinitionLocation, // temporary property used to match VS implementation entries: activeCompletionSession.entries }; @@ -2359,7 +2413,7 @@ module ts { } } }); - host.log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); } function isCompletionListBlocker(previousToken: Node): boolean { @@ -2367,10 +2421,68 @@ module ts { var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); - host.log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } + function isNewIdentifierDefinitionLocation(previousToken: Node): boolean { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case SyntaxKind.CommaToken: + return containingNodeKind === SyntaxKind.CallExpression // func( a, | + || containingNodeKind === SyntaxKind.Constructor // constructor( a, | public, protected, private keywords are allowed here, so show completion + || containingNodeKind === SyntaxKind.NewExpression // new C(a, | + || containingNodeKind === SyntaxKind.ArrayLiteralExpression // [a, | + || containingNodeKind === SyntaxKind.BinaryExpression; // var x = (a, | + + + case SyntaxKind.OpenParenToken: + return containingNodeKind === SyntaxKind.CallExpression // func( | + || containingNodeKind === SyntaxKind.Constructor // constructor( | + || containingNodeKind === SyntaxKind.NewExpression // new C(a| + || containingNodeKind === SyntaxKind.ParenthesizedExpression; // var x = (a| + + case SyntaxKind.OpenBracketToken: + return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ | + + case SyntaxKind.ModuleKeyword: // module | + return true; + + case SyntaxKind.DotToken: + return containingNodeKind === SyntaxKind.ModuleDeclaration; // module A.| + + case SyntaxKind.OpenBraceToken: + return containingNodeKind === SyntaxKind.ClassDeclaration; // class A{ | + + case SyntaxKind.EqualsToken: + return containingNodeKind === SyntaxKind.VariableDeclaration // var x = a| + || containingNodeKind === SyntaxKind.BinaryExpression; // x = a| + + case SyntaxKind.TemplateHead: + return containingNodeKind === SyntaxKind.TemplateExpression; // `aa ${| + + case SyntaxKind.TemplateMiddle: + return containingNodeKind === SyntaxKind.TemplateSpan; // `aa ${10} dd ${| + + case SyntaxKind.PublicKeyword: + case SyntaxKind.PrivateKeyword: + case SyntaxKind.ProtectedKeyword: + return containingNodeKind === SyntaxKind.PropertyDeclaration; // class A{ public | + } + + // Previous token may have been a keyword that was converted to an identifier. + switch (previousToken.getText()) { + case "public": + case "protected": + case "private": + return true; + } + } + + return false; + } + function isInStringOrRegularExpressionOrTemplateLiteral(previousToken: Node): boolean { if (previousToken.kind === SyntaxKind.StringLiteral || previousToken.kind === SyntaxKind.RegularExpressionLiteral @@ -2417,7 +2529,6 @@ module ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.CallSignature: @@ -2437,28 +2548,54 @@ module ts { containingNodeKind === SyntaxKind.VariableDeclarationList || containingNodeKind === SyntaxKind.VariableStatement || containingNodeKind === SyntaxKind.EnumDeclaration || // enum a { foo, | - isFunction(containingNodeKind); + isFunction(containingNodeKind) || + containingNodeKind === SyntaxKind.ClassDeclaration || // class Adeclaration); + var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(spacePart()); displayParts.push(operatorPart(SyntaxKind.EqualsToken)); @@ -3050,7 +3192,7 @@ module ts { synchronizeHostData(); fileName = normalizeSlashes(fileName); - var sourceFile = getSourceFile(fileName); + var sourceFile = getValidSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); if (!node) { return undefined; @@ -3092,11 +3234,11 @@ module ts { } /// Goto definition - function getDefinitionAtPosition(filename: string, position: number): DefinitionInfo[] { + function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { synchronizeHostData(); - filename = normalizeSlashes(filename); - var sourceFile = getSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); if (!node) { @@ -3116,10 +3258,10 @@ module ts { var referenceFile = tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { return [{ - fileName: referenceFile.filename, + fileName: referenceFile.fileName, textSpan: createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, - name: comment.filename, + name: comment.fileName, containerName: undefined, containerKind: undefined }]; @@ -3172,7 +3314,7 @@ module ts { function getDefinitionInfo(node: Node, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo { return { - fileName: node.getSourceFile().filename, + fileName: node.getSourceFile().fileName, textSpan: createTextSpanFromBounds(node.getStart(), node.getEnd()), kind: symbolKind, name: symbolName, @@ -3228,11 +3370,11 @@ module ts { } /// References and Occurrences - function getOccurrencesAtPosition(filename: string, position: number): ReferenceEntry[] { + function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { synchronizeHostData(); - filename = normalizeSlashes(filename); - var sourceFile = getSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); var node = getTouchingWord(sourceFile, position); if (!node) { @@ -3367,7 +3509,7 @@ module ts { if (shouldHighlightNextKeyword) { result.push({ - fileName: filename, + fileName: fileName, textSpan: createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), isWriteAccess: false }); @@ -3777,7 +3919,7 @@ module ts { synchronizeHostData(); fileName = normalizeSlashes(fileName); - var sourceFile = getSourceFile(fileName); + var sourceFile = getValidSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); if (!node) { @@ -3943,7 +4085,8 @@ module ts { } // if this symbol is visible from its parent container, e.g. exported, then bail out - if (symbol.parent) { + // if symbol correspond to the union property - bail out + if (symbol.parent || (symbol.getFlags() & SymbolFlags.UnionProperty)) { return undefined; } @@ -4094,7 +4237,7 @@ module ts { if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { result.push({ - fileName: sourceFile.filename, + fileName: sourceFile.fileName, textSpan: createTextSpan(position, searchText.length), isWriteAccess: false }); @@ -4154,7 +4297,7 @@ module ts { } function getReferencesForSuperKeyword(superKeyword: Node): ReferenceEntry[] { - var searchSpaceNode = getSuperContainer(superKeyword); + var searchSpaceNode = getSuperContainer(superKeyword, /*includeFunctions*/ false); if (!searchSpaceNode) { return undefined; } @@ -4189,7 +4332,7 @@ module ts { return; } - var container = getSuperContainer(node); + var container = getSuperContainer(node, /*includeFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space @@ -4231,6 +4374,8 @@ module ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.FunctionExpression: break; + // Computed properties in classes are not handled here because references to this are illegal, + // so there is no point finding references to them. default: return undefined; } @@ -4477,7 +4622,7 @@ module ts { } return { - fileName: node.getSourceFile().filename, + fileName: node.getSourceFile().fileName, textSpan: createTextSpanFromBounds(start, end), isWriteAccess: isWriteAccess(node) }; @@ -4519,7 +4664,7 @@ module ts { forEach(program.getSourceFiles(), sourceFile => { cancellationToken.throwIfCancellationRequested(); - var filename = sourceFile.filename; + var fileName = sourceFile.fileName; var declarations = sourceFile.getNamedDeclarations(); for (var i = 0, n = declarations.length; i < n; i++) { var declaration = declarations[i]; @@ -4533,7 +4678,7 @@ module ts { kind: getNodeKind(declaration), kindModifiers: getNodeModifiers(declaration), matchKind: MatchKind[matchKind], - fileName: filename, + fileName: fileName, textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), // TODO(jfreeman): What should be the containerName when the container has a computed name? containerName: container && container.name ? (container.name).text : "", @@ -4593,32 +4738,27 @@ module ts { return forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); } - function getEmitOutput(filename: string): EmitOutput { + function getEmitOutput(fileName: string): EmitOutput { synchronizeHostData(); - filename = normalizeSlashes(filename); - var sourceFile = getSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); var outputFiles: OutputFile[] = []; - function writeFile(filename: string, data: string, writeByteOrderMark: boolean) { + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { outputFiles.push({ - name: filename, + name: fileName, writeByteOrderMark: writeByteOrderMark, text: data }); } - // Get an emit host from our program, but override the writeFile functionality to - // call our local writer function. - var emitHost = createEmitHostFromProgram(program); - emitHost.writeFile = writeFile; - - var emitOutput = emitFiles(getDiagnosticsProducingTypeChecker().getEmitResolver(), emitHost, sourceFile); + var emitOutput = program.emit(sourceFile, writeFile); return { outputFiles, - emitOutputStatus: emitOutput.emitResultStatus + emitSkipped: emitOutput.emitSkipped }; } @@ -4746,22 +4886,22 @@ module ts { synchronizeHostData(); fileName = normalizeSlashes(fileName); - var sourceFile = getSourceFile(fileName); + var sourceFile = getValidSourceFile(fileName); return SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); } /// Syntactic features - function getCurrentSourceFile(filename: string): SourceFile { - filename = normalizeSlashes(filename); - var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(filename); + function getCurrentSourceFile(fileName: string): SourceFile { + fileName = normalizeSlashes(fileName); + var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return currentSourceFile; } - function getNameOrDottedNameSpan(filename: string, startPos: number, endPos: number): TextSpan { - filename = ts.normalizeSlashes(filename); + function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { + fileName = ts.normalizeSlashes(fileName); // Get node at the location - var node = getTouchingPropertyName(getCurrentSourceFile(filename), startPos); + var node = getTouchingPropertyName(getCurrentSourceFile(fileName), startPos); if (!node) { return; @@ -4813,23 +4953,23 @@ module ts { return createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); } - function getBreakpointStatementAtPosition(filename: string, position: number) { + function getBreakpointStatementAtPosition(fileName: string, position: number) { // doesn't use compiler - no need to synchronize with host - filename = ts.normalizeSlashes(filename); - return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(filename), position); + fileName = ts.normalizeSlashes(fileName); + return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(fileName), position); } - function getNavigationBarItems(filename: string): NavigationBarItem[] { - filename = normalizeSlashes(filename); + function getNavigationBarItems(fileName: string): NavigationBarItem[] { + fileName = normalizeSlashes(fileName); - return NavigationBar.getNavigationBarItems(getCurrentSourceFile(filename)); + return NavigationBar.getNavigationBarItems(getCurrentSourceFile(fileName)); } function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { synchronizeHostData(); fileName = normalizeSlashes(fileName); - var sourceFile = getSourceFile(fileName); + var sourceFile = getValidSourceFile(fileName); var result: ClassifiedSpan[] = []; processNode(sourceFile); @@ -5118,15 +5258,15 @@ module ts { } } - function getOutliningSpans(filename: string): OutliningSpan[] { + function getOutliningSpans(fileName: string): OutliningSpan[] { // doesn't use compiler - no need to synchronize with host - filename = normalizeSlashes(filename); - var sourceFile = getCurrentSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); return OutliningElementsCollector.collectElements(sourceFile); } - function getBraceMatchingAtPosition(filename: string, position: number) { - var sourceFile = getCurrentSourceFile(filename); + function getBraceMatchingAtPosition(fileName: string, position: number) { + var sourceFile = getCurrentSourceFile(fileName); var result: TextSpan[] = []; var token = getTouchingToken(sourceFile, position); @@ -5139,7 +5279,7 @@ module ts { var parentElement = token.parent; var childNodes = parentElement.getChildren(sourceFile); - for (var i = 0, n = childNodes.length; i < n; i++) {33 + for (var i = 0, n = childNodes.length; i < n; i++) { var current = childNodes[i]; if (current.kind === matchKind) { @@ -5164,31 +5304,31 @@ module ts { function getMatchingTokenKind(token: Node): ts.SyntaxKind { switch (token.kind) { - case ts.SyntaxKind.OpenBraceToken: return ts.SyntaxKind.CloseBraceToken - case ts.SyntaxKind.OpenParenToken: return ts.SyntaxKind.CloseParenToken; - case ts.SyntaxKind.OpenBracketToken: return ts.SyntaxKind.CloseBracketToken; - case ts.SyntaxKind.LessThanToken: return ts.SyntaxKind.GreaterThanToken; - case ts.SyntaxKind.CloseBraceToken: return ts.SyntaxKind.OpenBraceToken - case ts.SyntaxKind.CloseParenToken: return ts.SyntaxKind.OpenParenToken; - case ts.SyntaxKind.CloseBracketToken: return ts.SyntaxKind.OpenBracketToken; - case ts.SyntaxKind.GreaterThanToken: return ts.SyntaxKind.LessThanToken; + case ts.SyntaxKind.OpenBraceToken: return ts.SyntaxKind.CloseBraceToken + case ts.SyntaxKind.OpenParenToken: return ts.SyntaxKind.CloseParenToken; + case ts.SyntaxKind.OpenBracketToken: return ts.SyntaxKind.CloseBracketToken; + case ts.SyntaxKind.LessThanToken: return ts.SyntaxKind.GreaterThanToken; + case ts.SyntaxKind.CloseBraceToken: return ts.SyntaxKind.OpenBraceToken + case ts.SyntaxKind.CloseParenToken: return ts.SyntaxKind.OpenParenToken; + case ts.SyntaxKind.CloseBracketToken: return ts.SyntaxKind.OpenBracketToken; + case ts.SyntaxKind.GreaterThanToken: return ts.SyntaxKind.LessThanToken; } return undefined; } } - function getIndentationAtPosition(filename: string, position: number, editorOptions: EditorOptions) { - filename = normalizeSlashes(filename); + function getIndentationAtPosition(fileName: string, position: number, editorOptions: EditorOptions) { + fileName = normalizeSlashes(fileName); var start = new Date().getTime(); - var sourceFile = getCurrentSourceFile(filename); - host.log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); + var sourceFile = getCurrentSourceFile(fileName); + log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); var start = new Date().getTime(); var result = formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); - host.log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); + log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); return result; } @@ -5224,7 +5364,7 @@ module ts { return []; } - function getTodoComments(filename: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { + function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call // this on every single file. If we treat this syntactically, then that will cause @@ -5233,9 +5373,9 @@ module ts { // anything away. synchronizeHostData(); - filename = normalizeSlashes(filename); + fileName = normalizeSlashes(fileName); - var sourceFile = getSourceFile(filename); + var sourceFile = getValidSourceFile(fileName); cancellationToken.throwIfCancellationRequested(); @@ -5381,7 +5521,7 @@ module ts { synchronizeHostData(); fileName = normalizeSlashes(fileName); - var sourceFile = getSourceFile(fileName); + var sourceFile = getValidSourceFile(fileName); var node = getTouchingWord(sourceFile, position); @@ -5390,22 +5530,44 @@ module ts { var symbol = typeInfoResolver.getSymbolAtLocation(node); // Only allow a symbol to be renamed if it actually has at least one declaration. - if (symbol && symbol.getDeclarations() && symbol.getDeclarations().length > 0) { - var kind = getSymbolKind(symbol, typeInfoResolver, node); - if (kind) { - return getRenameInfo(symbol.name, typeInfoResolver.getFullyQualifiedName(symbol), kind, - getSymbolModifiers(symbol), - createTextSpan(node.getStart(), node.getWidth())); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + // Disallow rename for elements that are defined in the standard TypeScript library. + var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings()); + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) { + return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } + } + + var kind = getSymbolKind(symbol, typeInfoResolver, node); + if (kind) { + return { + canRename: true, + localizedErrorMessage: undefined, + displayName: symbol.name, + fullDisplayName: typeInfoResolver.getFullyQualifiedName(symbol), + kind: kind, + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: createTextSpan(node.getStart(), node.getWidth()) + }; + } } } } return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)); + function endsWith(string: string, value: string): boolean { + return string.lastIndexOf(value) + value.length === string.length; + } + function getRenameInfoError(localizedErrorMessage: string): RenameInfo { return { canRename: false, - localizedErrorMessage: getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key), + localizedErrorMessage: localizedErrorMessage, displayName: undefined, fullDisplayName: undefined, kind: undefined, @@ -5413,18 +5575,6 @@ module ts { triggerSpan: undefined }; } - - function getRenameInfo(displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: TextSpan): RenameInfo { - return { - canRename: true, - localizedErrorMessage: undefined, - displayName, - fullDisplayName, - kind, - kindModifiers, - triggerSpan - }; - } } return { @@ -5457,11 +5607,12 @@ module ts { getFormattingEditsAfterKeystroke, getEmitOutput, getSourceFile: getCurrentSourceFile, + getProgram }; } /// Classifier - export function createClassifier(host: Logger): Classifier { + export function createClassifier(): Classifier { var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false); /// We do not have a full parser support to know when we should parse a regex or not @@ -5575,41 +5726,41 @@ module ts { if (!isTrivia(token)) { if ((token === SyntaxKind.SlashToken || token === SyntaxKind.SlashEqualsToken) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === SyntaxKind.RegularExpressionLiteral) { - token = SyntaxKind.RegularExpressionLiteral; - } + if (scanner.reScanSlashToken() === SyntaxKind.RegularExpressionLiteral) { + token = SyntaxKind.RegularExpressionLiteral; + } } else if (lastNonTriviaToken === SyntaxKind.DotToken && isKeyword(token)) { - token = SyntaxKind.Identifier; + token = SyntaxKind.Identifier; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - // We have two keywords in a row. Only treat the second as a keyword if - // it's a sequence that could legally occur in the language. Otherwise - // treat it as an identifier. This way, if someone writes "private var" - // we recognize that 'var' is actually an identifier here. - token = SyntaxKind.Identifier; + // We have two keywords in a row. Only treat the second as a keyword if + // it's a sequence that could legally occur in the language. Otherwise + // treat it as an identifier. This way, if someone writes "private var" + // we recognize that 'var' is actually an identifier here. + token = SyntaxKind.Identifier; } else if (lastNonTriviaToken === SyntaxKind.Identifier && token === SyntaxKind.LessThanToken) { - // Could be the start of something generic. Keep track of that by bumping - // up the current count of generic contexts we may be in. - angleBracketStack++; + // Could be the start of something generic. Keep track of that by bumping + // up the current count of generic contexts we may be in. + angleBracketStack++; } else if (token === SyntaxKind.GreaterThanToken && angleBracketStack > 0) { - // If we think we're currently in something generic, then mark that that - // generic entity is complete. - angleBracketStack--; + // If we think we're currently in something generic, then mark that that + // generic entity is complete. + angleBracketStack--; } else if (token === SyntaxKind.AnyKeyword || token === SyntaxKind.StringKeyword || token === SyntaxKind.NumberKeyword || token === SyntaxKind.BooleanKeyword) { - if (angleBracketStack > 0 && !classifyKeywordsInGenerics) { - // If it looks like we're could be in something generic, don't classify this - // as a keyword. We may just get overwritten by the syntactic classifier, - // causing a noisy experience for the user. - token = SyntaxKind.Identifier; - } + if (angleBracketStack > 0 && !classifyKeywordsInGenerics) { + // If it looks like we're could be in something generic, don't classify this + // as a keyword. We may just get overwritten by the syntactic classifier, + // causing a noisy experience for the user. + token = SyntaxKind.Identifier; + } } lastNonTriviaToken = token; @@ -5764,6 +5915,23 @@ module ts { return { getClassificationsForLine }; } + /// getDefaultLibraryFilePath + declare var __dirname: string; + + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + export function getDefaultLibFilePath(options: CompilerOptions): string { + // Check __dirname is defined and that we are on a node.js system. + if (typeof __dirname !== "undefined") { + return __dirname + directorySeparator + getDefaultLibFileName(options); + } + + throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); + } + function initializeServices() { objectAllocator = { getNodeConstructor: kind => { diff --git a/src/services/shims.ts b/src/services/shims.ts index 3841d397a39..5b5216813fe 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -25,9 +25,6 @@ module ts { /** Gets the length of this script snapshot. */ getLength(): number; - /** This call returns the JSON-encoded array of the type: number[] */ - getLineStartPositions(): string; - /** * Returns a JSON-encoded value of the type: * { span: { start: number; length: number }; newLength: number } @@ -37,6 +34,12 @@ module ts { getChangeRange(oldSnapshot: ScriptSnapshotShim): string; } + export interface Logger { + log(s: string): void; + trace(s: string): void; + error(s: string): void; + } + /** Public interface of the host of a language service shim instance.*/ export interface LanguageServiceShimHost extends Logger { getCompilationSettings(): string; @@ -44,12 +47,12 @@ module ts { /** Returns a JSON-encoded value of the type: string[] */ getScriptFileNames(): string; getScriptVersion(fileName: string): string; - getScriptIsOpen(fileName: string): boolean; getScriptSnapshot(fileName: string): ScriptSnapshotShim; getLocalizedDiagnosticMessages(): string; getCancellationToken(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: string): string; + getDefaultLibFileName(options: string): string; + getNewLine?(): string; } /// @@ -187,14 +190,6 @@ module ts { return this.scriptSnapshotShim.getLength(); } - public getLineStartPositions(): number[] { - if (this.lineStartPositions == null) { - this.lineStartPositions = JSON.parse(this.scriptSnapshotShim.getLineStartPositions()); - } - - return this.lineStartPositions; - } - public getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange { var oldSnapshotShim = oldSnapshot; var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); @@ -239,17 +234,14 @@ module ts { } public getScriptSnapshot(fileName: string): IScriptSnapshot { - return new ScriptSnapshotShimAdapter(this.shimHost.getScriptSnapshot(fileName)); + var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); + return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); } public getScriptVersion(fileName: string): string { return this.shimHost.getScriptVersion(fileName); } - public getScriptIsOpen(fileName: string): boolean { - return this.shimHost.getScriptIsOpen(fileName); - } - public getLocalizedDiagnosticMessages(): any { var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { @@ -269,13 +261,13 @@ module ts { return this.shimHost.getCancellationToken(); } - public getDefaultLibFilename(options: CompilerOptions): string { - return this.shimHost.getDefaultLibFilename(JSON.stringify(options)); - } - public getCurrentDirectory(): string { return this.shimHost.getCurrentDirectory(); } + + public getDefaultLibFileName(options: CompilerOptions): string { + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + } } function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any): any { @@ -376,9 +368,14 @@ module ts { }); } - private static realizeDiagnostic(diagnostic: Diagnostic): { message: string; start: number; length: number; category: string; } { + private realizeDiagnostics(diagnostics: Diagnostic[]): { message: string; start: number; length: number; category: string; }[]{ + var newLine = this.getNewLine(); + return diagnostics.map(d => this.realizeDiagnostic(d, newLine)); + } + + private realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; } { return { - message: diagnostic.messageText, + message: flattenDiagnosticMessageText(diagnostic.messageText, newLine), start: diagnostic.start, length: diagnostic.length, /// TODO: no need for the tolowerCase call @@ -405,12 +402,16 @@ module ts { }); } + private getNewLine(): string { + return this.host.getNewLine ? this.host.getNewLine() : "\r\n"; + } + public getSyntacticDiagnostics(fileName: string): string { return this.forwardJSONCall( "getSyntacticDiagnostics('" + fileName + "')", () => { - var errors = this.languageService.getSyntacticDiagnostics(fileName); - return errors.map(LanguageServiceShimObject.realizeDiagnostic); + var diagnostics = this.languageService.getSyntacticDiagnostics(fileName); + return this.realizeDiagnostics(diagnostics); }); } @@ -418,8 +419,8 @@ module ts { return this.forwardJSONCall( "getSemanticDiagnostics('" + fileName + "')", () => { - var errors = this.languageService.getSemanticDiagnostics(fileName); - return errors.map(LanguageServiceShimObject.realizeDiagnostic); + var diagnostics = this.languageService.getSemanticDiagnostics(fileName); + return this.realizeDiagnostics(diagnostics); }); } @@ -427,8 +428,8 @@ module ts { return this.forwardJSONCall( "getCompilerOptionsDiagnostics()", () => { - var errors = this.languageService.getCompilerOptionsDiagnostics(); - return errors.map(LanguageServiceShimObject.realizeDiagnostic) + var diagnostics = this.languageService.getCompilerOptionsDiagnostics(); + return this.realizeDiagnostics(diagnostics); }); } @@ -669,9 +670,9 @@ module ts { class ClassifierShimObject extends ShimBase implements ClassifierShim { public classifier: Classifier; - constructor(factory: ShimFactory, public logger: Logger) { + constructor(factory: ShimFactory) { super(factory); - this.classifier = createClassifier(this.logger); + this.classifier = createClassifier(); } /// COLORIZATION @@ -710,7 +711,7 @@ module ts { forEach(result.referencedFiles, refFile => { convertResult.referencedFiles.push({ - path: normalizePath(refFile.filename), + path: normalizePath(refFile.fileName), position: refFile.pos, length: refFile.end - refFile.pos }); @@ -718,7 +719,7 @@ module ts { forEach(result.importedFiles, importedFile => { convertResult.importedFiles.push({ - path: normalizeSlashes(importedFile.filename), + path: normalizeSlashes(importedFile.fileName), position: importedFile.pos, length: importedFile.end - importedFile.pos }); @@ -761,7 +762,7 @@ module ts { public createClassifierShim(logger: Logger): ClassifierShim { try { - return new ClassifierShimObject(this, logger); + return new ClassifierShimObject(this); } catch (err) { logInternalError(logger, err); diff --git a/src/services/syntax/SyntaxGenerator.d.ts b/src/services/syntax/SyntaxGenerator.d.ts index d01d227b786..783ecb436ed 100644 --- a/src/services/syntax/SyntaxGenerator.d.ts +++ b/src/services/syntax/SyntaxGenerator.d.ts @@ -383,19 +383,13 @@ declare module TypeScript { Option_0_specified_without_1: string; codepage_option_not_supported_on_current_platform: string; Concatenate_and_emit_output_to_single_file: string; - Generates_corresponding_0_file: string; Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: string; Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: string; Watch_input_files: string; Redirect_output_structure_to_the_directory: string; Do_not_emit_comments_to_output: string; - Skip_resolution_and_preprocessing: string; - Specify_ECMAScript_target_version_0_default_or_1: string; - Specify_module_code_generation_0_or_1: string; Print_this_message: string; - Print_the_compiler_s_version_0: string; Allow_use_of_deprecated_0_keyword_when_referencing_an_external_module: string; - Specify_locale_for_errors_and_messages_For_example_0_or_1: string; Syntax_0: string; options: string; file1: string; @@ -412,7 +406,6 @@ declare module TypeScript { LOCATION: string; DIRECTORY: string; NUMBER: string; - Specify_the_codepage_to_use_when_opening_source_files: string; Additional_locations: string; This_version_of_the_Javascript_runtime_does_not_support_the_0_function: string; Unknown_rule: string; diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js new file mode 100644 index 00000000000..6840f079972 --- /dev/null +++ b/tests/baselines/reference/APISample_compile.js @@ -0,0 +1,1937 @@ +//// [tests/cases/compiler/APISample_compile.ts] //// + +//// [APISample_compile.ts] + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +declare var console: any; +declare var os: any; + +import ts = require("typescript"); + +export function compile(fileNames: string[], options: ts.CompilerOptions): void { + var program = ts.createProgram(fileNames, options); + var emitResult = program.emit(); + + var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); + + allDiagnostics.forEach(diagnostic => { + var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + }); + + var exitCode = emitResult.emitSkipped ? 1 : 0; + console.log(`Process exiting with code '${exitCode}'.`); + process.exit(exitCode); +} + +compile(process.argv.slice(2), { + noEmitOnError: true, noImplicitAny: true, + target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS +}); +//// [typescript.d.ts] +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { + [index: string]: T; + } + interface TextRange { + pos: number; + end: number; + } + const enum SyntaxKind { + Unknown = 0, + EndOfFileToken = 1, + SingleLineCommentTrivia = 2, + MultiLineCommentTrivia = 3, + NewLineTrivia = 4, + WhitespaceTrivia = 5, + ConflictMarkerTrivia = 6, + NumericLiteral = 7, + StringLiteral = 8, + RegularExpressionLiteral = 9, + NoSubstitutionTemplateLiteral = 10, + TemplateHead = 11, + TemplateMiddle = 12, + TemplateTail = 13, + OpenBraceToken = 14, + CloseBraceToken = 15, + OpenParenToken = 16, + CloseParenToken = 17, + OpenBracketToken = 18, + CloseBracketToken = 19, + DotToken = 20, + DotDotDotToken = 21, + SemicolonToken = 22, + CommaToken = 23, + LessThanToken = 24, + GreaterThanToken = 25, + LessThanEqualsToken = 26, + GreaterThanEqualsToken = 27, + EqualsEqualsToken = 28, + ExclamationEqualsToken = 29, + EqualsEqualsEqualsToken = 30, + ExclamationEqualsEqualsToken = 31, + EqualsGreaterThanToken = 32, + PlusToken = 33, + MinusToken = 34, + AsteriskToken = 35, + SlashToken = 36, + PercentToken = 37, + PlusPlusToken = 38, + MinusMinusToken = 39, + LessThanLessThanToken = 40, + GreaterThanGreaterThanToken = 41, + GreaterThanGreaterThanGreaterThanToken = 42, + AmpersandToken = 43, + BarToken = 44, + CaretToken = 45, + ExclamationToken = 46, + TildeToken = 47, + AmpersandAmpersandToken = 48, + BarBarToken = 49, + QuestionToken = 50, + ColonToken = 51, + EqualsToken = 52, + PlusEqualsToken = 53, + MinusEqualsToken = 54, + AsteriskEqualsToken = 55, + SlashEqualsToken = 56, + PercentEqualsToken = 57, + LessThanLessThanEqualsToken = 58, + GreaterThanGreaterThanEqualsToken = 59, + GreaterThanGreaterThanGreaterThanEqualsToken = 60, + AmpersandEqualsToken = 61, + BarEqualsToken = 62, + CaretEqualsToken = 63, + Identifier = 64, + BreakKeyword = 65, + CaseKeyword = 66, + CatchKeyword = 67, + ClassKeyword = 68, + ConstKeyword = 69, + ContinueKeyword = 70, + DebuggerKeyword = 71, + DefaultKeyword = 72, + DeleteKeyword = 73, + DoKeyword = 74, + ElseKeyword = 75, + EnumKeyword = 76, + ExportKeyword = 77, + ExtendsKeyword = 78, + FalseKeyword = 79, + FinallyKeyword = 80, + ForKeyword = 81, + FunctionKeyword = 82, + IfKeyword = 83, + ImportKeyword = 84, + InKeyword = 85, + InstanceOfKeyword = 86, + NewKeyword = 87, + NullKeyword = 88, + ReturnKeyword = 89, + SuperKeyword = 90, + SwitchKeyword = 91, + ThisKeyword = 92, + ThrowKeyword = 93, + TrueKeyword = 94, + TryKeyword = 95, + TypeOfKeyword = 96, + VarKeyword = 97, + VoidKeyword = 98, + WhileKeyword = 99, + WithKeyword = 100, + ImplementsKeyword = 101, + InterfaceKeyword = 102, + LetKeyword = 103, + PackageKeyword = 104, + PrivateKeyword = 105, + ProtectedKeyword = 106, + PublicKeyword = 107, + StaticKeyword = 108, + YieldKeyword = 109, + AnyKeyword = 110, + BooleanKeyword = 111, + ConstructorKeyword = 112, + DeclareKeyword = 113, + GetKeyword = 114, + ModuleKeyword = 115, + RequireKeyword = 116, + NumberKeyword = 117, + SetKeyword = 118, + StringKeyword = 119, + TypeKeyword = 120, + QualifiedName = 121, + ComputedPropertyName = 122, + TypeParameter = 123, + Parameter = 124, + PropertySignature = 125, + PropertyDeclaration = 126, + MethodSignature = 127, + MethodDeclaration = 128, + Constructor = 129, + GetAccessor = 130, + SetAccessor = 131, + CallSignature = 132, + ConstructSignature = 133, + IndexSignature = 134, + TypeReference = 135, + FunctionType = 136, + ConstructorType = 137, + TypeQuery = 138, + TypeLiteral = 139, + ArrayType = 140, + TupleType = 141, + UnionType = 142, + ParenthesizedType = 143, + ObjectBindingPattern = 144, + ArrayBindingPattern = 145, + BindingElement = 146, + ArrayLiteralExpression = 147, + ObjectLiteralExpression = 148, + PropertyAccessExpression = 149, + ElementAccessExpression = 150, + CallExpression = 151, + NewExpression = 152, + TaggedTemplateExpression = 153, + TypeAssertionExpression = 154, + ParenthesizedExpression = 155, + FunctionExpression = 156, + ArrowFunction = 157, + DeleteExpression = 158, + TypeOfExpression = 159, + VoidExpression = 160, + PrefixUnaryExpression = 161, + PostfixUnaryExpression = 162, + BinaryExpression = 163, + ConditionalExpression = 164, + TemplateExpression = 165, + YieldExpression = 166, + SpreadElementExpression = 167, + OmittedExpression = 168, + TemplateSpan = 169, + Block = 170, + VariableStatement = 171, + EmptyStatement = 172, + ExpressionStatement = 173, + IfStatement = 174, + DoStatement = 175, + WhileStatement = 176, + ForStatement = 177, + ForInStatement = 178, + ContinueStatement = 179, + BreakStatement = 180, + ReturnStatement = 181, + WithStatement = 182, + SwitchStatement = 183, + LabeledStatement = 184, + ThrowStatement = 185, + TryStatement = 186, + DebuggerStatement = 187, + VariableDeclaration = 188, + VariableDeclarationList = 189, + FunctionDeclaration = 190, + ClassDeclaration = 191, + InterfaceDeclaration = 192, + TypeAliasDeclaration = 193, + EnumDeclaration = 194, + ModuleDeclaration = 195, + ModuleBlock = 196, + ImportDeclaration = 197, + ExportAssignment = 198, + ExternalModuleReference = 199, + CaseClause = 200, + DefaultClause = 201, + HeritageClause = 202, + CatchClause = 203, + PropertyAssignment = 204, + ShorthandPropertyAssignment = 205, + EnumMember = 206, + SourceFile = 207, + SyntaxList = 208, + Count = 209, + FirstAssignment = 52, + LastAssignment = 63, + FirstReservedWord = 65, + LastReservedWord = 100, + FirstKeyword = 65, + LastKeyword = 120, + FirstFutureReservedWord = 101, + LastFutureReservedWord = 109, + FirstTypeNode = 135, + LastTypeNode = 143, + FirstPunctuation = 14, + LastPunctuation = 63, + FirstToken = 0, + LastToken = 120, + FirstTriviaToken = 2, + LastTriviaToken = 6, + FirstLiteralToken = 7, + LastLiteralToken = 10, + FirstTemplateToken = 10, + LastTemplateToken = 13, + FirstBinaryOperator = 24, + LastBinaryOperator = 63, + FirstNode = 121, + } + const enum NodeFlags { + Export = 1, + Ambient = 2, + Public = 16, + Private = 32, + Protected = 64, + Static = 128, + MultiLine = 256, + Synthetic = 512, + DeclarationFile = 1024, + Let = 2048, + Const = 4096, + OctalLiteral = 8192, + Modifier = 243, + AccessibilityModifier = 112, + BlockScoped = 6144, + } + const enum ParserContextFlags { + StrictMode = 1, + DisallowIn = 2, + Yield = 4, + GeneratorParameter = 8, + ThisNodeHasError = 16, + ParserGeneratedFlags = 31, + ThisNodeOrAnySubNodesHasError = 32, + HasAggregatedChildData = 64, + } + const enum RelationComparisonResult { + Succeeded = 1, + Failed = 2, + FailedAndReported = 3, + } + interface Node extends TextRange { + kind: SyntaxKind; + flags: NodeFlags; + parserContextFlags?: ParserContextFlags; + id?: number; + parent?: Node; + symbol?: Symbol; + locals?: SymbolTable; + nextContainer?: Node; + localSymbol?: Symbol; + modifiers?: ModifiersArray; + } + interface NodeArray extends Array, TextRange { + hasTrailingComma?: boolean; + } + interface ModifiersArray extends NodeArray { + flags: number; + } + interface Identifier extends PrimaryExpression { + text: string; + } + interface QualifiedName extends Node { + left: EntityName; + right: Identifier; + } + type EntityName = Identifier | QualifiedName; + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + interface Declaration extends Node { + _declarationBrand: any; + name?: DeclarationName; + } + interface ComputedPropertyName extends Node { + expression: Expression; + } + interface TypeParameterDeclaration extends Declaration { + name: Identifier; + constraint?: TypeNode; + expression?: Expression; + } + interface SignatureDeclaration extends Declaration { + typeParameters?: NodeArray; + parameters: NodeArray; + type?: TypeNode; + } + interface VariableDeclaration extends Declaration { + parent?: VariableDeclarationList; + name: Identifier | BindingPattern; + type?: TypeNode; + initializer?: Expression; + } + interface VariableDeclarationList extends Node { + declarations: NodeArray; + } + interface ParameterDeclaration extends Declaration { + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingElement extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + initializer?: Expression; + } + interface PropertyDeclaration extends Declaration, ClassElement { + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + } + interface PropertyAssignment extends ObjectLiteralElement { + _propertyAssignmentBrand: any; + name: DeclarationName; + questionToken?: Node; + initializer: Expression; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + name: Identifier; + questionToken?: Node; + } + interface VariableLikeDeclaration extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingPattern extends Node { + elements: NodeArray; + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { + _functionLikeDeclarationBrand: any; + asteriskToken?: Node; + questionToken?: Node; + body?: Block | Expression; + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { + name: Identifier; + body?: Block; + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + body?: Block; + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + body?: Block; + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + _accessorDeclarationBrand: any; + body: Block; + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { + _indexSignatureDeclarationBrand: any; + } + interface TypeNode extends Node { + _typeNodeBrand: any; + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { + _functionOrConstructorTypeNodeBrand: any; + } + interface TypeReferenceNode extends TypeNode { + typeName: EntityName; + typeArguments?: NodeArray; + } + interface TypeQueryNode extends TypeNode { + exprName: EntityName; + } + interface TypeLiteralNode extends TypeNode, Declaration { + members: NodeArray; + } + interface ArrayTypeNode extends TypeNode { + elementType: TypeNode; + } + interface TupleTypeNode extends TypeNode { + elementTypes: NodeArray; + } + interface UnionTypeNode extends TypeNode { + types: NodeArray; + } + interface ParenthesizedTypeNode extends TypeNode { + type: TypeNode; + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { + } + interface Expression extends Node { + _expressionBrand: any; + contextualType?: Type; + } + interface UnaryExpression extends Expression { + _unaryExpressionBrand: any; + } + interface PrefixUnaryExpression extends UnaryExpression { + operator: SyntaxKind; + operand: UnaryExpression; + } + interface PostfixUnaryExpression extends PostfixExpression { + operand: LeftHandSideExpression; + operator: SyntaxKind; + } + interface PostfixExpression extends UnaryExpression { + _postfixExpressionBrand: any; + } + interface LeftHandSideExpression extends PostfixExpression { + _leftHandSideExpressionBrand: any; + } + interface MemberExpression extends LeftHandSideExpression { + _memberExpressionBrand: any; + } + interface PrimaryExpression extends MemberExpression { + _primaryExpressionBrand: any; + } + interface DeleteExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface TypeOfExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface VoidExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface YieldExpression extends Expression { + asteriskToken?: Node; + expression: Expression; + } + interface BinaryExpression extends Expression { + left: Expression; + operator: SyntaxKind; + right: Expression; + } + interface ConditionalExpression extends Expression { + condition: Expression; + whenTrue: Expression; + whenFalse: Expression; + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + name?: Identifier; + body: Block | Expression; + } + interface LiteralExpression extends PrimaryExpression { + text: string; + isUnterminated?: boolean; + } + interface StringLiteralExpression extends LiteralExpression { + _stringLiteralExpressionBrand: any; + } + interface TemplateExpression extends PrimaryExpression { + head: LiteralExpression; + templateSpans: NodeArray; + } + interface TemplateSpan extends Node { + expression: Expression; + literal: LiteralExpression; + } + interface ParenthesizedExpression extends PrimaryExpression { + expression: Expression; + } + interface ArrayLiteralExpression extends PrimaryExpression { + elements: NodeArray; + } + interface SpreadElementExpression extends Expression { + expression: Expression; + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { + properties: NodeArray; + } + interface PropertyAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + name: Identifier; + } + interface ElementAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + argumentExpression?: Expression; + } + interface CallExpression extends LeftHandSideExpression { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments: NodeArray; + } + interface NewExpression extends CallExpression, PrimaryExpression { + } + interface TaggedTemplateExpression extends MemberExpression { + tag: LeftHandSideExpression; + template: LiteralExpression | TemplateExpression; + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; + interface TypeAssertion extends UnaryExpression { + type: TypeNode; + expression: UnaryExpression; + } + interface Statement extends Node, ModuleElement { + _statementBrand: any; + } + interface Block extends Statement { + statements: NodeArray; + } + interface VariableStatement extends Statement { + declarationList: VariableDeclarationList; + } + interface ExpressionStatement extends Statement { + expression: Expression; + } + interface IfStatement extends Statement { + expression: Expression; + thenStatement: Statement; + elseStatement?: Statement; + } + interface IterationStatement extends Statement { + statement: Statement; + } + interface DoStatement extends IterationStatement { + expression: Expression; + } + interface WhileStatement extends IterationStatement { + expression: Expression; + } + interface ForStatement extends IterationStatement { + initializer?: VariableDeclarationList | Expression; + condition?: Expression; + iterator?: Expression; + } + interface ForInStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + interface BreakOrContinueStatement extends Statement { + label?: Identifier; + } + interface ReturnStatement extends Statement { + expression?: Expression; + } + interface WithStatement extends Statement { + expression: Expression; + statement: Statement; + } + interface SwitchStatement extends Statement { + expression: Expression; + clauses: NodeArray; + } + interface CaseClause extends Node { + expression?: Expression; + statements: NodeArray; + } + interface DefaultClause extends Node { + statements: NodeArray; + } + type CaseOrDefaultClause = CaseClause | DefaultClause; + interface LabeledStatement extends Statement { + label: Identifier; + statement: Statement; + } + interface ThrowStatement extends Statement { + expression: Expression; + } + interface TryStatement extends Statement { + tryBlock: Block; + catchClause?: CatchClause; + finallyBlock?: Block; + } + interface CatchClause extends Declaration { + name: Identifier; + type?: TypeNode; + block: Block; + } + interface ModuleElement extends Node { + _moduleElementBrand: any; + } + interface ClassDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface ClassElement extends Declaration { + _classElementBrand: any; + } + interface InterfaceDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface HeritageClause extends Node { + token: SyntaxKind; + types?: NodeArray; + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { + name: Identifier; + type: TypeNode; + } + interface EnumMember extends Declaration { + name: DeclarationName; + initializer?: Expression; + } + interface EnumDeclaration extends Declaration, ModuleElement { + name: Identifier; + members: NodeArray; + } + interface ModuleDeclaration extends Declaration, ModuleElement { + name: Identifier | LiteralExpression; + body: ModuleBlock | ModuleDeclaration; + } + interface ModuleBlock extends Node, ModuleElement { + statements: NodeArray; + } + interface ImportDeclaration extends Declaration, ModuleElement { + name: Identifier; + moduleReference: EntityName | ExternalModuleReference; + } + interface ExternalModuleReference extends Node { + expression?: Expression; + } + interface ExportAssignment extends Statement, ModuleElement { + exportName: Identifier; + } + interface FileReference extends TextRange { + fileName: string; + } + interface CommentRange extends TextRange { + hasTrailingNewLine?: boolean; + } + interface SourceFile extends Declaration { + statements: NodeArray; + endOfFileToken: Node; + fileName: string; + text: string; + amdDependencies: string[]; + amdModuleName: string; + referencedFiles: FileReference[]; + hasNoDefaultLib: boolean; + externalModuleIndicator: Node; + languageVersion: ScriptTarget; + identifiers: Map; + } + interface ScriptReferenceHost { + getCompilerOptions(): CompilerOptions; + getSourceFile(fileName: string): SourceFile; + getCurrentDirectory(): string; + } + interface WriteFileCallback { + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + } + interface Program extends ScriptReferenceHost { + getSourceFiles(): SourceFile[]; + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeChecker(): TypeChecker; + getCommonSourceDirectory(): string; + } + interface SourceMapSpan { + emittedLine: number; + emittedColumn: number; + sourceLine: number; + sourceColumn: number; + nameIndex?: number; + sourceIndex: number; + } + interface SourceMapData { + sourceMapFilePath: string; + jsSourceMappingURL: string; + sourceMapFile: string; + sourceMapSourceRoot: string; + sourceMapSources: string[]; + inputSourceFileNames: string[]; + sourceMapNames?: string[]; + sourceMapMappings: string; + sourceMapDecodedMappings: SourceMapSpan[]; + } + enum ExitStatus { + Success = 0, + DiagnosticsPresent_OutputsSkipped = 1, + DiagnosticsPresent_OutputsGenerated = 2, + } + interface EmitResult { + emitSkipped: boolean; + diagnostics: Diagnostic[]; + sourceMaps: SourceMapData[]; + } + interface TypeCheckerHost { + getCompilerOptions(): CompilerOptions; + getSourceFiles(): SourceFile[]; + getSourceFile(fileName: string): SourceFile; + } + interface TypeChecker { + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; + getDeclaredTypeOfSymbol(symbol: Symbol): Type; + getPropertiesOfType(type: Type): Symbol[]; + getPropertyOfType(type: Type, propertyName: string): Symbol; + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; + getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getReturnTypeOfSignature(signature: Signature): Type; + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; + getSymbolAtLocation(node: Node): Symbol; + getShorthandAssignmentValueSymbol(location: Node): Symbol; + getTypeAtLocation(node: Node): Type; + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + getSymbolDisplayBuilder(): SymbolDisplayBuilder; + getFullyQualifiedName(symbol: Symbol): string; + getAugmentedPropertiesOfType(type: Type): Symbol[]; + getRootSymbols(symbol: Symbol): Symbol[]; + getContextualType(node: Expression): Type; + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + isUndefinedSymbol(symbol: Symbol): boolean; + isArgumentsSymbol(symbol: Symbol): boolean; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + getAliasedSymbol(symbol: Symbol): Symbol; + } + interface SymbolDisplayBuilder { + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + } + interface SymbolWriter { + writeKeyword(text: string): void; + writeOperator(text: string): void; + writePunctuation(text: string): void; + writeSpace(text: string): void; + writeStringLiteral(text: string): void; + writeParameter(text: string): void; + writeSymbol(text: string, symbol: Symbol): void; + writeLine(): void; + increaseIndent(): void; + decreaseIndent(): void; + clear(): void; + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + } + const enum TypeFormatFlags { + None = 0, + WriteArrayAsGenericType = 1, + UseTypeOfFunction = 2, + NoTruncation = 4, + WriteArrowStyleSignature = 8, + WriteOwnNameForAnyLike = 16, + WriteTypeArgumentsOfSignature = 32, + InElementType = 64, + UseFullyQualifiedType = 128, + } + const enum SymbolFormatFlags { + None = 0, + WriteTypeParametersOrArguments = 1, + UseOnlyExternalAliasing = 2, + } + const enum SymbolAccessibility { + Accessible = 0, + NotAccessible = 1, + CannotBeNamed = 2, + } + interface SymbolVisibilityResult { + accessibility: SymbolAccessibility; + aliasesToMakeVisible?: ImportDeclaration[]; + errorSymbolName?: string; + errorNode?: Node; + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { + errorModuleName?: string; + } + interface EmitResolver { + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; + getExpressionNamePrefix(node: Identifier): string; + getExportAssignmentName(node: SourceFile): string; + isReferencedImportDeclaration(node: ImportDeclaration): boolean; + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + getNodeCheckFlags(node: Node): NodeCheckFlags; + isDeclarationVisible(node: Declaration): boolean; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isUnknownIdentifier(location: Node, name: string): boolean; + } + const enum SymbolFlags { + FunctionScopedVariable = 1, + BlockScopedVariable = 2, + Property = 4, + EnumMember = 8, + Function = 16, + Class = 32, + Interface = 64, + ConstEnum = 128, + RegularEnum = 256, + ValueModule = 512, + NamespaceModule = 1024, + TypeLiteral = 2048, + ObjectLiteral = 4096, + Method = 8192, + Constructor = 16384, + GetAccessor = 32768, + SetAccessor = 65536, + Signature = 131072, + TypeParameter = 262144, + TypeAlias = 524288, + ExportValue = 1048576, + ExportType = 2097152, + ExportNamespace = 4194304, + Import = 8388608, + Instantiated = 16777216, + Merged = 33554432, + Transient = 67108864, + Prototype = 134217728, + UnionProperty = 268435456, + Optional = 536870912, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 793056, + Namespace = 1536, + Module = 1536, + Accessor = 98304, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 107455, + EnumMemberExcludes = 107455, + FunctionExcludes = 106927, + ClassExcludes = 899583, + InterfaceExcludes = 792992, + RegularEnumExcludes = 899327, + ConstEnumExcludes = 899967, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 530912, + TypeAliasExcludes = 793056, + ImportExcludes = 8388608, + ModuleMember = 8914931, + ExportHasLocal = 944, + HasLocals = 255504, + HasExports = 1952, + HasMembers = 6240, + IsContainer = 262128, + PropertyOrAccessor = 98308, + Export = 7340032, + } + interface Symbol { + flags: SymbolFlags; + name: string; + id?: number; + mergeId?: number; + declarations?: Declaration[]; + parent?: Symbol; + members?: SymbolTable; + exports?: SymbolTable; + exportSymbol?: Symbol; + valueDeclaration?: Declaration; + constEnumOnlyModule?: boolean; + } + interface SymbolLinks { + target?: Symbol; + type?: Type; + declaredType?: Type; + mapper?: TypeMapper; + referenced?: boolean; + exportAssignSymbol?: Symbol; + unionType?: UnionType; + } + interface TransientSymbol extends Symbol, SymbolLinks { + } + interface SymbolTable { + [index: string]: Symbol; + } + const enum NodeCheckFlags { + TypeChecked = 1, + LexicalThis = 2, + CaptureThis = 4, + EmitExtends = 8, + SuperInstance = 16, + SuperStatic = 32, + ContextChecked = 64, + EnumValuesComputed = 128, + } + interface NodeLinks { + resolvedType?: Type; + resolvedSignature?: Signature; + resolvedSymbol?: Symbol; + flags?: NodeCheckFlags; + enumMemberValue?: number; + isIllegalTypeReferenceInConstraint?: boolean; + isVisible?: boolean; + localModuleName?: string; + assignmentChecks?: Map; + hasReportedStatementInAmbientContext?: boolean; + importOnRightSide?: Symbol; + } + const enum TypeFlags { + Any = 1, + String = 2, + Number = 4, + Boolean = 8, + Void = 16, + Undefined = 32, + Null = 64, + Enum = 128, + StringLiteral = 256, + TypeParameter = 512, + Class = 1024, + Interface = 2048, + Reference = 4096, + Tuple = 8192, + Union = 16384, + Anonymous = 32768, + FromSignature = 65536, + ObjectLiteral = 131072, + ContainsUndefinedOrNull = 262144, + ContainsObjectLiteral = 524288, + Intrinsic = 127, + Primitive = 510, + StringLike = 258, + NumberLike = 132, + ObjectType = 48128, + RequiresWidening = 786432, + } + interface Type { + flags: TypeFlags; + id: number; + symbol?: Symbol; + } + interface IntrinsicType extends Type { + intrinsicName: string; + } + interface StringLiteralType extends Type { + text: string; + } + interface ObjectType extends Type { + } + interface InterfaceType extends ObjectType { + typeParameters: TypeParameter[]; + baseTypes: ObjectType[]; + declaredProperties: Symbol[]; + declaredCallSignatures: Signature[]; + declaredConstructSignatures: Signature[]; + declaredStringIndexType: Type; + declaredNumberIndexType: Type; + } + interface TypeReference extends ObjectType { + target: GenericType; + typeArguments: Type[]; + } + interface GenericType extends InterfaceType, TypeReference { + instantiations: Map; + } + interface TupleType extends ObjectType { + elementTypes: Type[]; + baseArrayType: TypeReference; + } + interface UnionType extends Type { + types: Type[]; + resolvedProperties: SymbolTable; + } + interface ResolvedType extends ObjectType, UnionType { + members: SymbolTable; + properties: Symbol[]; + callSignatures: Signature[]; + constructSignatures: Signature[]; + stringIndexType: Type; + numberIndexType: Type; + } + interface TypeParameter extends Type { + constraint: Type; + target?: TypeParameter; + mapper?: TypeMapper; + } + const enum SignatureKind { + Call = 0, + Construct = 1, + } + interface Signature { + declaration: SignatureDeclaration; + typeParameters: TypeParameter[]; + parameters: Symbol[]; + resolvedReturnType: Type; + minArgumentCount: number; + hasRestParameter: boolean; + hasStringLiterals: boolean; + target?: Signature; + mapper?: TypeMapper; + unionSignatures?: Signature[]; + erasedSignatureCache?: Signature; + isolatedSignatureType?: ObjectType; + } + const enum IndexKind { + String = 0, + Number = 1, + } + interface TypeMapper { + (t: Type): Type; + } + interface TypeInferences { + primary: Type[]; + secondary: Type[]; + } + interface InferenceContext { + typeParameters: TypeParameter[]; + inferUnionTypes: boolean; + inferences: TypeInferences[]; + inferredTypes: Type[]; + failedTypeParameterIndex?: number; + } + interface DiagnosticMessage { + key: string; + category: DiagnosticCategory; + code: number; + } + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; + } + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string | DiagnosticMessageChain; + category: DiagnosticCategory; + code: number; + } + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, + } + interface CompilerOptions { + allowNonTsExtensions?: boolean; + charset?: string; + codepage?: number; + declaration?: boolean; + diagnostics?: boolean; + emitBOM?: boolean; + help?: boolean; + listFiles?: boolean; + locale?: string; + mapRoot?: string; + module?: ModuleKind; + noEmit?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noImplicitAny?: boolean; + noLib?: boolean; + noLibCheck?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + preserveConstEnums?: boolean; + project?: string; + removeComments?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + version?: boolean; + watch?: boolean; + stripInternal?: boolean; + [option: string]: string | number | boolean; + } + const enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + } + interface LineAndCharacter { + line: number; + character: number; + } + const enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES6 = 2, + Latest = 2, + } + interface ParsedCommandLine { + options: CompilerOptions; + fileNames: string[]; + errors: Diagnostic[]; + } + interface CommandLineOption { + name: string; + type: string | Map; + isFilePath?: boolean; + shortName?: string; + description?: DiagnosticMessage; + paramType?: DiagnosticMessage; + error?: DiagnosticMessage; + experimental?: boolean; + } + const enum CharacterCodes { + nullCharacter = 0, + maxAsciiCharacter = 127, + lineFeed = 10, + carriageReturn = 13, + lineSeparator = 8232, + paragraphSeparator = 8233, + nextLine = 133, + space = 32, + nonBreakingSpace = 160, + enQuad = 8192, + emQuad = 8193, + enSpace = 8194, + emSpace = 8195, + threePerEmSpace = 8196, + fourPerEmSpace = 8197, + sixPerEmSpace = 8198, + figureSpace = 8199, + punctuationSpace = 8200, + thinSpace = 8201, + hairSpace = 8202, + zeroWidthSpace = 8203, + narrowNoBreakSpace = 8239, + ideographicSpace = 12288, + mathematicalSpace = 8287, + ogham = 5760, + _ = 95, + $ = 36, + _0 = 48, + _1 = 49, + _2 = 50, + _3 = 51, + _4 = 52, + _5 = 53, + _6 = 54, + _7 = 55, + _8 = 56, + _9 = 57, + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + ampersand = 38, + asterisk = 42, + at = 64, + backslash = 92, + backtick = 96, + bar = 124, + caret = 94, + closeBrace = 125, + closeBracket = 93, + closeParen = 41, + colon = 58, + comma = 44, + dot = 46, + doubleQuote = 34, + equals = 61, + exclamation = 33, + greaterThan = 62, + lessThan = 60, + minus = 45, + openBrace = 123, + openBracket = 91, + openParen = 40, + percent = 37, + plus = 43, + question = 63, + semicolon = 59, + singleQuote = 39, + slash = 47, + tilde = 126, + backspace = 8, + formFeed = 12, + byteOrderMark = 65279, + tab = 9, + verticalTab = 11, + } + interface CancellationToken { + isCancellationRequested(): boolean; + } + interface CompilerHost { + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; + getCancellationToken?(): CancellationToken; + writeFile: WriteFileCallback; + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + } + interface TextSpan { + start: number; + length: number; + } + interface TextChangeRange { + span: TextSpan; + newLength: number; + } +} +declare module "typescript" { + interface ErrorCallback { + (message: DiagnosticMessage, length: number): void; + } + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scan(): SyntaxKind; + setText(text: string): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + tryScan(callback: () => T): T; + } + function tokenToString(t: SyntaxKind): string; + function computeLineStarts(text: string): number[]; + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getLineStarts(sourceFile: SourceFile): number[]; + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + line: number; + character: number; + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function isWhiteSpace(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function isOctalDigit(ch: number): boolean; + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; + function createNode(kind: SyntaxKind): Node; + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; + function modifierToFlag(token: SyntaxKind): NodeFlags; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; + function isEvalOrArgumentsIdentifier(node: Node): boolean; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function isLeftHandSideExpression(expr: Expression): boolean; + function isAssignmentOperator(token: SyntaxKind): boolean; +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; + function getPreEmitDiagnostics(program: Program): Diagnostic[]; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +} +declare module "typescript" { + var servicesVersion: string; + interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile): number; + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFile): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; + } + interface Symbol { + getFlags(): SymbolFlags; + getName(): string; + getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface Type { + getFlags(): TypeFlags; + getSymbol(): Symbol; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol; + getApparentProperties(): Symbol[]; + getCallSignatures(): Signature[]; + getConstructSignatures(): Signature[]; + getStringIndexType(): Type; + getNumberIndexType(): Type; + } + interface Signature { + getDeclaration(): SignatureDeclaration; + getTypeParameters(): Type[]; + getParameters(): Symbol[]; + getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface SourceFile { + version: string; + scriptSnapshot: IScriptSnapshot; + nameTable: Map; + getNamedDeclarations(): Declaration[]; + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineStarts(): number[]; + getPositionFromLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; + /** Gets the length of this script snapshot. */ + getLength(): number; + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; + } + module ScriptSnapshot { + function fromString(text: string): IScriptSnapshot; + } + interface PreProcessedFileInfo { + referencedFiles: FileReference[]; + importedFiles: FileReference[]; + isLibFile: boolean; + } + interface LanguageServiceHost { + getCompilationSettings(): CompilerOptions; + getNewLine?(): string; + getScriptFileNames(): string[]; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): IScriptSnapshot; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + log?(s: string): void; + trace?(s: string): void; + error?(s: string): void; + } + interface LanguageService { + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; + getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigationBarItems(fileName: string): NavigationBarItem[]; + getOutliningSpans(fileName: string): OutliningSpan[]; + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getEmitOutput(fileName: string): EmitOutput; + getProgram(): Program; + getSourceFile(fileName: string): SourceFile; + dispose(): void; + } + interface ClassifiedSpan { + textSpan: TextSpan; + classificationType: string; + } + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; + } + interface TodoCommentDescriptor { + text: string; + priority: number; + } + interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; + } + class TextChange { + span: TextSpan; + newText: string; + } + interface RenameLocation { + textSpan: TextSpan; + fileName: string; + } + interface ReferenceEntry { + textSpan: TextSpan; + fileName: string; + isWriteAccess: boolean; + } + interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; + fileName: string; + textSpan: TextSpan; + containerName: string; + containerKind: string; + } + interface EditorOptions { + IndentSize: number; + TabSize: number; + NewLineCharacter: string; + ConvertTabsToSpaces: boolean; + } + interface FormatCodeOptions extends EditorOptions { + InsertSpaceAfterCommaDelimiter: boolean; + InsertSpaceAfterSemicolonInForStatements: boolean; + InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + PlaceOpenBraceOnNewLineForFunctions: boolean; + PlaceOpenBraceOnNewLineForControlBlocks: boolean; + } + interface DefinitionInfo { + fileName: string; + textSpan: TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; + } + enum SymbolDisplayPartKind { + aliasName = 0, + className = 1, + enumName = 2, + fieldName = 3, + interfaceName = 4, + keyword = 5, + lineBreak = 6, + numericLiteral = 7, + stringLiteral = 8, + localName = 9, + methodName = 10, + moduleName = 11, + operator = 12, + parameterName = 13, + propertyName = 14, + punctuation = 15, + space = 16, + text = 17, + typeParameterName = 18, + enumMemberName = 19, + functionName = 20, + regularExpressionLiteral = 21, + } + interface SymbolDisplayPart { + text: string; + kind: string; + } + interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TextSpan; + } + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; + } + interface CompletionInfo { + isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; + entries: CompletionEntry[]; + } + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + } + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface OutliningSpan { + /** The span of the document to actually collapse. */ + textSpan: TextSpan; + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; + /** The text to display in the editor for the collapsed region. */ + bannerText: string; + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; + } + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + const enum OutputFileType { + JavaScript = 0, + SourceMap = 1, + Declaration = 2, + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } + const enum EndOfLineState { + Start = 0, + InMultiLineCommentTrivia = 1, + InSingleQuoteStringLiteral = 2, + InDoubleQuoteStringLiteral = 3, + } + enum TokenClass { + Punctuation = 0, + Keyword = 1, + Operator = 2, + Comment = 3, + Whitespace = 4, + Identifier = 5, + NumberLiteral = 6, + StringLiteral = 7, + RegExpLiteral = 8, + } + interface ClassificationResult { + finalLexState: EndOfLineState; + entries: ClassificationInfo[]; + } + interface ClassificationInfo { + length: number; + classification: TokenClass; + } + interface Classifier { + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + } + class ScriptElementKind { + static unknown: string; + static keyword: string; + static scriptElement: string; + static moduleElement: string; + static classElement: string; + static interfaceElement: string; + static typeElement: string; + static enumElement: string; + static variableElement: string; + static localVariableElement: string; + static functionElement: string; + static localFunctionElement: string; + static memberFunctionElement: string; + static memberGetAccessorElement: string; + static memberSetAccessorElement: string; + static memberVariableElement: string; + static constructorImplementationElement: string; + static callSignatureElement: string; + static indexSignatureElement: string; + static constructSignatureElement: string; + static parameterElement: string; + static typeParameterElement: string; + static primitiveType: string; + static label: string; + static alias: string; + static constElement: string; + static letElement: string; + } + class ScriptElementKindModifier { + static none: string; + static publicMemberModifier: string; + static privateMemberModifier: string; + static protectedMemberModifier: string; + static exportedModifier: string; + static ambientModifier: string; + static staticModifier: string; + } + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAlias: string; + } + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; + function getDefaultCompilerOptions(): CompilerOptions; + class OperationCanceledException { + } + class CancellationTokenObject { + private cancellationToken; + static None: CancellationTokenObject; + constructor(cancellationToken: CancellationToken); + isCancellationRequested(): boolean; + throwIfCancellationRequested(): void; + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + var disableIncrementalParsing: boolean; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + function createDocumentRegistry(): DocumentRegistry; + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function createClassifier(): Classifier; + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +} + + +//// [APISample_compile.js] +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ +var ts = require("typescript"); +function compile(fileNames, options) { + var program = ts.createProgram(fileNames, options); + var emitResult = program.emit(); + var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); + allDiagnostics.forEach(function (diagnostic) { + var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); + }); + var exitCode = emitResult.emitSkipped ? 1 : 0; + console.log("Process exiting with code '" + exitCode + "'."); + process.exit(exitCode); +} +exports.compile = compile; +compile(process.argv.slice(2), { + noEmitOnError: true, + noImplicitAny: true, + target: 1 /* ES5 */, + module: 1 /* CommonJS */ +}); diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types new file mode 100644 index 00000000000..d70172377ca --- /dev/null +++ b/tests/baselines/reference/APISample_compile.types @@ -0,0 +1,5941 @@ +=== tests/cases/compiler/APISample_compile.ts === + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-minimal-compiler + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +>process : any + +declare var console: any; +>console : any + +declare var os: any; +>os : any + +import ts = require("typescript"); +>ts : typeof ts + +export function compile(fileNames: string[], options: ts.CompilerOptions): void { +>compile : (fileNames: string[], options: ts.CompilerOptions) => void +>fileNames : string[] +>options : ts.CompilerOptions +>ts : unknown +>CompilerOptions : ts.CompilerOptions + + var program = ts.createProgram(fileNames, options); +>program : ts.Program +>ts.createProgram(fileNames, options) : ts.Program +>ts.createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program +>ts : typeof ts +>createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program +>fileNames : string[] +>options : ts.CompilerOptions + + var emitResult = program.emit(); +>emitResult : ts.EmitResult +>program.emit() : ts.EmitResult +>program.emit : (targetSourceFile?: ts.SourceFile, writeFile?: ts.WriteFileCallback) => ts.EmitResult +>program : ts.Program +>emit : (targetSourceFile?: ts.SourceFile, writeFile?: ts.WriteFileCallback) => ts.EmitResult + + var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); +>allDiagnostics : ts.Diagnostic[] +>ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics) : ts.Diagnostic[] +>ts.getPreEmitDiagnostics(program).concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>ts.getPreEmitDiagnostics(program) : ts.Diagnostic[] +>ts.getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[] +>ts : typeof ts +>getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[] +>program : ts.Program +>concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>emitResult.diagnostics : ts.Diagnostic[] +>emitResult : ts.EmitResult +>diagnostics : ts.Diagnostic[] + + allDiagnostics.forEach(diagnostic => { +>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void +>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void +>allDiagnostics : ts.Diagnostic[] +>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void +>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void +>diagnostic : ts.Diagnostic + + var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); +>lineChar : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file : ts.SourceFile +>diagnostic : ts.Diagnostic +>file : ts.SourceFile +>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.start : number +>diagnostic : ts.Diagnostic +>start : number + + console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); +>console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any +>console.log : any +>console : any +>log : any +>diagnostic.file.fileName : string +>diagnostic.file : ts.SourceFile +>diagnostic : ts.Diagnostic +>file : ts.SourceFile +>fileName : string +>lineChar.line : number +>lineChar : ts.LineAndCharacter +>line : number +>lineChar.character : number +>lineChar : ts.LineAndCharacter +>character : number +>ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL) : string +>ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string +>ts : typeof ts +>flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string +>diagnostic.messageText : string | ts.DiagnosticMessageChain +>diagnostic : ts.Diagnostic +>messageText : string | ts.DiagnosticMessageChain +>os.EOL : any +>os : any +>EOL : any + + }); + + var exitCode = emitResult.emitSkipped ? 1 : 0; +>exitCode : number +>emitResult.emitSkipped ? 1 : 0 : number +>emitResult.emitSkipped : boolean +>emitResult : ts.EmitResult +>emitSkipped : boolean + + console.log(`Process exiting with code '${exitCode}'.`); +>console.log(`Process exiting with code '${exitCode}'.`) : any +>console.log : any +>console : any +>log : any +>exitCode : number + + process.exit(exitCode); +>process.exit(exitCode) : any +>process.exit : any +>process : any +>exit : any +>exitCode : number +} + +compile(process.argv.slice(2), { +>compile(process.argv.slice(2), { noEmitOnError: true, noImplicitAny: true, target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS}) : void +>compile : (fileNames: string[], options: ts.CompilerOptions) => void +>process.argv.slice(2) : any +>process.argv.slice : any +>process.argv : any +>process : any +>argv : any +>slice : any +>{ noEmitOnError: true, noImplicitAny: true, target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS} : { [x: string]: boolean | ts.ScriptTarget | ts.ModuleKind; noEmitOnError: boolean; noImplicitAny: boolean; target: ts.ScriptTarget; module: ts.ModuleKind; } + + noEmitOnError: true, noImplicitAny: true, +>noEmitOnError : boolean +>noImplicitAny : boolean + + target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS +>target : ts.ScriptTarget +>ts.ScriptTarget.ES5 : ts.ScriptTarget +>ts.ScriptTarget : typeof ts.ScriptTarget +>ts : typeof ts +>ScriptTarget : typeof ts.ScriptTarget +>ES5 : ts.ScriptTarget +>module : ts.ModuleKind +>ts.ModuleKind.CommonJS : ts.ModuleKind +>ts.ModuleKind : typeof ts.ModuleKind +>ts : typeof ts +>ModuleKind : typeof ts.ModuleKind +>CommonJS : ts.ModuleKind + +}); +=== typescript.d.ts === +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { +>Map : Map +>T : T + + [index: string]: T; +>index : string +>T : T + } + interface TextRange { +>TextRange : TextRange + + pos: number; +>pos : number + + end: number; +>end : number + } + const enum SyntaxKind { +>SyntaxKind : SyntaxKind + + Unknown = 0, +>Unknown : SyntaxKind + + EndOfFileToken = 1, +>EndOfFileToken : SyntaxKind + + SingleLineCommentTrivia = 2, +>SingleLineCommentTrivia : SyntaxKind + + MultiLineCommentTrivia = 3, +>MultiLineCommentTrivia : SyntaxKind + + NewLineTrivia = 4, +>NewLineTrivia : SyntaxKind + + WhitespaceTrivia = 5, +>WhitespaceTrivia : SyntaxKind + + ConflictMarkerTrivia = 6, +>ConflictMarkerTrivia : SyntaxKind + + NumericLiteral = 7, +>NumericLiteral : SyntaxKind + + StringLiteral = 8, +>StringLiteral : SyntaxKind + + RegularExpressionLiteral = 9, +>RegularExpressionLiteral : SyntaxKind + + NoSubstitutionTemplateLiteral = 10, +>NoSubstitutionTemplateLiteral : SyntaxKind + + TemplateHead = 11, +>TemplateHead : SyntaxKind + + TemplateMiddle = 12, +>TemplateMiddle : SyntaxKind + + TemplateTail = 13, +>TemplateTail : SyntaxKind + + OpenBraceToken = 14, +>OpenBraceToken : SyntaxKind + + CloseBraceToken = 15, +>CloseBraceToken : SyntaxKind + + OpenParenToken = 16, +>OpenParenToken : SyntaxKind + + CloseParenToken = 17, +>CloseParenToken : SyntaxKind + + OpenBracketToken = 18, +>OpenBracketToken : SyntaxKind + + CloseBracketToken = 19, +>CloseBracketToken : SyntaxKind + + DotToken = 20, +>DotToken : SyntaxKind + + DotDotDotToken = 21, +>DotDotDotToken : SyntaxKind + + SemicolonToken = 22, +>SemicolonToken : SyntaxKind + + CommaToken = 23, +>CommaToken : SyntaxKind + + LessThanToken = 24, +>LessThanToken : SyntaxKind + + GreaterThanToken = 25, +>GreaterThanToken : SyntaxKind + + LessThanEqualsToken = 26, +>LessThanEqualsToken : SyntaxKind + + GreaterThanEqualsToken = 27, +>GreaterThanEqualsToken : SyntaxKind + + EqualsEqualsToken = 28, +>EqualsEqualsToken : SyntaxKind + + ExclamationEqualsToken = 29, +>ExclamationEqualsToken : SyntaxKind + + EqualsEqualsEqualsToken = 30, +>EqualsEqualsEqualsToken : SyntaxKind + + ExclamationEqualsEqualsToken = 31, +>ExclamationEqualsEqualsToken : SyntaxKind + + EqualsGreaterThanToken = 32, +>EqualsGreaterThanToken : SyntaxKind + + PlusToken = 33, +>PlusToken : SyntaxKind + + MinusToken = 34, +>MinusToken : SyntaxKind + + AsteriskToken = 35, +>AsteriskToken : SyntaxKind + + SlashToken = 36, +>SlashToken : SyntaxKind + + PercentToken = 37, +>PercentToken : SyntaxKind + + PlusPlusToken = 38, +>PlusPlusToken : SyntaxKind + + MinusMinusToken = 39, +>MinusMinusToken : SyntaxKind + + LessThanLessThanToken = 40, +>LessThanLessThanToken : SyntaxKind + + GreaterThanGreaterThanToken = 41, +>GreaterThanGreaterThanToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanToken = 42, +>GreaterThanGreaterThanGreaterThanToken : SyntaxKind + + AmpersandToken = 43, +>AmpersandToken : SyntaxKind + + BarToken = 44, +>BarToken : SyntaxKind + + CaretToken = 45, +>CaretToken : SyntaxKind + + ExclamationToken = 46, +>ExclamationToken : SyntaxKind + + TildeToken = 47, +>TildeToken : SyntaxKind + + AmpersandAmpersandToken = 48, +>AmpersandAmpersandToken : SyntaxKind + + BarBarToken = 49, +>BarBarToken : SyntaxKind + + QuestionToken = 50, +>QuestionToken : SyntaxKind + + ColonToken = 51, +>ColonToken : SyntaxKind + + EqualsToken = 52, +>EqualsToken : SyntaxKind + + PlusEqualsToken = 53, +>PlusEqualsToken : SyntaxKind + + MinusEqualsToken = 54, +>MinusEqualsToken : SyntaxKind + + AsteriskEqualsToken = 55, +>AsteriskEqualsToken : SyntaxKind + + SlashEqualsToken = 56, +>SlashEqualsToken : SyntaxKind + + PercentEqualsToken = 57, +>PercentEqualsToken : SyntaxKind + + LessThanLessThanEqualsToken = 58, +>LessThanLessThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanEqualsToken = 59, +>GreaterThanGreaterThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanEqualsToken = 60, +>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind + + AmpersandEqualsToken = 61, +>AmpersandEqualsToken : SyntaxKind + + BarEqualsToken = 62, +>BarEqualsToken : SyntaxKind + + CaretEqualsToken = 63, +>CaretEqualsToken : SyntaxKind + + Identifier = 64, +>Identifier : SyntaxKind + + BreakKeyword = 65, +>BreakKeyword : SyntaxKind + + CaseKeyword = 66, +>CaseKeyword : SyntaxKind + + CatchKeyword = 67, +>CatchKeyword : SyntaxKind + + ClassKeyword = 68, +>ClassKeyword : SyntaxKind + + ConstKeyword = 69, +>ConstKeyword : SyntaxKind + + ContinueKeyword = 70, +>ContinueKeyword : SyntaxKind + + DebuggerKeyword = 71, +>DebuggerKeyword : SyntaxKind + + DefaultKeyword = 72, +>DefaultKeyword : SyntaxKind + + DeleteKeyword = 73, +>DeleteKeyword : SyntaxKind + + DoKeyword = 74, +>DoKeyword : SyntaxKind + + ElseKeyword = 75, +>ElseKeyword : SyntaxKind + + EnumKeyword = 76, +>EnumKeyword : SyntaxKind + + ExportKeyword = 77, +>ExportKeyword : SyntaxKind + + ExtendsKeyword = 78, +>ExtendsKeyword : SyntaxKind + + FalseKeyword = 79, +>FalseKeyword : SyntaxKind + + FinallyKeyword = 80, +>FinallyKeyword : SyntaxKind + + ForKeyword = 81, +>ForKeyword : SyntaxKind + + FunctionKeyword = 82, +>FunctionKeyword : SyntaxKind + + IfKeyword = 83, +>IfKeyword : SyntaxKind + + ImportKeyword = 84, +>ImportKeyword : SyntaxKind + + InKeyword = 85, +>InKeyword : SyntaxKind + + InstanceOfKeyword = 86, +>InstanceOfKeyword : SyntaxKind + + NewKeyword = 87, +>NewKeyword : SyntaxKind + + NullKeyword = 88, +>NullKeyword : SyntaxKind + + ReturnKeyword = 89, +>ReturnKeyword : SyntaxKind + + SuperKeyword = 90, +>SuperKeyword : SyntaxKind + + SwitchKeyword = 91, +>SwitchKeyword : SyntaxKind + + ThisKeyword = 92, +>ThisKeyword : SyntaxKind + + ThrowKeyword = 93, +>ThrowKeyword : SyntaxKind + + TrueKeyword = 94, +>TrueKeyword : SyntaxKind + + TryKeyword = 95, +>TryKeyword : SyntaxKind + + TypeOfKeyword = 96, +>TypeOfKeyword : SyntaxKind + + VarKeyword = 97, +>VarKeyword : SyntaxKind + + VoidKeyword = 98, +>VoidKeyword : SyntaxKind + + WhileKeyword = 99, +>WhileKeyword : SyntaxKind + + WithKeyword = 100, +>WithKeyword : SyntaxKind + + ImplementsKeyword = 101, +>ImplementsKeyword : SyntaxKind + + InterfaceKeyword = 102, +>InterfaceKeyword : SyntaxKind + + LetKeyword = 103, +>LetKeyword : SyntaxKind + + PackageKeyword = 104, +>PackageKeyword : SyntaxKind + + PrivateKeyword = 105, +>PrivateKeyword : SyntaxKind + + ProtectedKeyword = 106, +>ProtectedKeyword : SyntaxKind + + PublicKeyword = 107, +>PublicKeyword : SyntaxKind + + StaticKeyword = 108, +>StaticKeyword : SyntaxKind + + YieldKeyword = 109, +>YieldKeyword : SyntaxKind + + AnyKeyword = 110, +>AnyKeyword : SyntaxKind + + BooleanKeyword = 111, +>BooleanKeyword : SyntaxKind + + ConstructorKeyword = 112, +>ConstructorKeyword : SyntaxKind + + DeclareKeyword = 113, +>DeclareKeyword : SyntaxKind + + GetKeyword = 114, +>GetKeyword : SyntaxKind + + ModuleKeyword = 115, +>ModuleKeyword : SyntaxKind + + RequireKeyword = 116, +>RequireKeyword : SyntaxKind + + NumberKeyword = 117, +>NumberKeyword : SyntaxKind + + SetKeyword = 118, +>SetKeyword : SyntaxKind + + StringKeyword = 119, +>StringKeyword : SyntaxKind + + TypeKeyword = 120, +>TypeKeyword : SyntaxKind + + QualifiedName = 121, +>QualifiedName : SyntaxKind + + ComputedPropertyName = 122, +>ComputedPropertyName : SyntaxKind + + TypeParameter = 123, +>TypeParameter : SyntaxKind + + Parameter = 124, +>Parameter : SyntaxKind + + PropertySignature = 125, +>PropertySignature : SyntaxKind + + PropertyDeclaration = 126, +>PropertyDeclaration : SyntaxKind + + MethodSignature = 127, +>MethodSignature : SyntaxKind + + MethodDeclaration = 128, +>MethodDeclaration : SyntaxKind + + Constructor = 129, +>Constructor : SyntaxKind + + GetAccessor = 130, +>GetAccessor : SyntaxKind + + SetAccessor = 131, +>SetAccessor : SyntaxKind + + CallSignature = 132, +>CallSignature : SyntaxKind + + ConstructSignature = 133, +>ConstructSignature : SyntaxKind + + IndexSignature = 134, +>IndexSignature : SyntaxKind + + TypeReference = 135, +>TypeReference : SyntaxKind + + FunctionType = 136, +>FunctionType : SyntaxKind + + ConstructorType = 137, +>ConstructorType : SyntaxKind + + TypeQuery = 138, +>TypeQuery : SyntaxKind + + TypeLiteral = 139, +>TypeLiteral : SyntaxKind + + ArrayType = 140, +>ArrayType : SyntaxKind + + TupleType = 141, +>TupleType : SyntaxKind + + UnionType = 142, +>UnionType : SyntaxKind + + ParenthesizedType = 143, +>ParenthesizedType : SyntaxKind + + ObjectBindingPattern = 144, +>ObjectBindingPattern : SyntaxKind + + ArrayBindingPattern = 145, +>ArrayBindingPattern : SyntaxKind + + BindingElement = 146, +>BindingElement : SyntaxKind + + ArrayLiteralExpression = 147, +>ArrayLiteralExpression : SyntaxKind + + ObjectLiteralExpression = 148, +>ObjectLiteralExpression : SyntaxKind + + PropertyAccessExpression = 149, +>PropertyAccessExpression : SyntaxKind + + ElementAccessExpression = 150, +>ElementAccessExpression : SyntaxKind + + CallExpression = 151, +>CallExpression : SyntaxKind + + NewExpression = 152, +>NewExpression : SyntaxKind + + TaggedTemplateExpression = 153, +>TaggedTemplateExpression : SyntaxKind + + TypeAssertionExpression = 154, +>TypeAssertionExpression : SyntaxKind + + ParenthesizedExpression = 155, +>ParenthesizedExpression : SyntaxKind + + FunctionExpression = 156, +>FunctionExpression : SyntaxKind + + ArrowFunction = 157, +>ArrowFunction : SyntaxKind + + DeleteExpression = 158, +>DeleteExpression : SyntaxKind + + TypeOfExpression = 159, +>TypeOfExpression : SyntaxKind + + VoidExpression = 160, +>VoidExpression : SyntaxKind + + PrefixUnaryExpression = 161, +>PrefixUnaryExpression : SyntaxKind + + PostfixUnaryExpression = 162, +>PostfixUnaryExpression : SyntaxKind + + BinaryExpression = 163, +>BinaryExpression : SyntaxKind + + ConditionalExpression = 164, +>ConditionalExpression : SyntaxKind + + TemplateExpression = 165, +>TemplateExpression : SyntaxKind + + YieldExpression = 166, +>YieldExpression : SyntaxKind + + SpreadElementExpression = 167, +>SpreadElementExpression : SyntaxKind + + OmittedExpression = 168, +>OmittedExpression : SyntaxKind + + TemplateSpan = 169, +>TemplateSpan : SyntaxKind + + Block = 170, +>Block : SyntaxKind + + VariableStatement = 171, +>VariableStatement : SyntaxKind + + EmptyStatement = 172, +>EmptyStatement : SyntaxKind + + ExpressionStatement = 173, +>ExpressionStatement : SyntaxKind + + IfStatement = 174, +>IfStatement : SyntaxKind + + DoStatement = 175, +>DoStatement : SyntaxKind + + WhileStatement = 176, +>WhileStatement : SyntaxKind + + ForStatement = 177, +>ForStatement : SyntaxKind + + ForInStatement = 178, +>ForInStatement : SyntaxKind + + ContinueStatement = 179, +>ContinueStatement : SyntaxKind + + BreakStatement = 180, +>BreakStatement : SyntaxKind + + ReturnStatement = 181, +>ReturnStatement : SyntaxKind + + WithStatement = 182, +>WithStatement : SyntaxKind + + SwitchStatement = 183, +>SwitchStatement : SyntaxKind + + LabeledStatement = 184, +>LabeledStatement : SyntaxKind + + ThrowStatement = 185, +>ThrowStatement : SyntaxKind + + TryStatement = 186, +>TryStatement : SyntaxKind + + DebuggerStatement = 187, +>DebuggerStatement : SyntaxKind + + VariableDeclaration = 188, +>VariableDeclaration : SyntaxKind + + VariableDeclarationList = 189, +>VariableDeclarationList : SyntaxKind + + FunctionDeclaration = 190, +>FunctionDeclaration : SyntaxKind + + ClassDeclaration = 191, +>ClassDeclaration : SyntaxKind + + InterfaceDeclaration = 192, +>InterfaceDeclaration : SyntaxKind + + TypeAliasDeclaration = 193, +>TypeAliasDeclaration : SyntaxKind + + EnumDeclaration = 194, +>EnumDeclaration : SyntaxKind + + ModuleDeclaration = 195, +>ModuleDeclaration : SyntaxKind + + ModuleBlock = 196, +>ModuleBlock : SyntaxKind + + ImportDeclaration = 197, +>ImportDeclaration : SyntaxKind + + ExportAssignment = 198, +>ExportAssignment : SyntaxKind + + ExternalModuleReference = 199, +>ExternalModuleReference : SyntaxKind + + CaseClause = 200, +>CaseClause : SyntaxKind + + DefaultClause = 201, +>DefaultClause : SyntaxKind + + HeritageClause = 202, +>HeritageClause : SyntaxKind + + CatchClause = 203, +>CatchClause : SyntaxKind + + PropertyAssignment = 204, +>PropertyAssignment : SyntaxKind + + ShorthandPropertyAssignment = 205, +>ShorthandPropertyAssignment : SyntaxKind + + EnumMember = 206, +>EnumMember : SyntaxKind + + SourceFile = 207, +>SourceFile : SyntaxKind + + SyntaxList = 208, +>SyntaxList : SyntaxKind + + Count = 209, +>Count : SyntaxKind + + FirstAssignment = 52, +>FirstAssignment : SyntaxKind + + LastAssignment = 63, +>LastAssignment : SyntaxKind + + FirstReservedWord = 65, +>FirstReservedWord : SyntaxKind + + LastReservedWord = 100, +>LastReservedWord : SyntaxKind + + FirstKeyword = 65, +>FirstKeyword : SyntaxKind + + LastKeyword = 120, +>LastKeyword : SyntaxKind + + FirstFutureReservedWord = 101, +>FirstFutureReservedWord : SyntaxKind + + LastFutureReservedWord = 109, +>LastFutureReservedWord : SyntaxKind + + FirstTypeNode = 135, +>FirstTypeNode : SyntaxKind + + LastTypeNode = 143, +>LastTypeNode : SyntaxKind + + FirstPunctuation = 14, +>FirstPunctuation : SyntaxKind + + LastPunctuation = 63, +>LastPunctuation : SyntaxKind + + FirstToken = 0, +>FirstToken : SyntaxKind + + LastToken = 120, +>LastToken : SyntaxKind + + FirstTriviaToken = 2, +>FirstTriviaToken : SyntaxKind + + LastTriviaToken = 6, +>LastTriviaToken : SyntaxKind + + FirstLiteralToken = 7, +>FirstLiteralToken : SyntaxKind + + LastLiteralToken = 10, +>LastLiteralToken : SyntaxKind + + FirstTemplateToken = 10, +>FirstTemplateToken : SyntaxKind + + LastTemplateToken = 13, +>LastTemplateToken : SyntaxKind + + FirstBinaryOperator = 24, +>FirstBinaryOperator : SyntaxKind + + LastBinaryOperator = 63, +>LastBinaryOperator : SyntaxKind + + FirstNode = 121, +>FirstNode : SyntaxKind + } + const enum NodeFlags { +>NodeFlags : NodeFlags + + Export = 1, +>Export : NodeFlags + + Ambient = 2, +>Ambient : NodeFlags + + Public = 16, +>Public : NodeFlags + + Private = 32, +>Private : NodeFlags + + Protected = 64, +>Protected : NodeFlags + + Static = 128, +>Static : NodeFlags + + MultiLine = 256, +>MultiLine : NodeFlags + + Synthetic = 512, +>Synthetic : NodeFlags + + DeclarationFile = 1024, +>DeclarationFile : NodeFlags + + Let = 2048, +>Let : NodeFlags + + Const = 4096, +>Const : NodeFlags + + OctalLiteral = 8192, +>OctalLiteral : NodeFlags + + Modifier = 243, +>Modifier : NodeFlags + + AccessibilityModifier = 112, +>AccessibilityModifier : NodeFlags + + BlockScoped = 6144, +>BlockScoped : NodeFlags + } + const enum ParserContextFlags { +>ParserContextFlags : ParserContextFlags + + StrictMode = 1, +>StrictMode : ParserContextFlags + + DisallowIn = 2, +>DisallowIn : ParserContextFlags + + Yield = 4, +>Yield : ParserContextFlags + + GeneratorParameter = 8, +>GeneratorParameter : ParserContextFlags + + ThisNodeHasError = 16, +>ThisNodeHasError : ParserContextFlags + + ParserGeneratedFlags = 31, +>ParserGeneratedFlags : ParserContextFlags + + ThisNodeOrAnySubNodesHasError = 32, +>ThisNodeOrAnySubNodesHasError : ParserContextFlags + + HasAggregatedChildData = 64, +>HasAggregatedChildData : ParserContextFlags + } + const enum RelationComparisonResult { +>RelationComparisonResult : RelationComparisonResult + + Succeeded = 1, +>Succeeded : RelationComparisonResult + + Failed = 2, +>Failed : RelationComparisonResult + + FailedAndReported = 3, +>FailedAndReported : RelationComparisonResult + } + interface Node extends TextRange { +>Node : Node +>TextRange : TextRange + + kind: SyntaxKind; +>kind : SyntaxKind +>SyntaxKind : SyntaxKind + + flags: NodeFlags; +>flags : NodeFlags +>NodeFlags : NodeFlags + + parserContextFlags?: ParserContextFlags; +>parserContextFlags : ParserContextFlags +>ParserContextFlags : ParserContextFlags + + id?: number; +>id : number + + parent?: Node; +>parent : Node +>Node : Node + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + + locals?: SymbolTable; +>locals : SymbolTable +>SymbolTable : SymbolTable + + nextContainer?: Node; +>nextContainer : Node +>Node : Node + + localSymbol?: Symbol; +>localSymbol : Symbol +>Symbol : Symbol + + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + } + interface NodeArray extends Array, TextRange { +>NodeArray : NodeArray +>T : T +>Array : T[] +>T : T +>TextRange : TextRange + + hasTrailingComma?: boolean; +>hasTrailingComma : boolean + } + interface ModifiersArray extends NodeArray { +>ModifiersArray : ModifiersArray +>NodeArray : NodeArray +>Node : Node + + flags: number; +>flags : number + } + interface Identifier extends PrimaryExpression { +>Identifier : Identifier +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + } + interface QualifiedName extends Node { +>QualifiedName : QualifiedName +>Node : Node + + left: EntityName; +>left : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + right: Identifier; +>right : Identifier +>Identifier : Identifier + } + type EntityName = Identifier | QualifiedName; +>EntityName : Identifier | QualifiedName +>Identifier : Identifier +>QualifiedName : QualifiedName + + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>Identifier : Identifier +>LiteralExpression : LiteralExpression +>ComputedPropertyName : ComputedPropertyName +>BindingPattern : BindingPattern + + interface Declaration extends Node { +>Declaration : Declaration +>Node : Node + + _declarationBrand: any; +>_declarationBrand : any + + name?: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + } + interface ComputedPropertyName extends Node { +>ComputedPropertyName : ComputedPropertyName +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TypeParameterDeclaration extends Declaration { +>TypeParameterDeclaration : TypeParameterDeclaration +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + constraint?: TypeNode; +>constraint : TypeNode +>TypeNode : TypeNode + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface SignatureDeclaration extends Declaration { +>SignatureDeclaration : SignatureDeclaration +>Declaration : Declaration + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + parameters: NodeArray; +>parameters : NodeArray +>NodeArray : NodeArray +>ParameterDeclaration : ParameterDeclaration + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface VariableDeclaration extends Declaration { +>VariableDeclaration : VariableDeclaration +>Declaration : Declaration + + parent?: VariableDeclarationList; +>parent : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface VariableDeclarationList extends Node { +>VariableDeclarationList : VariableDeclarationList +>Node : Node + + declarations: NodeArray; +>declarations : NodeArray +>NodeArray : NodeArray +>VariableDeclaration : VariableDeclaration + } + interface ParameterDeclaration extends Declaration { +>ParameterDeclaration : ParameterDeclaration +>Declaration : Declaration + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingElement extends Declaration { +>BindingElement : BindingElement +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface PropertyDeclaration extends Declaration, ClassElement { +>PropertyDeclaration : PropertyDeclaration +>Declaration : Declaration +>ClassElement : ClassElement + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface ObjectLiteralElement extends Declaration { +>ObjectLiteralElement : ObjectLiteralElement +>Declaration : Declaration + + _objectLiteralBrandBrand: any; +>_objectLiteralBrandBrand : any + } + interface PropertyAssignment extends ObjectLiteralElement { +>PropertyAssignment : PropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + _propertyAssignmentBrand: any; +>_propertyAssignmentBrand : any + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + initializer: Expression; +>initializer : Expression +>Expression : Expression + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { +>ShorthandPropertyAssignment : ShorthandPropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + questionToken?: Node; +>questionToken : Node +>Node : Node + } + interface VariableLikeDeclaration extends Declaration { +>VariableLikeDeclaration : VariableLikeDeclaration +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingPattern extends Node { +>BindingPattern : BindingPattern +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>BindingElement : BindingElement + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { +>FunctionLikeDeclaration : FunctionLikeDeclaration +>SignatureDeclaration : SignatureDeclaration + + _functionLikeDeclarationBrand: any; +>_functionLikeDeclarationBrand : any + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + questionToken?: Node; +>questionToken : Node +>Node : Node + + body?: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { +>FunctionDeclaration : FunctionDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>Statement : Statement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + body?: Block; +>body : Block +>Block : Block + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>MethodDeclaration : MethodDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + body?: Block; +>body : Block +>Block : Block + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { +>ConstructorDeclaration : ConstructorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement + + body?: Block; +>body : Block +>Block : Block + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>AccessorDeclaration : AccessorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + _accessorDeclarationBrand: any; +>_accessorDeclarationBrand : any + + body: Block; +>body : Block +>Block : Block + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { +>IndexSignatureDeclaration : IndexSignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>ClassElement : ClassElement + + _indexSignatureDeclarationBrand: any; +>_indexSignatureDeclarationBrand : any + } + interface TypeNode extends Node { +>TypeNode : TypeNode +>Node : Node + + _typeNodeBrand: any; +>_typeNodeBrand : any + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { +>FunctionOrConstructorTypeNode : FunctionOrConstructorTypeNode +>TypeNode : TypeNode +>SignatureDeclaration : SignatureDeclaration + + _functionOrConstructorTypeNodeBrand: any; +>_functionOrConstructorTypeNodeBrand : any + } + interface TypeReferenceNode extends TypeNode { +>TypeReferenceNode : TypeReferenceNode +>TypeNode : TypeNode + + typeName: EntityName; +>typeName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface TypeQueryNode extends TypeNode { +>TypeQueryNode : TypeQueryNode +>TypeNode : TypeNode + + exprName: EntityName; +>exprName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + } + interface TypeLiteralNode extends TypeNode, Declaration { +>TypeLiteralNode : TypeLiteralNode +>TypeNode : TypeNode +>Declaration : Declaration + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Node : Node + } + interface ArrayTypeNode extends TypeNode { +>ArrayTypeNode : ArrayTypeNode +>TypeNode : TypeNode + + elementType: TypeNode; +>elementType : TypeNode +>TypeNode : TypeNode + } + interface TupleTypeNode extends TypeNode { +>TupleTypeNode : TupleTypeNode +>TypeNode : TypeNode + + elementTypes: NodeArray; +>elementTypes : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface UnionTypeNode extends TypeNode { +>UnionTypeNode : UnionTypeNode +>TypeNode : TypeNode + + types: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface ParenthesizedTypeNode extends TypeNode { +>ParenthesizedTypeNode : ParenthesizedTypeNode +>TypeNode : TypeNode + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { +>StringLiteralTypeNode : StringLiteralTypeNode +>LiteralExpression : LiteralExpression +>TypeNode : TypeNode + } + interface Expression extends Node { +>Expression : Expression +>Node : Node + + _expressionBrand: any; +>_expressionBrand : any + + contextualType?: Type; +>contextualType : Type +>Type : Type + } + interface UnaryExpression extends Expression { +>UnaryExpression : UnaryExpression +>Expression : Expression + + _unaryExpressionBrand: any; +>_unaryExpressionBrand : any + } + interface PrefixUnaryExpression extends UnaryExpression { +>PrefixUnaryExpression : PrefixUnaryExpression +>UnaryExpression : UnaryExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + operand: UnaryExpression; +>operand : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface PostfixUnaryExpression extends PostfixExpression { +>PostfixUnaryExpression : PostfixUnaryExpression +>PostfixExpression : PostfixExpression + + operand: LeftHandSideExpression; +>operand : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + } + interface PostfixExpression extends UnaryExpression { +>PostfixExpression : PostfixExpression +>UnaryExpression : UnaryExpression + + _postfixExpressionBrand: any; +>_postfixExpressionBrand : any + } + interface LeftHandSideExpression extends PostfixExpression { +>LeftHandSideExpression : LeftHandSideExpression +>PostfixExpression : PostfixExpression + + _leftHandSideExpressionBrand: any; +>_leftHandSideExpressionBrand : any + } + interface MemberExpression extends LeftHandSideExpression { +>MemberExpression : MemberExpression +>LeftHandSideExpression : LeftHandSideExpression + + _memberExpressionBrand: any; +>_memberExpressionBrand : any + } + interface PrimaryExpression extends MemberExpression { +>PrimaryExpression : PrimaryExpression +>MemberExpression : MemberExpression + + _primaryExpressionBrand: any; +>_primaryExpressionBrand : any + } + interface DeleteExpression extends UnaryExpression { +>DeleteExpression : DeleteExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface TypeOfExpression extends UnaryExpression { +>TypeOfExpression : TypeOfExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface VoidExpression extends UnaryExpression { +>VoidExpression : VoidExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface YieldExpression extends Expression { +>YieldExpression : YieldExpression +>Expression : Expression + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BinaryExpression extends Expression { +>BinaryExpression : BinaryExpression +>Expression : Expression + + left: Expression; +>left : Expression +>Expression : Expression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + right: Expression; +>right : Expression +>Expression : Expression + } + interface ConditionalExpression extends Expression { +>ConditionalExpression : ConditionalExpression +>Expression : Expression + + condition: Expression; +>condition : Expression +>Expression : Expression + + whenTrue: Expression; +>whenTrue : Expression +>Expression : Expression + + whenFalse: Expression; +>whenFalse : Expression +>Expression : Expression + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { +>FunctionExpression : FunctionExpression +>PrimaryExpression : PrimaryExpression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface LiteralExpression extends PrimaryExpression { +>LiteralExpression : LiteralExpression +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + + isUnterminated?: boolean; +>isUnterminated : boolean + } + interface StringLiteralExpression extends LiteralExpression { +>StringLiteralExpression : StringLiteralExpression +>LiteralExpression : LiteralExpression + + _stringLiteralExpressionBrand: any; +>_stringLiteralExpressionBrand : any + } + interface TemplateExpression extends PrimaryExpression { +>TemplateExpression : TemplateExpression +>PrimaryExpression : PrimaryExpression + + head: LiteralExpression; +>head : LiteralExpression +>LiteralExpression : LiteralExpression + + templateSpans: NodeArray; +>templateSpans : NodeArray +>NodeArray : NodeArray +>TemplateSpan : TemplateSpan + } + interface TemplateSpan extends Node { +>TemplateSpan : TemplateSpan +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + + literal: LiteralExpression; +>literal : LiteralExpression +>LiteralExpression : LiteralExpression + } + interface ParenthesizedExpression extends PrimaryExpression { +>ParenthesizedExpression : ParenthesizedExpression +>PrimaryExpression : PrimaryExpression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ArrayLiteralExpression extends PrimaryExpression { +>ArrayLiteralExpression : ArrayLiteralExpression +>PrimaryExpression : PrimaryExpression + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface SpreadElementExpression extends Expression { +>SpreadElementExpression : SpreadElementExpression +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { +>ObjectLiteralExpression : ObjectLiteralExpression +>PrimaryExpression : PrimaryExpression +>Declaration : Declaration + + properties: NodeArray; +>properties : NodeArray +>NodeArray : NodeArray +>ObjectLiteralElement : ObjectLiteralElement + } + interface PropertyAccessExpression extends MemberExpression { +>PropertyAccessExpression : PropertyAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ElementAccessExpression extends MemberExpression { +>ElementAccessExpression : ElementAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + argumentExpression?: Expression; +>argumentExpression : Expression +>Expression : Expression + } + interface CallExpression extends LeftHandSideExpression { +>CallExpression : CallExpression +>LeftHandSideExpression : LeftHandSideExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + + arguments: NodeArray; +>arguments : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface NewExpression extends CallExpression, PrimaryExpression { +>NewExpression : NewExpression +>CallExpression : CallExpression +>PrimaryExpression : PrimaryExpression + } + interface TaggedTemplateExpression extends MemberExpression { +>TaggedTemplateExpression : TaggedTemplateExpression +>MemberExpression : MemberExpression + + tag: LeftHandSideExpression; +>tag : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + template: LiteralExpression | TemplateExpression; +>template : LiteralExpression | TemplateExpression +>LiteralExpression : LiteralExpression +>TemplateExpression : TemplateExpression + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>CallExpression : CallExpression +>NewExpression : NewExpression +>TaggedTemplateExpression : TaggedTemplateExpression + + interface TypeAssertion extends UnaryExpression { +>TypeAssertion : TypeAssertion +>UnaryExpression : UnaryExpression + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface Statement extends Node, ModuleElement { +>Statement : Statement +>Node : Node +>ModuleElement : ModuleElement + + _statementBrand: any; +>_statementBrand : any + } + interface Block extends Statement { +>Block : Block +>Statement : Statement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface VariableStatement extends Statement { +>VariableStatement : VariableStatement +>Statement : Statement + + declarationList: VariableDeclarationList; +>declarationList : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + } + interface ExpressionStatement extends Statement { +>ExpressionStatement : ExpressionStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface IfStatement extends Statement { +>IfStatement : IfStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + thenStatement: Statement; +>thenStatement : Statement +>Statement : Statement + + elseStatement?: Statement; +>elseStatement : Statement +>Statement : Statement + } + interface IterationStatement extends Statement { +>IterationStatement : IterationStatement +>Statement : Statement + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface DoStatement extends IterationStatement { +>DoStatement : DoStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface WhileStatement extends IterationStatement { +>WhileStatement : WhileStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForStatement extends IterationStatement { +>ForStatement : ForStatement +>IterationStatement : IterationStatement + + initializer?: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + condition?: Expression; +>condition : Expression +>Expression : Expression + + iterator?: Expression; +>iterator : Expression +>Expression : Expression + } + interface ForInStatement extends IterationStatement { +>ForInStatement : ForInStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BreakOrContinueStatement extends Statement { +>BreakOrContinueStatement : BreakOrContinueStatement +>Statement : Statement + + label?: Identifier; +>label : Identifier +>Identifier : Identifier + } + interface ReturnStatement extends Statement { +>ReturnStatement : ReturnStatement +>Statement : Statement + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface WithStatement extends Statement { +>WithStatement : WithStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface SwitchStatement extends Statement { +>SwitchStatement : SwitchStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + clauses: NodeArray; +>clauses : NodeArray +>NodeArray : NodeArray +>CaseOrDefaultClause : CaseClause | DefaultClause + } + interface CaseClause extends Node { +>CaseClause : CaseClause +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface DefaultClause extends Node { +>DefaultClause : DefaultClause +>Node : Node + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + type CaseOrDefaultClause = CaseClause | DefaultClause; +>CaseOrDefaultClause : CaseClause | DefaultClause +>CaseClause : CaseClause +>DefaultClause : DefaultClause + + interface LabeledStatement extends Statement { +>LabeledStatement : LabeledStatement +>Statement : Statement + + label: Identifier; +>label : Identifier +>Identifier : Identifier + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface ThrowStatement extends Statement { +>ThrowStatement : ThrowStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TryStatement extends Statement { +>TryStatement : TryStatement +>Statement : Statement + + tryBlock: Block; +>tryBlock : Block +>Block : Block + + catchClause?: CatchClause; +>catchClause : CatchClause +>CatchClause : CatchClause + + finallyBlock?: Block; +>finallyBlock : Block +>Block : Block + } + interface CatchClause extends Declaration { +>CatchClause : CatchClause +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + block: Block; +>block : Block +>Block : Block + } + interface ModuleElement extends Node { +>ModuleElement : ModuleElement +>Node : Node + + _moduleElementBrand: any; +>_moduleElementBrand : any + } + interface ClassDeclaration extends Declaration, ModuleElement { +>ClassDeclaration : ClassDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>ClassElement : ClassElement + } + interface ClassElement extends Declaration { +>ClassElement : ClassElement +>Declaration : Declaration + + _classElementBrand: any; +>_classElementBrand : any + } + interface InterfaceDeclaration extends Declaration, ModuleElement { +>InterfaceDeclaration : InterfaceDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Declaration : Declaration + } + interface HeritageClause extends Node { +>HeritageClause : HeritageClause +>Node : Node + + token: SyntaxKind; +>token : SyntaxKind +>SyntaxKind : SyntaxKind + + types?: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeReferenceNode : TypeReferenceNode + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { +>TypeAliasDeclaration : TypeAliasDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface EnumMember extends Declaration { +>EnumMember : EnumMember +>Declaration : Declaration + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface EnumDeclaration extends Declaration, ModuleElement { +>EnumDeclaration : EnumDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>EnumMember : EnumMember + } + interface ModuleDeclaration extends Declaration, ModuleElement { +>ModuleDeclaration : ModuleDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier | LiteralExpression; +>name : Identifier | LiteralExpression +>Identifier : Identifier +>LiteralExpression : LiteralExpression + + body: ModuleBlock | ModuleDeclaration; +>body : ModuleDeclaration | ModuleBlock +>ModuleBlock : ModuleBlock +>ModuleDeclaration : ModuleDeclaration + } + interface ModuleBlock extends Node, ModuleElement { +>ModuleBlock : ModuleBlock +>Node : Node +>ModuleElement : ModuleElement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + } + interface ImportDeclaration extends Declaration, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + moduleReference: EntityName | ExternalModuleReference; +>moduleReference : Identifier | QualifiedName | ExternalModuleReference +>EntityName : Identifier | QualifiedName +>ExternalModuleReference : ExternalModuleReference + } + interface ExternalModuleReference extends Node { +>ExternalModuleReference : ExternalModuleReference +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface ExportAssignment extends Statement, ModuleElement { +>ExportAssignment : ExportAssignment +>Statement : Statement +>ModuleElement : ModuleElement + + exportName: Identifier; +>exportName : Identifier +>Identifier : Identifier + } + interface FileReference extends TextRange { +>FileReference : FileReference +>TextRange : TextRange + + fileName: string; +>fileName : string + } + interface CommentRange extends TextRange { +>CommentRange : CommentRange +>TextRange : TextRange + + hasTrailingNewLine?: boolean; +>hasTrailingNewLine : boolean + } + interface SourceFile extends Declaration { +>SourceFile : SourceFile +>Declaration : Declaration + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + + endOfFileToken: Node; +>endOfFileToken : Node +>Node : Node + + fileName: string; +>fileName : string + + text: string; +>text : string + + amdDependencies: string[]; +>amdDependencies : string[] + + amdModuleName: string; +>amdModuleName : string + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + hasNoDefaultLib: boolean; +>hasNoDefaultLib : boolean + + externalModuleIndicator: Node; +>externalModuleIndicator : Node +>Node : Node + + languageVersion: ScriptTarget; +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + identifiers: Map; +>identifiers : Map +>Map : Map + } + interface ScriptReferenceHost { +>ScriptReferenceHost : ScriptReferenceHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + } + interface WriteFileCallback { +>WriteFileCallback : WriteFileCallback + + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>fileName : string +>data : string +>writeByteOrderMark : boolean +>onError : (message: string) => void +>message : string + } + interface Program extends ScriptReferenceHost { +>Program : Program +>ScriptReferenceHost : ScriptReferenceHost + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; +>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult +>targetSourceFile : SourceFile +>SourceFile : SourceFile +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback +>EmitResult : EmitResult + + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSyntacticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getGlobalDiagnostics(): Diagnostic[]; +>getGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSemanticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getDeclarationDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeChecker(): TypeChecker; +>getTypeChecker : () => TypeChecker +>TypeChecker : TypeChecker + + getCommonSourceDirectory(): string; +>getCommonSourceDirectory : () => string + } + interface SourceMapSpan { +>SourceMapSpan : SourceMapSpan + + emittedLine: number; +>emittedLine : number + + emittedColumn: number; +>emittedColumn : number + + sourceLine: number; +>sourceLine : number + + sourceColumn: number; +>sourceColumn : number + + nameIndex?: number; +>nameIndex : number + + sourceIndex: number; +>sourceIndex : number + } + interface SourceMapData { +>SourceMapData : SourceMapData + + sourceMapFilePath: string; +>sourceMapFilePath : string + + jsSourceMappingURL: string; +>jsSourceMappingURL : string + + sourceMapFile: string; +>sourceMapFile : string + + sourceMapSourceRoot: string; +>sourceMapSourceRoot : string + + sourceMapSources: string[]; +>sourceMapSources : string[] + + inputSourceFileNames: string[]; +>inputSourceFileNames : string[] + + sourceMapNames?: string[]; +>sourceMapNames : string[] + + sourceMapMappings: string; +>sourceMapMappings : string + + sourceMapDecodedMappings: SourceMapSpan[]; +>sourceMapDecodedMappings : SourceMapSpan[] +>SourceMapSpan : SourceMapSpan + } + enum ExitStatus { +>ExitStatus : ExitStatus + + Success = 0, +>Success : ExitStatus + + DiagnosticsPresent_OutputsSkipped = 1, +>DiagnosticsPresent_OutputsSkipped : ExitStatus + + DiagnosticsPresent_OutputsGenerated = 2, +>DiagnosticsPresent_OutputsGenerated : ExitStatus + } + interface EmitResult { +>EmitResult : EmitResult + + emitSkipped: boolean; +>emitSkipped : boolean + + diagnostics: Diagnostic[]; +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + + sourceMaps: SourceMapData[]; +>sourceMaps : SourceMapData[] +>SourceMapData : SourceMapData + } + interface TypeCheckerHost { +>TypeCheckerHost : TypeCheckerHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + } + interface TypeChecker { +>TypeChecker : TypeChecker + + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; +>getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type +>symbol : Symbol +>Symbol : Symbol +>node : Node +>Node : Node +>Type : Type + + getDeclaredTypeOfSymbol(symbol: Symbol): Type; +>getDeclaredTypeOfSymbol : (symbol: Symbol) => Type +>symbol : Symbol +>Symbol : Symbol +>Type : Type + + getPropertiesOfType(type: Type): Symbol[]; +>getPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getPropertyOfType(type: Type, propertyName: string): Symbol; +>getPropertyOfType : (type: Type, propertyName: string) => Symbol +>type : Type +>Type : Type +>propertyName : string +>Symbol : Symbol + + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; +>getSignaturesOfType : (type: Type, kind: SignatureKind) => Signature[] +>type : Type +>Type : Type +>kind : SignatureKind +>SignatureKind : SignatureKind +>Signature : Signature + + getIndexTypeOfType(type: Type, kind: IndexKind): Type; +>getIndexTypeOfType : (type: Type, kind: IndexKind) => Type +>type : Type +>Type : Type +>kind : IndexKind +>IndexKind : IndexKind +>Type : Type + + getReturnTypeOfSignature(signature: Signature): Type; +>getReturnTypeOfSignature : (signature: Signature) => Type +>signature : Signature +>Signature : Signature +>Type : Type + + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; +>getSymbolsInScope : (location: Node, meaning: SymbolFlags) => Symbol[] +>location : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>Symbol : Symbol + + getSymbolAtLocation(node: Node): Symbol; +>getSymbolAtLocation : (node: Node) => Symbol +>node : Node +>Node : Node +>Symbol : Symbol + + getShorthandAssignmentValueSymbol(location: Node): Symbol; +>getShorthandAssignmentValueSymbol : (location: Node) => Symbol +>location : Node +>Node : Node +>Symbol : Symbol + + getTypeAtLocation(node: Node): Type; +>getTypeAtLocation : (node: Node) => Type +>node : Node +>Node : Node +>Type : Type + + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; +>typeToString : (type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => string +>type : Type +>Type : Type +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; +>symbolToString : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => string +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + + getSymbolDisplayBuilder(): SymbolDisplayBuilder; +>getSymbolDisplayBuilder : () => SymbolDisplayBuilder +>SymbolDisplayBuilder : SymbolDisplayBuilder + + getFullyQualifiedName(symbol: Symbol): string; +>getFullyQualifiedName : (symbol: Symbol) => string +>symbol : Symbol +>Symbol : Symbol + + getAugmentedPropertiesOfType(type: Type): Symbol[]; +>getAugmentedPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getRootSymbols(symbol: Symbol): Symbol[]; +>getRootSymbols : (symbol: Symbol) => Symbol[] +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getContextualType(node: Expression): Type; +>getContextualType : (node: Expression) => Type +>node : Expression +>Expression : Expression +>Type : Type + + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; +>getResolvedSignature : (node: CallExpression | NewExpression | TaggedTemplateExpression, candidatesOutArray?: Signature[]) => Signature +>node : CallExpression | NewExpression | TaggedTemplateExpression +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>candidatesOutArray : Signature[] +>Signature : Signature +>Signature : Signature + + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; +>getSignatureFromDeclaration : (declaration: SignatureDeclaration) => Signature +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>Signature : Signature + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + isUndefinedSymbol(symbol: Symbol): boolean; +>isUndefinedSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + isArgumentsSymbol(symbol: Symbol): boolean; +>isArgumentsSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; +>isValidPropertyAccess : (node: QualifiedName | PropertyAccessExpression, propertyName: string) => boolean +>node : QualifiedName | PropertyAccessExpression +>PropertyAccessExpression : PropertyAccessExpression +>QualifiedName : QualifiedName +>propertyName : string + + getAliasedSymbol(symbol: Symbol): Symbol; +>getAliasedSymbol : (symbol: Symbol) => Symbol +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + } + interface SymbolDisplayBuilder { +>SymbolDisplayBuilder : SymbolDisplayBuilder + + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeDisplay : (type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>type : Type +>Type : Type +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; +>buildSymbolDisplay : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>flags : SymbolFormatFlags +>SymbolFormatFlags : SymbolFormatFlags + + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildSignatureDisplay : (signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signatures : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildParameterDisplay : (parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameter : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplay : (tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>tp : TypeParameter +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplayFromSymbol : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaraiton : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForParametersAndDelimiters : (parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameters : Symbol[] +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForTypeParametersAndDelimiters : (typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildReturnTypeDisplay : (signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signature : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + } + interface SymbolWriter { +>SymbolWriter : SymbolWriter + + writeKeyword(text: string): void; +>writeKeyword : (text: string) => void +>text : string + + writeOperator(text: string): void; +>writeOperator : (text: string) => void +>text : string + + writePunctuation(text: string): void; +>writePunctuation : (text: string) => void +>text : string + + writeSpace(text: string): void; +>writeSpace : (text: string) => void +>text : string + + writeStringLiteral(text: string): void; +>writeStringLiteral : (text: string) => void +>text : string + + writeParameter(text: string): void; +>writeParameter : (text: string) => void +>text : string + + writeSymbol(text: string, symbol: Symbol): void; +>writeSymbol : (text: string, symbol: Symbol) => void +>text : string +>symbol : Symbol +>Symbol : Symbol + + writeLine(): void; +>writeLine : () => void + + increaseIndent(): void; +>increaseIndent : () => void + + decreaseIndent(): void; +>decreaseIndent : () => void + + clear(): void; +>clear : () => void + + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; +>trackSymbol : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => void +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + } + const enum TypeFormatFlags { +>TypeFormatFlags : TypeFormatFlags + + None = 0, +>None : TypeFormatFlags + + WriteArrayAsGenericType = 1, +>WriteArrayAsGenericType : TypeFormatFlags + + UseTypeOfFunction = 2, +>UseTypeOfFunction : TypeFormatFlags + + NoTruncation = 4, +>NoTruncation : TypeFormatFlags + + WriteArrowStyleSignature = 8, +>WriteArrowStyleSignature : TypeFormatFlags + + WriteOwnNameForAnyLike = 16, +>WriteOwnNameForAnyLike : TypeFormatFlags + + WriteTypeArgumentsOfSignature = 32, +>WriteTypeArgumentsOfSignature : TypeFormatFlags + + InElementType = 64, +>InElementType : TypeFormatFlags + + UseFullyQualifiedType = 128, +>UseFullyQualifiedType : TypeFormatFlags + } + const enum SymbolFormatFlags { +>SymbolFormatFlags : SymbolFormatFlags + + None = 0, +>None : SymbolFormatFlags + + WriteTypeParametersOrArguments = 1, +>WriteTypeParametersOrArguments : SymbolFormatFlags + + UseOnlyExternalAliasing = 2, +>UseOnlyExternalAliasing : SymbolFormatFlags + } + const enum SymbolAccessibility { +>SymbolAccessibility : SymbolAccessibility + + Accessible = 0, +>Accessible : SymbolAccessibility + + NotAccessible = 1, +>NotAccessible : SymbolAccessibility + + CannotBeNamed = 2, +>CannotBeNamed : SymbolAccessibility + } + interface SymbolVisibilityResult { +>SymbolVisibilityResult : SymbolVisibilityResult + + accessibility: SymbolAccessibility; +>accessibility : SymbolAccessibility +>SymbolAccessibility : SymbolAccessibility + + aliasesToMakeVisible?: ImportDeclaration[]; +>aliasesToMakeVisible : ImportDeclaration[] +>ImportDeclaration : ImportDeclaration + + errorSymbolName?: string; +>errorSymbolName : string + + errorNode?: Node; +>errorNode : Node +>Node : Node + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { +>SymbolAccessiblityResult : SymbolAccessiblityResult +>SymbolVisibilityResult : SymbolVisibilityResult + + errorModuleName?: string; +>errorModuleName : string + } + interface EmitResolver { +>EmitResolver : EmitResolver + + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; +>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string +>container : EnumDeclaration | ModuleDeclaration +>ModuleDeclaration : ModuleDeclaration +>EnumDeclaration : EnumDeclaration + + getExpressionNamePrefix(node: Identifier): string; +>getExpressionNamePrefix : (node: Identifier) => string +>node : Identifier +>Identifier : Identifier + + getExportAssignmentName(node: SourceFile): string; +>getExportAssignmentName : (node: SourceFile) => string +>node : SourceFile +>SourceFile : SourceFile + + isReferencedImportDeclaration(node: ImportDeclaration): boolean; +>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; +>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + getNodeCheckFlags(node: Node): NodeCheckFlags; +>getNodeCheckFlags : (node: Node) => NodeCheckFlags +>node : Node +>Node : Node +>NodeCheckFlags : NodeCheckFlags + + isDeclarationVisible(node: Declaration): boolean; +>isDeclarationVisible : (node: Declaration) => boolean +>node : Declaration +>Declaration : Declaration + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfDeclaration : (declaration: VariableLikeDeclaration | AccessorDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>declaration : VariableLikeDeclaration | AccessorDeclaration +>AccessorDeclaration : AccessorDeclaration +>VariableLikeDeclaration : VariableLikeDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>signatureDeclaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; +>isSymbolAccessible : (symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) => SymbolAccessiblityResult +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>SymbolAccessiblityResult : SymbolAccessiblityResult + + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName +>enclosingDeclaration : Node +>Node : Node +>SymbolVisibilityResult : SymbolVisibilityResult + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean +>location : Node +>Node : Node +>name : string + } + const enum SymbolFlags { +>SymbolFlags : SymbolFlags + + FunctionScopedVariable = 1, +>FunctionScopedVariable : SymbolFlags + + BlockScopedVariable = 2, +>BlockScopedVariable : SymbolFlags + + Property = 4, +>Property : SymbolFlags + + EnumMember = 8, +>EnumMember : SymbolFlags + + Function = 16, +>Function : SymbolFlags + + Class = 32, +>Class : SymbolFlags + + Interface = 64, +>Interface : SymbolFlags + + ConstEnum = 128, +>ConstEnum : SymbolFlags + + RegularEnum = 256, +>RegularEnum : SymbolFlags + + ValueModule = 512, +>ValueModule : SymbolFlags + + NamespaceModule = 1024, +>NamespaceModule : SymbolFlags + + TypeLiteral = 2048, +>TypeLiteral : SymbolFlags + + ObjectLiteral = 4096, +>ObjectLiteral : SymbolFlags + + Method = 8192, +>Method : SymbolFlags + + Constructor = 16384, +>Constructor : SymbolFlags + + GetAccessor = 32768, +>GetAccessor : SymbolFlags + + SetAccessor = 65536, +>SetAccessor : SymbolFlags + + Signature = 131072, +>Signature : SymbolFlags + + TypeParameter = 262144, +>TypeParameter : SymbolFlags + + TypeAlias = 524288, +>TypeAlias : SymbolFlags + + ExportValue = 1048576, +>ExportValue : SymbolFlags + + ExportType = 2097152, +>ExportType : SymbolFlags + + ExportNamespace = 4194304, +>ExportNamespace : SymbolFlags + + Import = 8388608, +>Import : SymbolFlags + + Instantiated = 16777216, +>Instantiated : SymbolFlags + + Merged = 33554432, +>Merged : SymbolFlags + + Transient = 67108864, +>Transient : SymbolFlags + + Prototype = 134217728, +>Prototype : SymbolFlags + + UnionProperty = 268435456, +>UnionProperty : SymbolFlags + + Optional = 536870912, +>Optional : SymbolFlags + + Enum = 384, +>Enum : SymbolFlags + + Variable = 3, +>Variable : SymbolFlags + + Value = 107455, +>Value : SymbolFlags + + Type = 793056, +>Type : SymbolFlags + + Namespace = 1536, +>Namespace : SymbolFlags + + Module = 1536, +>Module : SymbolFlags + + Accessor = 98304, +>Accessor : SymbolFlags + + FunctionScopedVariableExcludes = 107454, +>FunctionScopedVariableExcludes : SymbolFlags + + BlockScopedVariableExcludes = 107455, +>BlockScopedVariableExcludes : SymbolFlags + + ParameterExcludes = 107455, +>ParameterExcludes : SymbolFlags + + PropertyExcludes = 107455, +>PropertyExcludes : SymbolFlags + + EnumMemberExcludes = 107455, +>EnumMemberExcludes : SymbolFlags + + FunctionExcludes = 106927, +>FunctionExcludes : SymbolFlags + + ClassExcludes = 899583, +>ClassExcludes : SymbolFlags + + InterfaceExcludes = 792992, +>InterfaceExcludes : SymbolFlags + + RegularEnumExcludes = 899327, +>RegularEnumExcludes : SymbolFlags + + ConstEnumExcludes = 899967, +>ConstEnumExcludes : SymbolFlags + + ValueModuleExcludes = 106639, +>ValueModuleExcludes : SymbolFlags + + NamespaceModuleExcludes = 0, +>NamespaceModuleExcludes : SymbolFlags + + MethodExcludes = 99263, +>MethodExcludes : SymbolFlags + + GetAccessorExcludes = 41919, +>GetAccessorExcludes : SymbolFlags + + SetAccessorExcludes = 74687, +>SetAccessorExcludes : SymbolFlags + + TypeParameterExcludes = 530912, +>TypeParameterExcludes : SymbolFlags + + TypeAliasExcludes = 793056, +>TypeAliasExcludes : SymbolFlags + + ImportExcludes = 8388608, +>ImportExcludes : SymbolFlags + + ModuleMember = 8914931, +>ModuleMember : SymbolFlags + + ExportHasLocal = 944, +>ExportHasLocal : SymbolFlags + + HasLocals = 255504, +>HasLocals : SymbolFlags + + HasExports = 1952, +>HasExports : SymbolFlags + + HasMembers = 6240, +>HasMembers : SymbolFlags + + IsContainer = 262128, +>IsContainer : SymbolFlags + + PropertyOrAccessor = 98308, +>PropertyOrAccessor : SymbolFlags + + Export = 7340032, +>Export : SymbolFlags + } + interface Symbol { +>Symbol : Symbol + + flags: SymbolFlags; +>flags : SymbolFlags +>SymbolFlags : SymbolFlags + + name: string; +>name : string + + id?: number; +>id : number + + mergeId?: number; +>mergeId : number + + declarations?: Declaration[]; +>declarations : Declaration[] +>Declaration : Declaration + + parent?: Symbol; +>parent : Symbol +>Symbol : Symbol + + members?: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + exports?: SymbolTable; +>exports : SymbolTable +>SymbolTable : SymbolTable + + exportSymbol?: Symbol; +>exportSymbol : Symbol +>Symbol : Symbol + + valueDeclaration?: Declaration; +>valueDeclaration : Declaration +>Declaration : Declaration + + constEnumOnlyModule?: boolean; +>constEnumOnlyModule : boolean + } + interface SymbolLinks { +>SymbolLinks : SymbolLinks + + target?: Symbol; +>target : Symbol +>Symbol : Symbol + + type?: Type; +>type : Type +>Type : Type + + declaredType?: Type; +>declaredType : Type +>Type : Type + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + referenced?: boolean; +>referenced : boolean + + exportAssignSymbol?: Symbol; +>exportAssignSymbol : Symbol +>Symbol : Symbol + + unionType?: UnionType; +>unionType : UnionType +>UnionType : UnionType + } + interface TransientSymbol extends Symbol, SymbolLinks { +>TransientSymbol : TransientSymbol +>Symbol : Symbol +>SymbolLinks : SymbolLinks + } + interface SymbolTable { +>SymbolTable : SymbolTable + + [index: string]: Symbol; +>index : string +>Symbol : Symbol + } + const enum NodeCheckFlags { +>NodeCheckFlags : NodeCheckFlags + + TypeChecked = 1, +>TypeChecked : NodeCheckFlags + + LexicalThis = 2, +>LexicalThis : NodeCheckFlags + + CaptureThis = 4, +>CaptureThis : NodeCheckFlags + + EmitExtends = 8, +>EmitExtends : NodeCheckFlags + + SuperInstance = 16, +>SuperInstance : NodeCheckFlags + + SuperStatic = 32, +>SuperStatic : NodeCheckFlags + + ContextChecked = 64, +>ContextChecked : NodeCheckFlags + + EnumValuesComputed = 128, +>EnumValuesComputed : NodeCheckFlags + } + interface NodeLinks { +>NodeLinks : NodeLinks + + resolvedType?: Type; +>resolvedType : Type +>Type : Type + + resolvedSignature?: Signature; +>resolvedSignature : Signature +>Signature : Signature + + resolvedSymbol?: Symbol; +>resolvedSymbol : Symbol +>Symbol : Symbol + + flags?: NodeCheckFlags; +>flags : NodeCheckFlags +>NodeCheckFlags : NodeCheckFlags + + enumMemberValue?: number; +>enumMemberValue : number + + isIllegalTypeReferenceInConstraint?: boolean; +>isIllegalTypeReferenceInConstraint : boolean + + isVisible?: boolean; +>isVisible : boolean + + localModuleName?: string; +>localModuleName : string + + assignmentChecks?: Map; +>assignmentChecks : Map +>Map : Map + + hasReportedStatementInAmbientContext?: boolean; +>hasReportedStatementInAmbientContext : boolean + + importOnRightSide?: Symbol; +>importOnRightSide : Symbol +>Symbol : Symbol + } + const enum TypeFlags { +>TypeFlags : TypeFlags + + Any = 1, +>Any : TypeFlags + + String = 2, +>String : TypeFlags + + Number = 4, +>Number : TypeFlags + + Boolean = 8, +>Boolean : TypeFlags + + Void = 16, +>Void : TypeFlags + + Undefined = 32, +>Undefined : TypeFlags + + Null = 64, +>Null : TypeFlags + + Enum = 128, +>Enum : TypeFlags + + StringLiteral = 256, +>StringLiteral : TypeFlags + + TypeParameter = 512, +>TypeParameter : TypeFlags + + Class = 1024, +>Class : TypeFlags + + Interface = 2048, +>Interface : TypeFlags + + Reference = 4096, +>Reference : TypeFlags + + Tuple = 8192, +>Tuple : TypeFlags + + Union = 16384, +>Union : TypeFlags + + Anonymous = 32768, +>Anonymous : TypeFlags + + FromSignature = 65536, +>FromSignature : TypeFlags + + ObjectLiteral = 131072, +>ObjectLiteral : TypeFlags + + ContainsUndefinedOrNull = 262144, +>ContainsUndefinedOrNull : TypeFlags + + ContainsObjectLiteral = 524288, +>ContainsObjectLiteral : TypeFlags + + Intrinsic = 127, +>Intrinsic : TypeFlags + + Primitive = 510, +>Primitive : TypeFlags + + StringLike = 258, +>StringLike : TypeFlags + + NumberLike = 132, +>NumberLike : TypeFlags + + ObjectType = 48128, +>ObjectType : TypeFlags + + RequiresWidening = 786432, +>RequiresWidening : TypeFlags + } + interface Type { +>Type : Type + + flags: TypeFlags; +>flags : TypeFlags +>TypeFlags : TypeFlags + + id: number; +>id : number + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + } + interface IntrinsicType extends Type { +>IntrinsicType : IntrinsicType +>Type : Type + + intrinsicName: string; +>intrinsicName : string + } + interface StringLiteralType extends Type { +>StringLiteralType : StringLiteralType +>Type : Type + + text: string; +>text : string + } + interface ObjectType extends Type { +>ObjectType : ObjectType +>Type : Type + } + interface InterfaceType extends ObjectType { +>InterfaceType : InterfaceType +>ObjectType : ObjectType + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + baseTypes: ObjectType[]; +>baseTypes : ObjectType[] +>ObjectType : ObjectType + + declaredProperties: Symbol[]; +>declaredProperties : Symbol[] +>Symbol : Symbol + + declaredCallSignatures: Signature[]; +>declaredCallSignatures : Signature[] +>Signature : Signature + + declaredConstructSignatures: Signature[]; +>declaredConstructSignatures : Signature[] +>Signature : Signature + + declaredStringIndexType: Type; +>declaredStringIndexType : Type +>Type : Type + + declaredNumberIndexType: Type; +>declaredNumberIndexType : Type +>Type : Type + } + interface TypeReference extends ObjectType { +>TypeReference : TypeReference +>ObjectType : ObjectType + + target: GenericType; +>target : GenericType +>GenericType : GenericType + + typeArguments: Type[]; +>typeArguments : Type[] +>Type : Type + } + interface GenericType extends InterfaceType, TypeReference { +>GenericType : GenericType +>InterfaceType : InterfaceType +>TypeReference : TypeReference + + instantiations: Map; +>instantiations : Map +>Map : Map +>TypeReference : TypeReference + } + interface TupleType extends ObjectType { +>TupleType : TupleType +>ObjectType : ObjectType + + elementTypes: Type[]; +>elementTypes : Type[] +>Type : Type + + baseArrayType: TypeReference; +>baseArrayType : TypeReference +>TypeReference : TypeReference + } + interface UnionType extends Type { +>UnionType : UnionType +>Type : Type + + types: Type[]; +>types : Type[] +>Type : Type + + resolvedProperties: SymbolTable; +>resolvedProperties : SymbolTable +>SymbolTable : SymbolTable + } + interface ResolvedType extends ObjectType, UnionType { +>ResolvedType : ResolvedType +>ObjectType : ObjectType +>UnionType : UnionType + + members: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + properties: Symbol[]; +>properties : Symbol[] +>Symbol : Symbol + + callSignatures: Signature[]; +>callSignatures : Signature[] +>Signature : Signature + + constructSignatures: Signature[]; +>constructSignatures : Signature[] +>Signature : Signature + + stringIndexType: Type; +>stringIndexType : Type +>Type : Type + + numberIndexType: Type; +>numberIndexType : Type +>Type : Type + } + interface TypeParameter extends Type { +>TypeParameter : TypeParameter +>Type : Type + + constraint: Type; +>constraint : Type +>Type : Type + + target?: TypeParameter; +>target : TypeParameter +>TypeParameter : TypeParameter + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + } + const enum SignatureKind { +>SignatureKind : SignatureKind + + Call = 0, +>Call : SignatureKind + + Construct = 1, +>Construct : SignatureKind + } + interface Signature { +>Signature : Signature + + declaration: SignatureDeclaration; +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + parameters: Symbol[]; +>parameters : Symbol[] +>Symbol : Symbol + + resolvedReturnType: Type; +>resolvedReturnType : Type +>Type : Type + + minArgumentCount: number; +>minArgumentCount : number + + hasRestParameter: boolean; +>hasRestParameter : boolean + + hasStringLiterals: boolean; +>hasStringLiterals : boolean + + target?: Signature; +>target : Signature +>Signature : Signature + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + unionSignatures?: Signature[]; +>unionSignatures : Signature[] +>Signature : Signature + + erasedSignatureCache?: Signature; +>erasedSignatureCache : Signature +>Signature : Signature + + isolatedSignatureType?: ObjectType; +>isolatedSignatureType : ObjectType +>ObjectType : ObjectType + } + const enum IndexKind { +>IndexKind : IndexKind + + String = 0, +>String : IndexKind + + Number = 1, +>Number : IndexKind + } + interface TypeMapper { +>TypeMapper : TypeMapper + + (t: Type): Type; +>t : Type +>Type : Type +>Type : Type + } + interface TypeInferences { +>TypeInferences : TypeInferences + + primary: Type[]; +>primary : Type[] +>Type : Type + + secondary: Type[]; +>secondary : Type[] +>Type : Type + } + interface InferenceContext { +>InferenceContext : InferenceContext + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + inferUnionTypes: boolean; +>inferUnionTypes : boolean + + inferences: TypeInferences[]; +>inferences : TypeInferences[] +>TypeInferences : TypeInferences + + inferredTypes: Type[]; +>inferredTypes : Type[] +>Type : Type + + failedTypeParameterIndex?: number; +>failedTypeParameterIndex : number + } + interface DiagnosticMessage { +>DiagnosticMessage : DiagnosticMessage + + key: string; +>key : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + interface DiagnosticMessageChain { +>DiagnosticMessageChain : DiagnosticMessageChain + + messageText: string; +>messageText : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + + next?: DiagnosticMessageChain; +>next : DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + } + interface Diagnostic { +>Diagnostic : Diagnostic + + file: SourceFile; +>file : SourceFile +>SourceFile : SourceFile + + start: number; +>start : number + + length: number; +>length : number + + messageText: string | DiagnosticMessageChain; +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = 0, +>Warning : DiagnosticCategory + + Error = 1, +>Error : DiagnosticCategory + + Message = 2, +>Message : DiagnosticCategory + } + interface CompilerOptions { +>CompilerOptions : CompilerOptions + + allowNonTsExtensions?: boolean; +>allowNonTsExtensions : boolean + + charset?: string; +>charset : string + + codepage?: number; +>codepage : number + + declaration?: boolean; +>declaration : boolean + + diagnostics?: boolean; +>diagnostics : boolean + + emitBOM?: boolean; +>emitBOM : boolean + + help?: boolean; +>help : boolean + + listFiles?: boolean; +>listFiles : boolean + + locale?: string; +>locale : string + + mapRoot?: string; +>mapRoot : string + + module?: ModuleKind; +>module : ModuleKind +>ModuleKind : ModuleKind + + noEmit?: boolean; +>noEmit : boolean + + noEmitOnError?: boolean; +>noEmitOnError : boolean + + noErrorTruncation?: boolean; +>noErrorTruncation : boolean + + noImplicitAny?: boolean; +>noImplicitAny : boolean + + noLib?: boolean; +>noLib : boolean + + noLibCheck?: boolean; +>noLibCheck : boolean + + noResolve?: boolean; +>noResolve : boolean + + out?: string; +>out : string + + outDir?: string; +>outDir : string + + preserveConstEnums?: boolean; +>preserveConstEnums : boolean + + project?: string; +>project : string + + removeComments?: boolean; +>removeComments : boolean + + sourceMap?: boolean; +>sourceMap : boolean + + sourceRoot?: string; +>sourceRoot : string + + suppressImplicitAnyIndexErrors?: boolean; +>suppressImplicitAnyIndexErrors : boolean + + target?: ScriptTarget; +>target : ScriptTarget +>ScriptTarget : ScriptTarget + + version?: boolean; +>version : boolean + + watch?: boolean; +>watch : boolean + + stripInternal?: boolean; +>stripInternal : boolean + + [option: string]: string | number | boolean; +>option : string + } + const enum ModuleKind { +>ModuleKind : ModuleKind + + None = 0, +>None : ModuleKind + + CommonJS = 1, +>CommonJS : ModuleKind + + AMD = 2, +>AMD : ModuleKind + } + interface LineAndCharacter { +>LineAndCharacter : LineAndCharacter + + line: number; +>line : number + + character: number; +>character : number + } + const enum ScriptTarget { +>ScriptTarget : ScriptTarget + + ES3 = 0, +>ES3 : ScriptTarget + + ES5 = 1, +>ES5 : ScriptTarget + + ES6 = 2, +>ES6 : ScriptTarget + + Latest = 2, +>Latest : ScriptTarget + } + interface ParsedCommandLine { +>ParsedCommandLine : ParsedCommandLine + + options: CompilerOptions; +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + fileNames: string[]; +>fileNames : string[] + + errors: Diagnostic[]; +>errors : Diagnostic[] +>Diagnostic : Diagnostic + } + interface CommandLineOption { +>CommandLineOption : CommandLineOption + + name: string; +>name : string + + type: string | Map; +>type : string | Map +>Map : Map + + isFilePath?: boolean; +>isFilePath : boolean + + shortName?: string; +>shortName : string + + description?: DiagnosticMessage; +>description : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + paramType?: DiagnosticMessage; +>paramType : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + error?: DiagnosticMessage; +>error : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + experimental?: boolean; +>experimental : boolean + } + const enum CharacterCodes { +>CharacterCodes : CharacterCodes + + nullCharacter = 0, +>nullCharacter : CharacterCodes + + maxAsciiCharacter = 127, +>maxAsciiCharacter : CharacterCodes + + lineFeed = 10, +>lineFeed : CharacterCodes + + carriageReturn = 13, +>carriageReturn : CharacterCodes + + lineSeparator = 8232, +>lineSeparator : CharacterCodes + + paragraphSeparator = 8233, +>paragraphSeparator : CharacterCodes + + nextLine = 133, +>nextLine : CharacterCodes + + space = 32, +>space : CharacterCodes + + nonBreakingSpace = 160, +>nonBreakingSpace : CharacterCodes + + enQuad = 8192, +>enQuad : CharacterCodes + + emQuad = 8193, +>emQuad : CharacterCodes + + enSpace = 8194, +>enSpace : CharacterCodes + + emSpace = 8195, +>emSpace : CharacterCodes + + threePerEmSpace = 8196, +>threePerEmSpace : CharacterCodes + + fourPerEmSpace = 8197, +>fourPerEmSpace : CharacterCodes + + sixPerEmSpace = 8198, +>sixPerEmSpace : CharacterCodes + + figureSpace = 8199, +>figureSpace : CharacterCodes + + punctuationSpace = 8200, +>punctuationSpace : CharacterCodes + + thinSpace = 8201, +>thinSpace : CharacterCodes + + hairSpace = 8202, +>hairSpace : CharacterCodes + + zeroWidthSpace = 8203, +>zeroWidthSpace : CharacterCodes + + narrowNoBreakSpace = 8239, +>narrowNoBreakSpace : CharacterCodes + + ideographicSpace = 12288, +>ideographicSpace : CharacterCodes + + mathematicalSpace = 8287, +>mathematicalSpace : CharacterCodes + + ogham = 5760, +>ogham : CharacterCodes + + _ = 95, +>_ : CharacterCodes + + $ = 36, +>$ : CharacterCodes + + _0 = 48, +>_0 : CharacterCodes + + _1 = 49, +>_1 : CharacterCodes + + _2 = 50, +>_2 : CharacterCodes + + _3 = 51, +>_3 : CharacterCodes + + _4 = 52, +>_4 : CharacterCodes + + _5 = 53, +>_5 : CharacterCodes + + _6 = 54, +>_6 : CharacterCodes + + _7 = 55, +>_7 : CharacterCodes + + _8 = 56, +>_8 : CharacterCodes + + _9 = 57, +>_9 : CharacterCodes + + a = 97, +>a : CharacterCodes + + b = 98, +>b : CharacterCodes + + c = 99, +>c : CharacterCodes + + d = 100, +>d : CharacterCodes + + e = 101, +>e : CharacterCodes + + f = 102, +>f : CharacterCodes + + g = 103, +>g : CharacterCodes + + h = 104, +>h : CharacterCodes + + i = 105, +>i : CharacterCodes + + j = 106, +>j : CharacterCodes + + k = 107, +>k : CharacterCodes + + l = 108, +>l : CharacterCodes + + m = 109, +>m : CharacterCodes + + n = 110, +>n : CharacterCodes + + o = 111, +>o : CharacterCodes + + p = 112, +>p : CharacterCodes + + q = 113, +>q : CharacterCodes + + r = 114, +>r : CharacterCodes + + s = 115, +>s : CharacterCodes + + t = 116, +>t : CharacterCodes + + u = 117, +>u : CharacterCodes + + v = 118, +>v : CharacterCodes + + w = 119, +>w : CharacterCodes + + x = 120, +>x : CharacterCodes + + y = 121, +>y : CharacterCodes + + z = 122, +>z : CharacterCodes + + A = 65, +>A : CharacterCodes + + B = 66, +>B : CharacterCodes + + C = 67, +>C : CharacterCodes + + D = 68, +>D : CharacterCodes + + E = 69, +>E : CharacterCodes + + F = 70, +>F : CharacterCodes + + G = 71, +>G : CharacterCodes + + H = 72, +>H : CharacterCodes + + I = 73, +>I : CharacterCodes + + J = 74, +>J : CharacterCodes + + K = 75, +>K : CharacterCodes + + L = 76, +>L : CharacterCodes + + M = 77, +>M : CharacterCodes + + N = 78, +>N : CharacterCodes + + O = 79, +>O : CharacterCodes + + P = 80, +>P : CharacterCodes + + Q = 81, +>Q : CharacterCodes + + R = 82, +>R : CharacterCodes + + S = 83, +>S : CharacterCodes + + T = 84, +>T : CharacterCodes + + U = 85, +>U : CharacterCodes + + V = 86, +>V : CharacterCodes + + W = 87, +>W : CharacterCodes + + X = 88, +>X : CharacterCodes + + Y = 89, +>Y : CharacterCodes + + Z = 90, +>Z : CharacterCodes + + ampersand = 38, +>ampersand : CharacterCodes + + asterisk = 42, +>asterisk : CharacterCodes + + at = 64, +>at : CharacterCodes + + backslash = 92, +>backslash : CharacterCodes + + backtick = 96, +>backtick : CharacterCodes + + bar = 124, +>bar : CharacterCodes + + caret = 94, +>caret : CharacterCodes + + closeBrace = 125, +>closeBrace : CharacterCodes + + closeBracket = 93, +>closeBracket : CharacterCodes + + closeParen = 41, +>closeParen : CharacterCodes + + colon = 58, +>colon : CharacterCodes + + comma = 44, +>comma : CharacterCodes + + dot = 46, +>dot : CharacterCodes + + doubleQuote = 34, +>doubleQuote : CharacterCodes + + equals = 61, +>equals : CharacterCodes + + exclamation = 33, +>exclamation : CharacterCodes + + greaterThan = 62, +>greaterThan : CharacterCodes + + lessThan = 60, +>lessThan : CharacterCodes + + minus = 45, +>minus : CharacterCodes + + openBrace = 123, +>openBrace : CharacterCodes + + openBracket = 91, +>openBracket : CharacterCodes + + openParen = 40, +>openParen : CharacterCodes + + percent = 37, +>percent : CharacterCodes + + plus = 43, +>plus : CharacterCodes + + question = 63, +>question : CharacterCodes + + semicolon = 59, +>semicolon : CharacterCodes + + singleQuote = 39, +>singleQuote : CharacterCodes + + slash = 47, +>slash : CharacterCodes + + tilde = 126, +>tilde : CharacterCodes + + backspace = 8, +>backspace : CharacterCodes + + formFeed = 12, +>formFeed : CharacterCodes + + byteOrderMark = 65279, +>byteOrderMark : CharacterCodes + + tab = 9, +>tab : CharacterCodes + + verticalTab = 11, +>verticalTab : CharacterCodes + } + interface CancellationToken { +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + } + interface CompilerHost { +>CompilerHost : CompilerHost + + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>onError : (message: string) => void +>message : string +>SourceFile : SourceFile + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + writeFile: WriteFileCallback; +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getCanonicalFileName(fileName: string): string; +>getCanonicalFileName : (fileName: string) => string +>fileName : string + + useCaseSensitiveFileNames(): boolean; +>useCaseSensitiveFileNames : () => boolean + + getNewLine(): string; +>getNewLine : () => string + } + interface TextSpan { +>TextSpan : TextSpan + + start: number; +>start : number + + length: number; +>length : number + } + interface TextChangeRange { +>TextChangeRange : TextChangeRange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newLength: number; +>newLength : number + } +} +declare module "typescript" { + interface ErrorCallback { +>ErrorCallback : ErrorCallback + + (message: DiagnosticMessage, length: number): void; +>message : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage +>length : number + } + interface Scanner { +>Scanner : Scanner + + getStartPos(): number; +>getStartPos : () => number + + getToken(): SyntaxKind; +>getToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + getTextPos(): number; +>getTextPos : () => number + + getTokenPos(): number; +>getTokenPos : () => number + + getTokenText(): string; +>getTokenText : () => string + + getTokenValue(): string; +>getTokenValue : () => string + + hasPrecedingLineBreak(): boolean; +>hasPrecedingLineBreak : () => boolean + + isIdentifier(): boolean; +>isIdentifier : () => boolean + + isReservedWord(): boolean; +>isReservedWord : () => boolean + + isUnterminated(): boolean; +>isUnterminated : () => boolean + + reScanGreaterToken(): SyntaxKind; +>reScanGreaterToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanSlashToken(): SyntaxKind; +>reScanSlashToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanTemplateToken(): SyntaxKind; +>reScanTemplateToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + scan(): SyntaxKind; +>scan : () => SyntaxKind +>SyntaxKind : SyntaxKind + + setText(text: string): void; +>setText : (text: string) => void +>text : string + + setTextPos(textPos: number): void; +>setTextPos : (textPos: number) => void +>textPos : number + + lookAhead(callback: () => T): T; +>lookAhead : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + + tryScan(callback: () => T): T; +>tryScan : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + } + function tokenToString(t: SyntaxKind): string; +>tokenToString : (t: SyntaxKind) => string +>t : SyntaxKind +>SyntaxKind : SyntaxKind + + function computeLineStarts(text: string): number[]; +>computeLineStarts : (text: string) => number[] +>text : string + + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number +>sourceFile : SourceFile +>SourceFile : SourceFile +>line : number +>character : number + + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number +>lineStarts : number[] +>line : number +>character : number + + function getLineStarts(sourceFile: SourceFile): number[]; +>getLineStarts : (sourceFile: SourceFile) => number[] +>sourceFile : SourceFile +>SourceFile : SourceFile + + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } +>lineStarts : number[] +>position : number + + line: number; +>line : number + + character: number; +>character : number + + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter +>sourceFile : SourceFile +>SourceFile : SourceFile +>position : number +>LineAndCharacter : LineAndCharacter + + function isWhiteSpace(ch: number): boolean; +>isWhiteSpace : (ch: number) => boolean +>ch : number + + function isLineBreak(ch: number): boolean; +>isLineBreak : (ch: number) => boolean +>ch : number + + function isOctalDigit(ch: number): boolean; +>isOctalDigit : (ch: number) => boolean +>ch : number + + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; +>skipTrivia : (text: string, pos: number, stopAfterLineBreak?: boolean) => number +>text : string +>pos : number +>stopAfterLineBreak : boolean + + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; +>getLeadingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; +>getTrailingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierStart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierPart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +>createScanner : (languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback) => Scanner +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>skipTrivia : boolean +>text : string +>onError : ErrorCallback +>ErrorCallback : ErrorCallback +>Scanner : Scanner +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; +>getNodeConstructor : (kind: SyntaxKind) => new () => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function createNode(kind: SyntaxKind): Node; +>createNode : (kind: SyntaxKind) => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; +>forEachChild : (node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T) => T +>T : T +>node : Node +>Node : Node +>cbNode : (node: Node) => T +>node : Node +>Node : Node +>T : T +>cbNodeArray : (nodes: Node[]) => T +>nodes : Node[] +>Node : Node +>T : T +>T : T + + function modifierToFlag(token: SyntaxKind): NodeFlags; +>modifierToFlag : (token: SyntaxKind) => NodeFlags +>token : SyntaxKind +>SyntaxKind : SyntaxKind +>NodeFlags : NodeFlags + + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; +>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function isEvalOrArgumentsIdentifier(node: Node): boolean; +>isEvalOrArgumentsIdentifier : (node: Node) => boolean +>node : Node +>Node : Node + + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string +>sourceText : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>setParentNodes : boolean +>SourceFile : SourceFile + + function isLeftHandSideExpression(expr: Expression): boolean; +>isLeftHandSideExpression : (expr: Expression) => boolean +>expr : Expression +>Expression : Expression + + function isAssignmentOperator(token: SyntaxKind): boolean; +>isAssignmentOperator : (token: SyntaxKind) => boolean +>token : SyntaxKind +>SyntaxKind : SyntaxKind +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +>createTypeChecker : (host: TypeCheckerHost, produceDiagnostics: boolean) => TypeChecker +>host : TypeCheckerHost +>TypeCheckerHost : TypeCheckerHost +>produceDiagnostics : boolean +>TypeChecker : TypeChecker +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; +>createCompilerHost : (options: CompilerOptions) => CompilerHost +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>CompilerHost : CompilerHost + + function getPreEmitDiagnostics(program: Program): Diagnostic[]; +>getPreEmitDiagnostics : (program: Program) => Diagnostic[] +>program : Program +>Program : Program +>Diagnostic : Diagnostic + + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; +>flattenDiagnosticMessageText : (messageText: string | DiagnosticMessageChain, newLine: string) => string +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain +>newLine : string + + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +>createProgram : (rootNames: string[], options: CompilerOptions, host?: CompilerHost) => Program +>rootNames : string[] +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>host : CompilerHost +>CompilerHost : CompilerHost +>Program : Program +} +declare module "typescript" { + var servicesVersion: string; +>servicesVersion : string + + interface Node { +>Node : Node + + getSourceFile(): SourceFile; +>getSourceFile : () => SourceFile +>SourceFile : SourceFile + + getChildCount(sourceFile?: SourceFile): number; +>getChildCount : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getChildAt(index: number, sourceFile?: SourceFile): Node; +>getChildAt : (index: number, sourceFile?: SourceFile) => Node +>index : number +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getChildren(sourceFile?: SourceFile): Node[]; +>getChildren : (sourceFile?: SourceFile) => Node[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getStart(sourceFile?: SourceFile): number; +>getStart : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullStart(): number; +>getFullStart : () => number + + getEnd(): number; +>getEnd : () => number + + getWidth(sourceFile?: SourceFile): number; +>getWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullWidth(): number; +>getFullWidth : () => number + + getLeadingTriviaWidth(sourceFile?: SourceFile): number; +>getLeadingTriviaWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullText(sourceFile?: SourceFile): string; +>getFullText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getText(sourceFile?: SourceFile): string; +>getText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFirstToken(sourceFile?: SourceFile): Node; +>getFirstToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getLastToken(sourceFile?: SourceFile): Node; +>getLastToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + } + interface Symbol { +>Symbol : Symbol + + getFlags(): SymbolFlags; +>getFlags : () => SymbolFlags +>SymbolFlags : SymbolFlags + + getName(): string; +>getName : () => string + + getDeclarations(): Declaration[]; +>getDeclarations : () => Declaration[] +>Declaration : Declaration + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface Type { +>Type : Type + + getFlags(): TypeFlags; +>getFlags : () => TypeFlags +>TypeFlags : TypeFlags + + getSymbol(): Symbol; +>getSymbol : () => Symbol +>Symbol : Symbol + + getProperties(): Symbol[]; +>getProperties : () => Symbol[] +>Symbol : Symbol + + getProperty(propertyName: string): Symbol; +>getProperty : (propertyName: string) => Symbol +>propertyName : string +>Symbol : Symbol + + getApparentProperties(): Symbol[]; +>getApparentProperties : () => Symbol[] +>Symbol : Symbol + + getCallSignatures(): Signature[]; +>getCallSignatures : () => Signature[] +>Signature : Signature + + getConstructSignatures(): Signature[]; +>getConstructSignatures : () => Signature[] +>Signature : Signature + + getStringIndexType(): Type; +>getStringIndexType : () => Type +>Type : Type + + getNumberIndexType(): Type; +>getNumberIndexType : () => Type +>Type : Type + } + interface Signature { +>Signature : Signature + + getDeclaration(): SignatureDeclaration; +>getDeclaration : () => SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + getTypeParameters(): Type[]; +>getTypeParameters : () => Type[] +>Type : Type + + getParameters(): Symbol[]; +>getParameters : () => Symbol[] +>Symbol : Symbol + + getReturnType(): Type; +>getReturnType : () => Type +>Type : Type + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface SourceFile { +>SourceFile : SourceFile + + version: string; +>version : string + + scriptSnapshot: IScriptSnapshot; +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot + + nameTable: Map; +>nameTable : Map +>Map : Map + + getNamedDeclarations(): Declaration[]; +>getNamedDeclarations : () => Declaration[] +>Declaration : Declaration + + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; +>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter +>pos : number +>LineAndCharacter : LineAndCharacter + + getLineStarts(): number[]; +>getLineStarts : () => number[] + + getPositionFromLineAndCharacter(line: number, character: number): number; +>getPositionFromLineAndCharacter : (line: number, character: number) => number +>line : number +>character : number + + update(newText: string, textChangeRange: TextChangeRange): SourceFile; +>update : (newText: string, textChangeRange: TextChangeRange) => SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { +>IScriptSnapshot : IScriptSnapshot + + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; +>getText : (start: number, end: number) => string +>start : number +>end : number + + /** Gets the length of this script snapshot. */ + getLength(): number; +>getLength : () => number + + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; +>getChangeRange : (oldSnapshot: IScriptSnapshot) => TextChangeRange +>oldSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>TextChangeRange : TextChangeRange + } + module ScriptSnapshot { +>ScriptSnapshot : typeof ScriptSnapshot + + function fromString(text: string): IScriptSnapshot; +>fromString : (text: string) => IScriptSnapshot +>text : string +>IScriptSnapshot : IScriptSnapshot + } + interface PreProcessedFileInfo { +>PreProcessedFileInfo : PreProcessedFileInfo + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + importedFiles: FileReference[]; +>importedFiles : FileReference[] +>FileReference : FileReference + + isLibFile: boolean; +>isLibFile : boolean + } + interface LanguageServiceHost { +>LanguageServiceHost : LanguageServiceHost + + getCompilationSettings(): CompilerOptions; +>getCompilationSettings : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getNewLine?(): string; +>getNewLine : () => string + + getScriptFileNames(): string[]; +>getScriptFileNames : () => string[] + + getScriptVersion(fileName: string): string; +>getScriptVersion : (fileName: string) => string +>fileName : string + + getScriptSnapshot(fileName: string): IScriptSnapshot; +>getScriptSnapshot : (fileName: string) => IScriptSnapshot +>fileName : string +>IScriptSnapshot : IScriptSnapshot + + getLocalizedDiagnosticMessages?(): any; +>getLocalizedDiagnosticMessages : () => any + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + log?(s: string): void; +>log : (s: string) => void +>s : string + + trace?(s: string): void; +>trace : (s: string) => void +>s : string + + error?(s: string): void; +>error : (s: string) => void +>s : string + } + interface LanguageService { +>LanguageService : LanguageService + + cleanupSemanticCache(): void; +>cleanupSemanticCache : () => void + + getSyntacticDiagnostics(fileName: string): Diagnostic[]; +>getSyntacticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getSemanticDiagnostics(fileName: string): Diagnostic[]; +>getSemanticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getCompilerOptionsDiagnostics(): Diagnostic[]; +>getCompilerOptionsDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSyntacticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSemanticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; +>getCompletionsAtPosition : (fileName: string, position: number) => CompletionInfo +>fileName : string +>position : number +>CompletionInfo : CompletionInfo + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; +>getCompletionEntryDetails : (fileName: string, position: number, entryName: string) => CompletionEntryDetails +>fileName : string +>position : number +>entryName : string +>CompletionEntryDetails : CompletionEntryDetails + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; +>getQuickInfoAtPosition : (fileName: string, position: number) => QuickInfo +>fileName : string +>position : number +>QuickInfo : QuickInfo + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; +>getNameOrDottedNameSpan : (fileName: string, startPos: number, endPos: number) => TextSpan +>fileName : string +>startPos : number +>endPos : number +>TextSpan : TextSpan + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; +>getBreakpointStatementAtPosition : (fileName: string, position: number) => TextSpan +>fileName : string +>position : number +>TextSpan : TextSpan + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; +>getSignatureHelpItems : (fileName: string, position: number) => SignatureHelpItems +>fileName : string +>position : number +>SignatureHelpItems : SignatureHelpItems + + getRenameInfo(fileName: string, position: number): RenameInfo; +>getRenameInfo : (fileName: string, position: number) => RenameInfo +>fileName : string +>position : number +>RenameInfo : RenameInfo + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; +>findRenameLocations : (fileName: string, position: number, findInStrings: boolean, findInComments: boolean) => RenameLocation[] +>fileName : string +>position : number +>findInStrings : boolean +>findInComments : boolean +>RenameLocation : RenameLocation + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; +>getDefinitionAtPosition : (fileName: string, position: number) => DefinitionInfo[] +>fileName : string +>position : number +>DefinitionInfo : DefinitionInfo + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getReferencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getOccurrencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getNavigateToItems(searchValue: string): NavigateToItem[]; +>getNavigateToItems : (searchValue: string) => NavigateToItem[] +>searchValue : string +>NavigateToItem : NavigateToItem + + getNavigationBarItems(fileName: string): NavigationBarItem[]; +>getNavigationBarItems : (fileName: string) => NavigationBarItem[] +>fileName : string +>NavigationBarItem : NavigationBarItem + + getOutliningSpans(fileName: string): OutliningSpan[]; +>getOutliningSpans : (fileName: string) => OutliningSpan[] +>fileName : string +>OutliningSpan : OutliningSpan + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; +>getTodoComments : (fileName: string, descriptors: TodoCommentDescriptor[]) => TodoComment[] +>fileName : string +>descriptors : TodoCommentDescriptor[] +>TodoCommentDescriptor : TodoCommentDescriptor +>TodoComment : TodoComment + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; +>getBraceMatchingAtPosition : (fileName: string, position: number) => TextSpan[] +>fileName : string +>position : number +>TextSpan : TextSpan + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; +>getIndentationAtPosition : (fileName: string, position: number, options: EditorOptions) => number +>fileName : string +>position : number +>options : EditorOptions +>EditorOptions : EditorOptions + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForRange : (fileName: string, start: number, end: number, options: FormatCodeOptions) => TextChange[] +>fileName : string +>start : number +>end : number +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForDocument : (fileName: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsAfterKeystroke : (fileName: string, position: number, key: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>position : number +>key : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getEmitOutput(fileName: string): EmitOutput; +>getEmitOutput : (fileName: string) => EmitOutput +>fileName : string +>EmitOutput : EmitOutput + + getProgram(): Program; +>getProgram : () => Program +>Program : Program + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + dispose(): void; +>dispose : () => void + } + interface ClassifiedSpan { +>ClassifiedSpan : ClassifiedSpan + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + classificationType: string; +>classificationType : string + } + interface NavigationBarItem { +>NavigationBarItem : NavigationBarItem + + text: string; +>text : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + spans: TextSpan[]; +>spans : TextSpan[] +>TextSpan : TextSpan + + childItems: NavigationBarItem[]; +>childItems : NavigationBarItem[] +>NavigationBarItem : NavigationBarItem + + indent: number; +>indent : number + + bolded: boolean; +>bolded : boolean + + grayed: boolean; +>grayed : boolean + } + interface TodoCommentDescriptor { +>TodoCommentDescriptor : TodoCommentDescriptor + + text: string; +>text : string + + priority: number; +>priority : number + } + interface TodoComment { +>TodoComment : TodoComment + + descriptor: TodoCommentDescriptor; +>descriptor : TodoCommentDescriptor +>TodoCommentDescriptor : TodoCommentDescriptor + + message: string; +>message : string + + position: number; +>position : number + } + class TextChange { +>TextChange : TextChange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newText: string; +>newText : string + } + interface RenameLocation { +>RenameLocation : RenameLocation + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + } + interface ReferenceEntry { +>ReferenceEntry : ReferenceEntry + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + + isWriteAccess: boolean; +>isWriteAccess : boolean + } + interface NavigateToItem { +>NavigateToItem : NavigateToItem + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + matchKind: string; +>matchKind : string + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + containerName: string; +>containerName : string + + containerKind: string; +>containerKind : string + } + interface EditorOptions { +>EditorOptions : EditorOptions + + IndentSize: number; +>IndentSize : number + + TabSize: number; +>TabSize : number + + NewLineCharacter: string; +>NewLineCharacter : string + + ConvertTabsToSpaces: boolean; +>ConvertTabsToSpaces : boolean + } + interface FormatCodeOptions extends EditorOptions { +>FormatCodeOptions : FormatCodeOptions +>EditorOptions : EditorOptions + + InsertSpaceAfterCommaDelimiter: boolean; +>InsertSpaceAfterCommaDelimiter : boolean + + InsertSpaceAfterSemicolonInForStatements: boolean; +>InsertSpaceAfterSemicolonInForStatements : boolean + + InsertSpaceBeforeAndAfterBinaryOperators: boolean; +>InsertSpaceBeforeAndAfterBinaryOperators : boolean + + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; +>InsertSpaceAfterKeywordsInControlFlowStatements : boolean + + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; +>InsertSpaceAfterFunctionKeywordForAnonymousFunctions : boolean + + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; +>InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis : boolean + + PlaceOpenBraceOnNewLineForFunctions: boolean; +>PlaceOpenBraceOnNewLineForFunctions : boolean + + PlaceOpenBraceOnNewLineForControlBlocks: boolean; +>PlaceOpenBraceOnNewLineForControlBlocks : boolean + } + interface DefinitionInfo { +>DefinitionInfo : DefinitionInfo + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + kind: string; +>kind : string + + name: string; +>name : string + + containerKind: string; +>containerKind : string + + containerName: string; +>containerName : string + } + enum SymbolDisplayPartKind { +>SymbolDisplayPartKind : SymbolDisplayPartKind + + aliasName = 0, +>aliasName : SymbolDisplayPartKind + + className = 1, +>className : SymbolDisplayPartKind + + enumName = 2, +>enumName : SymbolDisplayPartKind + + fieldName = 3, +>fieldName : SymbolDisplayPartKind + + interfaceName = 4, +>interfaceName : SymbolDisplayPartKind + + keyword = 5, +>keyword : SymbolDisplayPartKind + + lineBreak = 6, +>lineBreak : SymbolDisplayPartKind + + numericLiteral = 7, +>numericLiteral : SymbolDisplayPartKind + + stringLiteral = 8, +>stringLiteral : SymbolDisplayPartKind + + localName = 9, +>localName : SymbolDisplayPartKind + + methodName = 10, +>methodName : SymbolDisplayPartKind + + moduleName = 11, +>moduleName : SymbolDisplayPartKind + + operator = 12, +>operator : SymbolDisplayPartKind + + parameterName = 13, +>parameterName : SymbolDisplayPartKind + + propertyName = 14, +>propertyName : SymbolDisplayPartKind + + punctuation = 15, +>punctuation : SymbolDisplayPartKind + + space = 16, +>space : SymbolDisplayPartKind + + text = 17, +>text : SymbolDisplayPartKind + + typeParameterName = 18, +>typeParameterName : SymbolDisplayPartKind + + enumMemberName = 19, +>enumMemberName : SymbolDisplayPartKind + + functionName = 20, +>functionName : SymbolDisplayPartKind + + regularExpressionLiteral = 21, +>regularExpressionLiteral : SymbolDisplayPartKind + } + interface SymbolDisplayPart { +>SymbolDisplayPart : SymbolDisplayPart + + text: string; +>text : string + + kind: string; +>kind : string + } + interface QuickInfo { +>QuickInfo : QuickInfo + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface RenameInfo { +>RenameInfo : RenameInfo + + canRename: boolean; +>canRename : boolean + + localizedErrorMessage: string; +>localizedErrorMessage : string + + displayName: string; +>displayName : string + + fullDisplayName: string; +>fullDisplayName : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + triggerSpan: TextSpan; +>triggerSpan : TextSpan +>TextSpan : TextSpan + } + interface SignatureHelpParameter { +>SignatureHelpParameter : SignatureHelpParameter + + name: string; +>name : string + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + isOptional: boolean; +>isOptional : boolean + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { +>SignatureHelpItem : SignatureHelpItem + + isVariadic: boolean; +>isVariadic : boolean + + prefixDisplayParts: SymbolDisplayPart[]; +>prefixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + suffixDisplayParts: SymbolDisplayPart[]; +>suffixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + separatorDisplayParts: SymbolDisplayPart[]; +>separatorDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + parameters: SignatureHelpParameter[]; +>parameters : SignatureHelpParameter[] +>SignatureHelpParameter : SignatureHelpParameter + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { +>SignatureHelpItems : SignatureHelpItems + + items: SignatureHelpItem[]; +>items : SignatureHelpItem[] +>SignatureHelpItem : SignatureHelpItem + + applicableSpan: TextSpan; +>applicableSpan : TextSpan +>TextSpan : TextSpan + + selectedItemIndex: number; +>selectedItemIndex : number + + argumentIndex: number; +>argumentIndex : number + + argumentCount: number; +>argumentCount : number + } + interface CompletionInfo { +>CompletionInfo : CompletionInfo + + isMemberCompletion: boolean; +>isMemberCompletion : boolean + + isNewIdentifierLocation: boolean; +>isNewIdentifierLocation : boolean + + entries: CompletionEntry[]; +>entries : CompletionEntry[] +>CompletionEntry : CompletionEntry + } + interface CompletionEntry { +>CompletionEntry : CompletionEntry + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + } + interface CompletionEntryDetails { +>CompletionEntryDetails : CompletionEntryDetails + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface OutliningSpan { +>OutliningSpan : OutliningSpan + + /** The span of the document to actually collapse. */ + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; +>hintSpan : TextSpan +>TextSpan : TextSpan + + /** The text to display in the editor for the collapsed region. */ + bannerText: string; +>bannerText : string + + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; +>autoCollapse : boolean + } + interface EmitOutput { +>EmitOutput : EmitOutput + + outputFiles: OutputFile[]; +>outputFiles : OutputFile[] +>OutputFile : OutputFile + + emitSkipped: boolean; +>emitSkipped : boolean + } + const enum OutputFileType { +>OutputFileType : OutputFileType + + JavaScript = 0, +>JavaScript : OutputFileType + + SourceMap = 1, +>SourceMap : OutputFileType + + Declaration = 2, +>Declaration : OutputFileType + } + interface OutputFile { +>OutputFile : OutputFile + + name: string; +>name : string + + writeByteOrderMark: boolean; +>writeByteOrderMark : boolean + + text: string; +>text : string + } + const enum EndOfLineState { +>EndOfLineState : EndOfLineState + + Start = 0, +>Start : EndOfLineState + + InMultiLineCommentTrivia = 1, +>InMultiLineCommentTrivia : EndOfLineState + + InSingleQuoteStringLiteral = 2, +>InSingleQuoteStringLiteral : EndOfLineState + + InDoubleQuoteStringLiteral = 3, +>InDoubleQuoteStringLiteral : EndOfLineState + } + enum TokenClass { +>TokenClass : TokenClass + + Punctuation = 0, +>Punctuation : TokenClass + + Keyword = 1, +>Keyword : TokenClass + + Operator = 2, +>Operator : TokenClass + + Comment = 3, +>Comment : TokenClass + + Whitespace = 4, +>Whitespace : TokenClass + + Identifier = 5, +>Identifier : TokenClass + + NumberLiteral = 6, +>NumberLiteral : TokenClass + + StringLiteral = 7, +>StringLiteral : TokenClass + + RegExpLiteral = 8, +>RegExpLiteral : TokenClass + } + interface ClassificationResult { +>ClassificationResult : ClassificationResult + + finalLexState: EndOfLineState; +>finalLexState : EndOfLineState +>EndOfLineState : EndOfLineState + + entries: ClassificationInfo[]; +>entries : ClassificationInfo[] +>ClassificationInfo : ClassificationInfo + } + interface ClassificationInfo { +>ClassificationInfo : ClassificationInfo + + length: number; +>length : number + + classification: TokenClass; +>classification : TokenClass +>TokenClass : TokenClass + } + interface Classifier { +>Classifier : Classifier + + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult +>text : string +>lexState : EndOfLineState +>EndOfLineState : EndOfLineState +>classifyKeywordsInGenerics : boolean +>ClassificationResult : ClassificationResult + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { +>DocumentRegistry : DocumentRegistry + + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions + } + class ScriptElementKind { +>ScriptElementKind : ScriptElementKind + + static unknown: string; +>unknown : string + + static keyword: string; +>keyword : string + + static scriptElement: string; +>scriptElement : string + + static moduleElement: string; +>moduleElement : string + + static classElement: string; +>classElement : string + + static interfaceElement: string; +>interfaceElement : string + + static typeElement: string; +>typeElement : string + + static enumElement: string; +>enumElement : string + + static variableElement: string; +>variableElement : string + + static localVariableElement: string; +>localVariableElement : string + + static functionElement: string; +>functionElement : string + + static localFunctionElement: string; +>localFunctionElement : string + + static memberFunctionElement: string; +>memberFunctionElement : string + + static memberGetAccessorElement: string; +>memberGetAccessorElement : string + + static memberSetAccessorElement: string; +>memberSetAccessorElement : string + + static memberVariableElement: string; +>memberVariableElement : string + + static constructorImplementationElement: string; +>constructorImplementationElement : string + + static callSignatureElement: string; +>callSignatureElement : string + + static indexSignatureElement: string; +>indexSignatureElement : string + + static constructSignatureElement: string; +>constructSignatureElement : string + + static parameterElement: string; +>parameterElement : string + + static typeParameterElement: string; +>typeParameterElement : string + + static primitiveType: string; +>primitiveType : string + + static label: string; +>label : string + + static alias: string; +>alias : string + + static constElement: string; +>constElement : string + + static letElement: string; +>letElement : string + } + class ScriptElementKindModifier { +>ScriptElementKindModifier : ScriptElementKindModifier + + static none: string; +>none : string + + static publicMemberModifier: string; +>publicMemberModifier : string + + static privateMemberModifier: string; +>privateMemberModifier : string + + static protectedMemberModifier: string; +>protectedMemberModifier : string + + static exportedModifier: string; +>exportedModifier : string + + static ambientModifier: string; +>ambientModifier : string + + static staticModifier: string; +>staticModifier : string + } + class ClassificationTypeNames { +>ClassificationTypeNames : ClassificationTypeNames + + static comment: string; +>comment : string + + static identifier: string; +>identifier : string + + static keyword: string; +>keyword : string + + static numericLiteral: string; +>numericLiteral : string + + static operator: string; +>operator : string + + static stringLiteral: string; +>stringLiteral : string + + static whiteSpace: string; +>whiteSpace : string + + static text: string; +>text : string + + static punctuation: string; +>punctuation : string + + static className: string; +>className : string + + static enumName: string; +>enumName : string + + static interfaceName: string; +>interfaceName : string + + static moduleName: string; +>moduleName : string + + static typeParameterName: string; +>typeParameterName : string + + static typeAlias: string; +>typeAlias : string + } + interface DisplayPartsSymbolWriter extends SymbolWriter { +>DisplayPartsSymbolWriter : DisplayPartsSymbolWriter +>SymbolWriter : SymbolWriter + + displayParts(): SymbolDisplayPart[]; +>displayParts : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; +>displayPartsToString : (displayParts: SymbolDisplayPart[]) => string +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + function getDefaultCompilerOptions(): CompilerOptions; +>getDefaultCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + class OperationCanceledException { +>OperationCanceledException : OperationCanceledException + } + class CancellationTokenObject { +>CancellationTokenObject : CancellationTokenObject + + private cancellationToken; +>cancellationToken : any + + static None: CancellationTokenObject; +>None : CancellationTokenObject +>CancellationTokenObject : CancellationTokenObject + + constructor(cancellationToken: CancellationToken); +>cancellationToken : CancellationToken +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + + throwIfCancellationRequested(): void; +>throwIfCancellationRequested : () => void + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>scriptTarget : ScriptTarget +>ScriptTarget : ScriptTarget +>version : string +>setNodeParents : boolean +>SourceFile : SourceFile + + var disableIncrementalParsing: boolean; +>disableIncrementalParsing : boolean + + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function createDocumentRegistry(): DocumentRegistry; +>createDocumentRegistry : () => DocumentRegistry +>DocumentRegistry : DocumentRegistry + + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; +>preProcessFile : (sourceText: string, readImportFiles?: boolean) => PreProcessedFileInfo +>sourceText : string +>readImportFiles : boolean +>PreProcessedFileInfo : PreProcessedFileInfo + + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; +>createLanguageService : (host: LanguageServiceHost, documentRegistry?: DocumentRegistry) => LanguageService +>host : LanguageServiceHost +>LanguageServiceHost : LanguageServiceHost +>documentRegistry : DocumentRegistry +>DocumentRegistry : DocumentRegistry +>LanguageService : LanguageService + + function createClassifier(): Classifier; +>createClassifier : () => Classifier +>Classifier : Classifier + + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +>getDefaultLibFilePath : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions +} + diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js new file mode 100644 index 00000000000..c8bec722309 --- /dev/null +++ b/tests/baselines/reference/APISample_linter.js @@ -0,0 +1,1992 @@ +//// [tests/cases/compiler/APISample_linter.ts] //// + +//// [APISample_linter.ts] + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +declare var console: any; +declare var fs: any; + +import ts = require("typescript"); + +export function delint(sourceFile: ts.SourceFile) { + delintNode(sourceFile); + + function delintNode(node: ts.Node) { + switch (node.kind) { + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.DoStatement: + if ((node).statement.kind !== ts.SyntaxKind.Block) { + report(node, "A looping statement's contents should be wrapped in a block body."); + } + break; + case ts.SyntaxKind.IfStatement: + var ifStatement = (node); + if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { + report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); + } + if (ifStatement.elseStatement && + ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) { + report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); + } + break; + + case ts.SyntaxKind.BinaryExpression: + var op = (node).operator; + + if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { + report(node, "Use '===' and '!=='.") + } + break; + } + + ts.forEachChild(node, delintNode); + } + + function report(node: ts.Node, message: string) { + var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + } +} + +var fileNames = process.argv.slice(2); +fileNames.forEach(fileName => { + // Parse a file + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); + + // delint it + delint(sourceFile); +}); + +//// [typescript.d.ts] +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { + [index: string]: T; + } + interface TextRange { + pos: number; + end: number; + } + const enum SyntaxKind { + Unknown = 0, + EndOfFileToken = 1, + SingleLineCommentTrivia = 2, + MultiLineCommentTrivia = 3, + NewLineTrivia = 4, + WhitespaceTrivia = 5, + ConflictMarkerTrivia = 6, + NumericLiteral = 7, + StringLiteral = 8, + RegularExpressionLiteral = 9, + NoSubstitutionTemplateLiteral = 10, + TemplateHead = 11, + TemplateMiddle = 12, + TemplateTail = 13, + OpenBraceToken = 14, + CloseBraceToken = 15, + OpenParenToken = 16, + CloseParenToken = 17, + OpenBracketToken = 18, + CloseBracketToken = 19, + DotToken = 20, + DotDotDotToken = 21, + SemicolonToken = 22, + CommaToken = 23, + LessThanToken = 24, + GreaterThanToken = 25, + LessThanEqualsToken = 26, + GreaterThanEqualsToken = 27, + EqualsEqualsToken = 28, + ExclamationEqualsToken = 29, + EqualsEqualsEqualsToken = 30, + ExclamationEqualsEqualsToken = 31, + EqualsGreaterThanToken = 32, + PlusToken = 33, + MinusToken = 34, + AsteriskToken = 35, + SlashToken = 36, + PercentToken = 37, + PlusPlusToken = 38, + MinusMinusToken = 39, + LessThanLessThanToken = 40, + GreaterThanGreaterThanToken = 41, + GreaterThanGreaterThanGreaterThanToken = 42, + AmpersandToken = 43, + BarToken = 44, + CaretToken = 45, + ExclamationToken = 46, + TildeToken = 47, + AmpersandAmpersandToken = 48, + BarBarToken = 49, + QuestionToken = 50, + ColonToken = 51, + EqualsToken = 52, + PlusEqualsToken = 53, + MinusEqualsToken = 54, + AsteriskEqualsToken = 55, + SlashEqualsToken = 56, + PercentEqualsToken = 57, + LessThanLessThanEqualsToken = 58, + GreaterThanGreaterThanEqualsToken = 59, + GreaterThanGreaterThanGreaterThanEqualsToken = 60, + AmpersandEqualsToken = 61, + BarEqualsToken = 62, + CaretEqualsToken = 63, + Identifier = 64, + BreakKeyword = 65, + CaseKeyword = 66, + CatchKeyword = 67, + ClassKeyword = 68, + ConstKeyword = 69, + ContinueKeyword = 70, + DebuggerKeyword = 71, + DefaultKeyword = 72, + DeleteKeyword = 73, + DoKeyword = 74, + ElseKeyword = 75, + EnumKeyword = 76, + ExportKeyword = 77, + ExtendsKeyword = 78, + FalseKeyword = 79, + FinallyKeyword = 80, + ForKeyword = 81, + FunctionKeyword = 82, + IfKeyword = 83, + ImportKeyword = 84, + InKeyword = 85, + InstanceOfKeyword = 86, + NewKeyword = 87, + NullKeyword = 88, + ReturnKeyword = 89, + SuperKeyword = 90, + SwitchKeyword = 91, + ThisKeyword = 92, + ThrowKeyword = 93, + TrueKeyword = 94, + TryKeyword = 95, + TypeOfKeyword = 96, + VarKeyword = 97, + VoidKeyword = 98, + WhileKeyword = 99, + WithKeyword = 100, + ImplementsKeyword = 101, + InterfaceKeyword = 102, + LetKeyword = 103, + PackageKeyword = 104, + PrivateKeyword = 105, + ProtectedKeyword = 106, + PublicKeyword = 107, + StaticKeyword = 108, + YieldKeyword = 109, + AnyKeyword = 110, + BooleanKeyword = 111, + ConstructorKeyword = 112, + DeclareKeyword = 113, + GetKeyword = 114, + ModuleKeyword = 115, + RequireKeyword = 116, + NumberKeyword = 117, + SetKeyword = 118, + StringKeyword = 119, + TypeKeyword = 120, + QualifiedName = 121, + ComputedPropertyName = 122, + TypeParameter = 123, + Parameter = 124, + PropertySignature = 125, + PropertyDeclaration = 126, + MethodSignature = 127, + MethodDeclaration = 128, + Constructor = 129, + GetAccessor = 130, + SetAccessor = 131, + CallSignature = 132, + ConstructSignature = 133, + IndexSignature = 134, + TypeReference = 135, + FunctionType = 136, + ConstructorType = 137, + TypeQuery = 138, + TypeLiteral = 139, + ArrayType = 140, + TupleType = 141, + UnionType = 142, + ParenthesizedType = 143, + ObjectBindingPattern = 144, + ArrayBindingPattern = 145, + BindingElement = 146, + ArrayLiteralExpression = 147, + ObjectLiteralExpression = 148, + PropertyAccessExpression = 149, + ElementAccessExpression = 150, + CallExpression = 151, + NewExpression = 152, + TaggedTemplateExpression = 153, + TypeAssertionExpression = 154, + ParenthesizedExpression = 155, + FunctionExpression = 156, + ArrowFunction = 157, + DeleteExpression = 158, + TypeOfExpression = 159, + VoidExpression = 160, + PrefixUnaryExpression = 161, + PostfixUnaryExpression = 162, + BinaryExpression = 163, + ConditionalExpression = 164, + TemplateExpression = 165, + YieldExpression = 166, + SpreadElementExpression = 167, + OmittedExpression = 168, + TemplateSpan = 169, + Block = 170, + VariableStatement = 171, + EmptyStatement = 172, + ExpressionStatement = 173, + IfStatement = 174, + DoStatement = 175, + WhileStatement = 176, + ForStatement = 177, + ForInStatement = 178, + ContinueStatement = 179, + BreakStatement = 180, + ReturnStatement = 181, + WithStatement = 182, + SwitchStatement = 183, + LabeledStatement = 184, + ThrowStatement = 185, + TryStatement = 186, + DebuggerStatement = 187, + VariableDeclaration = 188, + VariableDeclarationList = 189, + FunctionDeclaration = 190, + ClassDeclaration = 191, + InterfaceDeclaration = 192, + TypeAliasDeclaration = 193, + EnumDeclaration = 194, + ModuleDeclaration = 195, + ModuleBlock = 196, + ImportDeclaration = 197, + ExportAssignment = 198, + ExternalModuleReference = 199, + CaseClause = 200, + DefaultClause = 201, + HeritageClause = 202, + CatchClause = 203, + PropertyAssignment = 204, + ShorthandPropertyAssignment = 205, + EnumMember = 206, + SourceFile = 207, + SyntaxList = 208, + Count = 209, + FirstAssignment = 52, + LastAssignment = 63, + FirstReservedWord = 65, + LastReservedWord = 100, + FirstKeyword = 65, + LastKeyword = 120, + FirstFutureReservedWord = 101, + LastFutureReservedWord = 109, + FirstTypeNode = 135, + LastTypeNode = 143, + FirstPunctuation = 14, + LastPunctuation = 63, + FirstToken = 0, + LastToken = 120, + FirstTriviaToken = 2, + LastTriviaToken = 6, + FirstLiteralToken = 7, + LastLiteralToken = 10, + FirstTemplateToken = 10, + LastTemplateToken = 13, + FirstBinaryOperator = 24, + LastBinaryOperator = 63, + FirstNode = 121, + } + const enum NodeFlags { + Export = 1, + Ambient = 2, + Public = 16, + Private = 32, + Protected = 64, + Static = 128, + MultiLine = 256, + Synthetic = 512, + DeclarationFile = 1024, + Let = 2048, + Const = 4096, + OctalLiteral = 8192, + Modifier = 243, + AccessibilityModifier = 112, + BlockScoped = 6144, + } + const enum ParserContextFlags { + StrictMode = 1, + DisallowIn = 2, + Yield = 4, + GeneratorParameter = 8, + ThisNodeHasError = 16, + ParserGeneratedFlags = 31, + ThisNodeOrAnySubNodesHasError = 32, + HasAggregatedChildData = 64, + } + const enum RelationComparisonResult { + Succeeded = 1, + Failed = 2, + FailedAndReported = 3, + } + interface Node extends TextRange { + kind: SyntaxKind; + flags: NodeFlags; + parserContextFlags?: ParserContextFlags; + id?: number; + parent?: Node; + symbol?: Symbol; + locals?: SymbolTable; + nextContainer?: Node; + localSymbol?: Symbol; + modifiers?: ModifiersArray; + } + interface NodeArray extends Array, TextRange { + hasTrailingComma?: boolean; + } + interface ModifiersArray extends NodeArray { + flags: number; + } + interface Identifier extends PrimaryExpression { + text: string; + } + interface QualifiedName extends Node { + left: EntityName; + right: Identifier; + } + type EntityName = Identifier | QualifiedName; + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + interface Declaration extends Node { + _declarationBrand: any; + name?: DeclarationName; + } + interface ComputedPropertyName extends Node { + expression: Expression; + } + interface TypeParameterDeclaration extends Declaration { + name: Identifier; + constraint?: TypeNode; + expression?: Expression; + } + interface SignatureDeclaration extends Declaration { + typeParameters?: NodeArray; + parameters: NodeArray; + type?: TypeNode; + } + interface VariableDeclaration extends Declaration { + parent?: VariableDeclarationList; + name: Identifier | BindingPattern; + type?: TypeNode; + initializer?: Expression; + } + interface VariableDeclarationList extends Node { + declarations: NodeArray; + } + interface ParameterDeclaration extends Declaration { + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingElement extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + initializer?: Expression; + } + interface PropertyDeclaration extends Declaration, ClassElement { + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + } + interface PropertyAssignment extends ObjectLiteralElement { + _propertyAssignmentBrand: any; + name: DeclarationName; + questionToken?: Node; + initializer: Expression; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + name: Identifier; + questionToken?: Node; + } + interface VariableLikeDeclaration extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingPattern extends Node { + elements: NodeArray; + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { + _functionLikeDeclarationBrand: any; + asteriskToken?: Node; + questionToken?: Node; + body?: Block | Expression; + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { + name: Identifier; + body?: Block; + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + body?: Block; + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + body?: Block; + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + _accessorDeclarationBrand: any; + body: Block; + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { + _indexSignatureDeclarationBrand: any; + } + interface TypeNode extends Node { + _typeNodeBrand: any; + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { + _functionOrConstructorTypeNodeBrand: any; + } + interface TypeReferenceNode extends TypeNode { + typeName: EntityName; + typeArguments?: NodeArray; + } + interface TypeQueryNode extends TypeNode { + exprName: EntityName; + } + interface TypeLiteralNode extends TypeNode, Declaration { + members: NodeArray; + } + interface ArrayTypeNode extends TypeNode { + elementType: TypeNode; + } + interface TupleTypeNode extends TypeNode { + elementTypes: NodeArray; + } + interface UnionTypeNode extends TypeNode { + types: NodeArray; + } + interface ParenthesizedTypeNode extends TypeNode { + type: TypeNode; + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { + } + interface Expression extends Node { + _expressionBrand: any; + contextualType?: Type; + } + interface UnaryExpression extends Expression { + _unaryExpressionBrand: any; + } + interface PrefixUnaryExpression extends UnaryExpression { + operator: SyntaxKind; + operand: UnaryExpression; + } + interface PostfixUnaryExpression extends PostfixExpression { + operand: LeftHandSideExpression; + operator: SyntaxKind; + } + interface PostfixExpression extends UnaryExpression { + _postfixExpressionBrand: any; + } + interface LeftHandSideExpression extends PostfixExpression { + _leftHandSideExpressionBrand: any; + } + interface MemberExpression extends LeftHandSideExpression { + _memberExpressionBrand: any; + } + interface PrimaryExpression extends MemberExpression { + _primaryExpressionBrand: any; + } + interface DeleteExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface TypeOfExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface VoidExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface YieldExpression extends Expression { + asteriskToken?: Node; + expression: Expression; + } + interface BinaryExpression extends Expression { + left: Expression; + operator: SyntaxKind; + right: Expression; + } + interface ConditionalExpression extends Expression { + condition: Expression; + whenTrue: Expression; + whenFalse: Expression; + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + name?: Identifier; + body: Block | Expression; + } + interface LiteralExpression extends PrimaryExpression { + text: string; + isUnterminated?: boolean; + } + interface StringLiteralExpression extends LiteralExpression { + _stringLiteralExpressionBrand: any; + } + interface TemplateExpression extends PrimaryExpression { + head: LiteralExpression; + templateSpans: NodeArray; + } + interface TemplateSpan extends Node { + expression: Expression; + literal: LiteralExpression; + } + interface ParenthesizedExpression extends PrimaryExpression { + expression: Expression; + } + interface ArrayLiteralExpression extends PrimaryExpression { + elements: NodeArray; + } + interface SpreadElementExpression extends Expression { + expression: Expression; + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { + properties: NodeArray; + } + interface PropertyAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + name: Identifier; + } + interface ElementAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + argumentExpression?: Expression; + } + interface CallExpression extends LeftHandSideExpression { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments: NodeArray; + } + interface NewExpression extends CallExpression, PrimaryExpression { + } + interface TaggedTemplateExpression extends MemberExpression { + tag: LeftHandSideExpression; + template: LiteralExpression | TemplateExpression; + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; + interface TypeAssertion extends UnaryExpression { + type: TypeNode; + expression: UnaryExpression; + } + interface Statement extends Node, ModuleElement { + _statementBrand: any; + } + interface Block extends Statement { + statements: NodeArray; + } + interface VariableStatement extends Statement { + declarationList: VariableDeclarationList; + } + interface ExpressionStatement extends Statement { + expression: Expression; + } + interface IfStatement extends Statement { + expression: Expression; + thenStatement: Statement; + elseStatement?: Statement; + } + interface IterationStatement extends Statement { + statement: Statement; + } + interface DoStatement extends IterationStatement { + expression: Expression; + } + interface WhileStatement extends IterationStatement { + expression: Expression; + } + interface ForStatement extends IterationStatement { + initializer?: VariableDeclarationList | Expression; + condition?: Expression; + iterator?: Expression; + } + interface ForInStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + interface BreakOrContinueStatement extends Statement { + label?: Identifier; + } + interface ReturnStatement extends Statement { + expression?: Expression; + } + interface WithStatement extends Statement { + expression: Expression; + statement: Statement; + } + interface SwitchStatement extends Statement { + expression: Expression; + clauses: NodeArray; + } + interface CaseClause extends Node { + expression?: Expression; + statements: NodeArray; + } + interface DefaultClause extends Node { + statements: NodeArray; + } + type CaseOrDefaultClause = CaseClause | DefaultClause; + interface LabeledStatement extends Statement { + label: Identifier; + statement: Statement; + } + interface ThrowStatement extends Statement { + expression: Expression; + } + interface TryStatement extends Statement { + tryBlock: Block; + catchClause?: CatchClause; + finallyBlock?: Block; + } + interface CatchClause extends Declaration { + name: Identifier; + type?: TypeNode; + block: Block; + } + interface ModuleElement extends Node { + _moduleElementBrand: any; + } + interface ClassDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface ClassElement extends Declaration { + _classElementBrand: any; + } + interface InterfaceDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface HeritageClause extends Node { + token: SyntaxKind; + types?: NodeArray; + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { + name: Identifier; + type: TypeNode; + } + interface EnumMember extends Declaration { + name: DeclarationName; + initializer?: Expression; + } + interface EnumDeclaration extends Declaration, ModuleElement { + name: Identifier; + members: NodeArray; + } + interface ModuleDeclaration extends Declaration, ModuleElement { + name: Identifier | LiteralExpression; + body: ModuleBlock | ModuleDeclaration; + } + interface ModuleBlock extends Node, ModuleElement { + statements: NodeArray; + } + interface ImportDeclaration extends Declaration, ModuleElement { + name: Identifier; + moduleReference: EntityName | ExternalModuleReference; + } + interface ExternalModuleReference extends Node { + expression?: Expression; + } + interface ExportAssignment extends Statement, ModuleElement { + exportName: Identifier; + } + interface FileReference extends TextRange { + fileName: string; + } + interface CommentRange extends TextRange { + hasTrailingNewLine?: boolean; + } + interface SourceFile extends Declaration { + statements: NodeArray; + endOfFileToken: Node; + fileName: string; + text: string; + amdDependencies: string[]; + amdModuleName: string; + referencedFiles: FileReference[]; + hasNoDefaultLib: boolean; + externalModuleIndicator: Node; + languageVersion: ScriptTarget; + identifiers: Map; + } + interface ScriptReferenceHost { + getCompilerOptions(): CompilerOptions; + getSourceFile(fileName: string): SourceFile; + getCurrentDirectory(): string; + } + interface WriteFileCallback { + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + } + interface Program extends ScriptReferenceHost { + getSourceFiles(): SourceFile[]; + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeChecker(): TypeChecker; + getCommonSourceDirectory(): string; + } + interface SourceMapSpan { + emittedLine: number; + emittedColumn: number; + sourceLine: number; + sourceColumn: number; + nameIndex?: number; + sourceIndex: number; + } + interface SourceMapData { + sourceMapFilePath: string; + jsSourceMappingURL: string; + sourceMapFile: string; + sourceMapSourceRoot: string; + sourceMapSources: string[]; + inputSourceFileNames: string[]; + sourceMapNames?: string[]; + sourceMapMappings: string; + sourceMapDecodedMappings: SourceMapSpan[]; + } + enum ExitStatus { + Success = 0, + DiagnosticsPresent_OutputsSkipped = 1, + DiagnosticsPresent_OutputsGenerated = 2, + } + interface EmitResult { + emitSkipped: boolean; + diagnostics: Diagnostic[]; + sourceMaps: SourceMapData[]; + } + interface TypeCheckerHost { + getCompilerOptions(): CompilerOptions; + getSourceFiles(): SourceFile[]; + getSourceFile(fileName: string): SourceFile; + } + interface TypeChecker { + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; + getDeclaredTypeOfSymbol(symbol: Symbol): Type; + getPropertiesOfType(type: Type): Symbol[]; + getPropertyOfType(type: Type, propertyName: string): Symbol; + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; + getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getReturnTypeOfSignature(signature: Signature): Type; + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; + getSymbolAtLocation(node: Node): Symbol; + getShorthandAssignmentValueSymbol(location: Node): Symbol; + getTypeAtLocation(node: Node): Type; + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + getSymbolDisplayBuilder(): SymbolDisplayBuilder; + getFullyQualifiedName(symbol: Symbol): string; + getAugmentedPropertiesOfType(type: Type): Symbol[]; + getRootSymbols(symbol: Symbol): Symbol[]; + getContextualType(node: Expression): Type; + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + isUndefinedSymbol(symbol: Symbol): boolean; + isArgumentsSymbol(symbol: Symbol): boolean; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + getAliasedSymbol(symbol: Symbol): Symbol; + } + interface SymbolDisplayBuilder { + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + } + interface SymbolWriter { + writeKeyword(text: string): void; + writeOperator(text: string): void; + writePunctuation(text: string): void; + writeSpace(text: string): void; + writeStringLiteral(text: string): void; + writeParameter(text: string): void; + writeSymbol(text: string, symbol: Symbol): void; + writeLine(): void; + increaseIndent(): void; + decreaseIndent(): void; + clear(): void; + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + } + const enum TypeFormatFlags { + None = 0, + WriteArrayAsGenericType = 1, + UseTypeOfFunction = 2, + NoTruncation = 4, + WriteArrowStyleSignature = 8, + WriteOwnNameForAnyLike = 16, + WriteTypeArgumentsOfSignature = 32, + InElementType = 64, + UseFullyQualifiedType = 128, + } + const enum SymbolFormatFlags { + None = 0, + WriteTypeParametersOrArguments = 1, + UseOnlyExternalAliasing = 2, + } + const enum SymbolAccessibility { + Accessible = 0, + NotAccessible = 1, + CannotBeNamed = 2, + } + interface SymbolVisibilityResult { + accessibility: SymbolAccessibility; + aliasesToMakeVisible?: ImportDeclaration[]; + errorSymbolName?: string; + errorNode?: Node; + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { + errorModuleName?: string; + } + interface EmitResolver { + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; + getExpressionNamePrefix(node: Identifier): string; + getExportAssignmentName(node: SourceFile): string; + isReferencedImportDeclaration(node: ImportDeclaration): boolean; + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + getNodeCheckFlags(node: Node): NodeCheckFlags; + isDeclarationVisible(node: Declaration): boolean; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isUnknownIdentifier(location: Node, name: string): boolean; + } + const enum SymbolFlags { + FunctionScopedVariable = 1, + BlockScopedVariable = 2, + Property = 4, + EnumMember = 8, + Function = 16, + Class = 32, + Interface = 64, + ConstEnum = 128, + RegularEnum = 256, + ValueModule = 512, + NamespaceModule = 1024, + TypeLiteral = 2048, + ObjectLiteral = 4096, + Method = 8192, + Constructor = 16384, + GetAccessor = 32768, + SetAccessor = 65536, + Signature = 131072, + TypeParameter = 262144, + TypeAlias = 524288, + ExportValue = 1048576, + ExportType = 2097152, + ExportNamespace = 4194304, + Import = 8388608, + Instantiated = 16777216, + Merged = 33554432, + Transient = 67108864, + Prototype = 134217728, + UnionProperty = 268435456, + Optional = 536870912, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 793056, + Namespace = 1536, + Module = 1536, + Accessor = 98304, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 107455, + EnumMemberExcludes = 107455, + FunctionExcludes = 106927, + ClassExcludes = 899583, + InterfaceExcludes = 792992, + RegularEnumExcludes = 899327, + ConstEnumExcludes = 899967, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 530912, + TypeAliasExcludes = 793056, + ImportExcludes = 8388608, + ModuleMember = 8914931, + ExportHasLocal = 944, + HasLocals = 255504, + HasExports = 1952, + HasMembers = 6240, + IsContainer = 262128, + PropertyOrAccessor = 98308, + Export = 7340032, + } + interface Symbol { + flags: SymbolFlags; + name: string; + id?: number; + mergeId?: number; + declarations?: Declaration[]; + parent?: Symbol; + members?: SymbolTable; + exports?: SymbolTable; + exportSymbol?: Symbol; + valueDeclaration?: Declaration; + constEnumOnlyModule?: boolean; + } + interface SymbolLinks { + target?: Symbol; + type?: Type; + declaredType?: Type; + mapper?: TypeMapper; + referenced?: boolean; + exportAssignSymbol?: Symbol; + unionType?: UnionType; + } + interface TransientSymbol extends Symbol, SymbolLinks { + } + interface SymbolTable { + [index: string]: Symbol; + } + const enum NodeCheckFlags { + TypeChecked = 1, + LexicalThis = 2, + CaptureThis = 4, + EmitExtends = 8, + SuperInstance = 16, + SuperStatic = 32, + ContextChecked = 64, + EnumValuesComputed = 128, + } + interface NodeLinks { + resolvedType?: Type; + resolvedSignature?: Signature; + resolvedSymbol?: Symbol; + flags?: NodeCheckFlags; + enumMemberValue?: number; + isIllegalTypeReferenceInConstraint?: boolean; + isVisible?: boolean; + localModuleName?: string; + assignmentChecks?: Map; + hasReportedStatementInAmbientContext?: boolean; + importOnRightSide?: Symbol; + } + const enum TypeFlags { + Any = 1, + String = 2, + Number = 4, + Boolean = 8, + Void = 16, + Undefined = 32, + Null = 64, + Enum = 128, + StringLiteral = 256, + TypeParameter = 512, + Class = 1024, + Interface = 2048, + Reference = 4096, + Tuple = 8192, + Union = 16384, + Anonymous = 32768, + FromSignature = 65536, + ObjectLiteral = 131072, + ContainsUndefinedOrNull = 262144, + ContainsObjectLiteral = 524288, + Intrinsic = 127, + Primitive = 510, + StringLike = 258, + NumberLike = 132, + ObjectType = 48128, + RequiresWidening = 786432, + } + interface Type { + flags: TypeFlags; + id: number; + symbol?: Symbol; + } + interface IntrinsicType extends Type { + intrinsicName: string; + } + interface StringLiteralType extends Type { + text: string; + } + interface ObjectType extends Type { + } + interface InterfaceType extends ObjectType { + typeParameters: TypeParameter[]; + baseTypes: ObjectType[]; + declaredProperties: Symbol[]; + declaredCallSignatures: Signature[]; + declaredConstructSignatures: Signature[]; + declaredStringIndexType: Type; + declaredNumberIndexType: Type; + } + interface TypeReference extends ObjectType { + target: GenericType; + typeArguments: Type[]; + } + interface GenericType extends InterfaceType, TypeReference { + instantiations: Map; + } + interface TupleType extends ObjectType { + elementTypes: Type[]; + baseArrayType: TypeReference; + } + interface UnionType extends Type { + types: Type[]; + resolvedProperties: SymbolTable; + } + interface ResolvedType extends ObjectType, UnionType { + members: SymbolTable; + properties: Symbol[]; + callSignatures: Signature[]; + constructSignatures: Signature[]; + stringIndexType: Type; + numberIndexType: Type; + } + interface TypeParameter extends Type { + constraint: Type; + target?: TypeParameter; + mapper?: TypeMapper; + } + const enum SignatureKind { + Call = 0, + Construct = 1, + } + interface Signature { + declaration: SignatureDeclaration; + typeParameters: TypeParameter[]; + parameters: Symbol[]; + resolvedReturnType: Type; + minArgumentCount: number; + hasRestParameter: boolean; + hasStringLiterals: boolean; + target?: Signature; + mapper?: TypeMapper; + unionSignatures?: Signature[]; + erasedSignatureCache?: Signature; + isolatedSignatureType?: ObjectType; + } + const enum IndexKind { + String = 0, + Number = 1, + } + interface TypeMapper { + (t: Type): Type; + } + interface TypeInferences { + primary: Type[]; + secondary: Type[]; + } + interface InferenceContext { + typeParameters: TypeParameter[]; + inferUnionTypes: boolean; + inferences: TypeInferences[]; + inferredTypes: Type[]; + failedTypeParameterIndex?: number; + } + interface DiagnosticMessage { + key: string; + category: DiagnosticCategory; + code: number; + } + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; + } + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string | DiagnosticMessageChain; + category: DiagnosticCategory; + code: number; + } + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, + } + interface CompilerOptions { + allowNonTsExtensions?: boolean; + charset?: string; + codepage?: number; + declaration?: boolean; + diagnostics?: boolean; + emitBOM?: boolean; + help?: boolean; + listFiles?: boolean; + locale?: string; + mapRoot?: string; + module?: ModuleKind; + noEmit?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noImplicitAny?: boolean; + noLib?: boolean; + noLibCheck?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + preserveConstEnums?: boolean; + project?: string; + removeComments?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + version?: boolean; + watch?: boolean; + stripInternal?: boolean; + [option: string]: string | number | boolean; + } + const enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + } + interface LineAndCharacter { + line: number; + character: number; + } + const enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES6 = 2, + Latest = 2, + } + interface ParsedCommandLine { + options: CompilerOptions; + fileNames: string[]; + errors: Diagnostic[]; + } + interface CommandLineOption { + name: string; + type: string | Map; + isFilePath?: boolean; + shortName?: string; + description?: DiagnosticMessage; + paramType?: DiagnosticMessage; + error?: DiagnosticMessage; + experimental?: boolean; + } + const enum CharacterCodes { + nullCharacter = 0, + maxAsciiCharacter = 127, + lineFeed = 10, + carriageReturn = 13, + lineSeparator = 8232, + paragraphSeparator = 8233, + nextLine = 133, + space = 32, + nonBreakingSpace = 160, + enQuad = 8192, + emQuad = 8193, + enSpace = 8194, + emSpace = 8195, + threePerEmSpace = 8196, + fourPerEmSpace = 8197, + sixPerEmSpace = 8198, + figureSpace = 8199, + punctuationSpace = 8200, + thinSpace = 8201, + hairSpace = 8202, + zeroWidthSpace = 8203, + narrowNoBreakSpace = 8239, + ideographicSpace = 12288, + mathematicalSpace = 8287, + ogham = 5760, + _ = 95, + $ = 36, + _0 = 48, + _1 = 49, + _2 = 50, + _3 = 51, + _4 = 52, + _5 = 53, + _6 = 54, + _7 = 55, + _8 = 56, + _9 = 57, + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + ampersand = 38, + asterisk = 42, + at = 64, + backslash = 92, + backtick = 96, + bar = 124, + caret = 94, + closeBrace = 125, + closeBracket = 93, + closeParen = 41, + colon = 58, + comma = 44, + dot = 46, + doubleQuote = 34, + equals = 61, + exclamation = 33, + greaterThan = 62, + lessThan = 60, + minus = 45, + openBrace = 123, + openBracket = 91, + openParen = 40, + percent = 37, + plus = 43, + question = 63, + semicolon = 59, + singleQuote = 39, + slash = 47, + tilde = 126, + backspace = 8, + formFeed = 12, + byteOrderMark = 65279, + tab = 9, + verticalTab = 11, + } + interface CancellationToken { + isCancellationRequested(): boolean; + } + interface CompilerHost { + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; + getCancellationToken?(): CancellationToken; + writeFile: WriteFileCallback; + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + } + interface TextSpan { + start: number; + length: number; + } + interface TextChangeRange { + span: TextSpan; + newLength: number; + } +} +declare module "typescript" { + interface ErrorCallback { + (message: DiagnosticMessage, length: number): void; + } + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scan(): SyntaxKind; + setText(text: string): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + tryScan(callback: () => T): T; + } + function tokenToString(t: SyntaxKind): string; + function computeLineStarts(text: string): number[]; + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getLineStarts(sourceFile: SourceFile): number[]; + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + line: number; + character: number; + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function isWhiteSpace(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function isOctalDigit(ch: number): boolean; + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; + function createNode(kind: SyntaxKind): Node; + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; + function modifierToFlag(token: SyntaxKind): NodeFlags; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; + function isEvalOrArgumentsIdentifier(node: Node): boolean; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function isLeftHandSideExpression(expr: Expression): boolean; + function isAssignmentOperator(token: SyntaxKind): boolean; +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; + function getPreEmitDiagnostics(program: Program): Diagnostic[]; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +} +declare module "typescript" { + var servicesVersion: string; + interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile): number; + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFile): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; + } + interface Symbol { + getFlags(): SymbolFlags; + getName(): string; + getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface Type { + getFlags(): TypeFlags; + getSymbol(): Symbol; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol; + getApparentProperties(): Symbol[]; + getCallSignatures(): Signature[]; + getConstructSignatures(): Signature[]; + getStringIndexType(): Type; + getNumberIndexType(): Type; + } + interface Signature { + getDeclaration(): SignatureDeclaration; + getTypeParameters(): Type[]; + getParameters(): Symbol[]; + getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface SourceFile { + version: string; + scriptSnapshot: IScriptSnapshot; + nameTable: Map; + getNamedDeclarations(): Declaration[]; + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineStarts(): number[]; + getPositionFromLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; + /** Gets the length of this script snapshot. */ + getLength(): number; + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; + } + module ScriptSnapshot { + function fromString(text: string): IScriptSnapshot; + } + interface PreProcessedFileInfo { + referencedFiles: FileReference[]; + importedFiles: FileReference[]; + isLibFile: boolean; + } + interface LanguageServiceHost { + getCompilationSettings(): CompilerOptions; + getNewLine?(): string; + getScriptFileNames(): string[]; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): IScriptSnapshot; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + log?(s: string): void; + trace?(s: string): void; + error?(s: string): void; + } + interface LanguageService { + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; + getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigationBarItems(fileName: string): NavigationBarItem[]; + getOutliningSpans(fileName: string): OutliningSpan[]; + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getEmitOutput(fileName: string): EmitOutput; + getProgram(): Program; + getSourceFile(fileName: string): SourceFile; + dispose(): void; + } + interface ClassifiedSpan { + textSpan: TextSpan; + classificationType: string; + } + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; + } + interface TodoCommentDescriptor { + text: string; + priority: number; + } + interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; + } + class TextChange { + span: TextSpan; + newText: string; + } + interface RenameLocation { + textSpan: TextSpan; + fileName: string; + } + interface ReferenceEntry { + textSpan: TextSpan; + fileName: string; + isWriteAccess: boolean; + } + interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; + fileName: string; + textSpan: TextSpan; + containerName: string; + containerKind: string; + } + interface EditorOptions { + IndentSize: number; + TabSize: number; + NewLineCharacter: string; + ConvertTabsToSpaces: boolean; + } + interface FormatCodeOptions extends EditorOptions { + InsertSpaceAfterCommaDelimiter: boolean; + InsertSpaceAfterSemicolonInForStatements: boolean; + InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + PlaceOpenBraceOnNewLineForFunctions: boolean; + PlaceOpenBraceOnNewLineForControlBlocks: boolean; + } + interface DefinitionInfo { + fileName: string; + textSpan: TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; + } + enum SymbolDisplayPartKind { + aliasName = 0, + className = 1, + enumName = 2, + fieldName = 3, + interfaceName = 4, + keyword = 5, + lineBreak = 6, + numericLiteral = 7, + stringLiteral = 8, + localName = 9, + methodName = 10, + moduleName = 11, + operator = 12, + parameterName = 13, + propertyName = 14, + punctuation = 15, + space = 16, + text = 17, + typeParameterName = 18, + enumMemberName = 19, + functionName = 20, + regularExpressionLiteral = 21, + } + interface SymbolDisplayPart { + text: string; + kind: string; + } + interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TextSpan; + } + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; + } + interface CompletionInfo { + isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; + entries: CompletionEntry[]; + } + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + } + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface OutliningSpan { + /** The span of the document to actually collapse. */ + textSpan: TextSpan; + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; + /** The text to display in the editor for the collapsed region. */ + bannerText: string; + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; + } + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + const enum OutputFileType { + JavaScript = 0, + SourceMap = 1, + Declaration = 2, + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } + const enum EndOfLineState { + Start = 0, + InMultiLineCommentTrivia = 1, + InSingleQuoteStringLiteral = 2, + InDoubleQuoteStringLiteral = 3, + } + enum TokenClass { + Punctuation = 0, + Keyword = 1, + Operator = 2, + Comment = 3, + Whitespace = 4, + Identifier = 5, + NumberLiteral = 6, + StringLiteral = 7, + RegExpLiteral = 8, + } + interface ClassificationResult { + finalLexState: EndOfLineState; + entries: ClassificationInfo[]; + } + interface ClassificationInfo { + length: number; + classification: TokenClass; + } + interface Classifier { + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + } + class ScriptElementKind { + static unknown: string; + static keyword: string; + static scriptElement: string; + static moduleElement: string; + static classElement: string; + static interfaceElement: string; + static typeElement: string; + static enumElement: string; + static variableElement: string; + static localVariableElement: string; + static functionElement: string; + static localFunctionElement: string; + static memberFunctionElement: string; + static memberGetAccessorElement: string; + static memberSetAccessorElement: string; + static memberVariableElement: string; + static constructorImplementationElement: string; + static callSignatureElement: string; + static indexSignatureElement: string; + static constructSignatureElement: string; + static parameterElement: string; + static typeParameterElement: string; + static primitiveType: string; + static label: string; + static alias: string; + static constElement: string; + static letElement: string; + } + class ScriptElementKindModifier { + static none: string; + static publicMemberModifier: string; + static privateMemberModifier: string; + static protectedMemberModifier: string; + static exportedModifier: string; + static ambientModifier: string; + static staticModifier: string; + } + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAlias: string; + } + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; + function getDefaultCompilerOptions(): CompilerOptions; + class OperationCanceledException { + } + class CancellationTokenObject { + private cancellationToken; + static None: CancellationTokenObject; + constructor(cancellationToken: CancellationToken); + isCancellationRequested(): boolean; + throwIfCancellationRequested(): void; + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + var disableIncrementalParsing: boolean; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + function createDocumentRegistry(): DocumentRegistry; + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function createClassifier(): Classifier; + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +} + + +//// [APISample_linter.js] +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ +var ts = require("typescript"); +function delint(sourceFile) { + delintNode(sourceFile); + function delintNode(node) { + switch (node.kind) { + case 177 /* ForStatement */: + case 178 /* ForInStatement */: + case 176 /* WhileStatement */: + case 175 /* DoStatement */: + if (node.statement.kind !== 170 /* Block */) { + report(node, "A looping statement's contents should be wrapped in a block body."); + } + break; + case 174 /* IfStatement */: + var ifStatement = node; + if (ifStatement.thenStatement.kind !== 170 /* Block */) { + report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); + } + if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 170 /* Block */ && ifStatement.elseStatement.kind !== 174 /* IfStatement */) { + report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); + } + break; + case 163 /* BinaryExpression */: + var op = node.operator; + if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { + report(node, "Use '===' and '!=='."); + } + break; + } + ts.forEachChild(node, delintNode); + } + function report(node, message) { + var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); + console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message); + } +} +exports.delint = delint; +var fileNames = process.argv.slice(2); +fileNames.forEach(function (fileName) { + // Parse a file + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), 2 /* ES6 */, true); + // delint it + delint(sourceFile); +}); diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types new file mode 100644 index 00000000000..26254c69d54 --- /dev/null +++ b/tests/baselines/reference/APISample_linter.types @@ -0,0 +1,6085 @@ +=== tests/cases/compiler/APISample_linter.ts === + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#traversing-the-ast-with-a-little-linter + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +>process : any + +declare var console: any; +>console : any + +declare var fs: any; +>fs : any + +import ts = require("typescript"); +>ts : typeof ts + +export function delint(sourceFile: ts.SourceFile) { +>delint : (sourceFile: ts.SourceFile) => void +>sourceFile : ts.SourceFile +>ts : unknown +>SourceFile : ts.SourceFile + + delintNode(sourceFile); +>delintNode(sourceFile) : void +>delintNode : (node: ts.Node) => void +>sourceFile : ts.SourceFile + + function delintNode(node: ts.Node) { +>delintNode : (node: ts.Node) => void +>node : ts.Node +>ts : unknown +>Node : ts.Node + + switch (node.kind) { +>node.kind : ts.SyntaxKind +>node : ts.Node +>kind : ts.SyntaxKind + + case ts.SyntaxKind.ForStatement: +>ts.SyntaxKind.ForStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ForStatement : ts.SyntaxKind + + case ts.SyntaxKind.ForInStatement: +>ts.SyntaxKind.ForInStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ForInStatement : ts.SyntaxKind + + case ts.SyntaxKind.WhileStatement: +>ts.SyntaxKind.WhileStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>WhileStatement : ts.SyntaxKind + + case ts.SyntaxKind.DoStatement: +>ts.SyntaxKind.DoStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>DoStatement : ts.SyntaxKind + + if ((node).statement.kind !== ts.SyntaxKind.Block) { +>(node).statement.kind !== ts.SyntaxKind.Block : boolean +>(node).statement.kind : ts.SyntaxKind +>(node).statement : ts.Statement +>(node) : ts.IterationStatement +>node : ts.IterationStatement +>ts : unknown +>IterationStatement : ts.IterationStatement +>node : ts.Node +>statement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind + + report(node, "A looping statement's contents should be wrapped in a block body."); +>report(node, "A looping statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>node : ts.Node + } + break; + case ts.SyntaxKind.IfStatement: +>ts.SyntaxKind.IfStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>IfStatement : ts.SyntaxKind + + var ifStatement = (node); +>ifStatement : ts.IfStatement +>(node) : ts.IfStatement +>node : ts.IfStatement +>ts : unknown +>IfStatement : ts.IfStatement +>node : ts.Node + + if (ifStatement.thenStatement.kind !== ts.SyntaxKind.Block) { +>ifStatement.thenStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.thenStatement.kind : ts.SyntaxKind +>ifStatement.thenStatement : ts.Statement +>ifStatement : ts.IfStatement +>thenStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind + + report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); +>report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>ifStatement.thenStatement : ts.Statement +>ifStatement : ts.IfStatement +>thenStatement : ts.Statement + } + if (ifStatement.elseStatement && +>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean +>ifStatement.elseStatement && ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement + + ifStatement.elseStatement.kind !== ts.SyntaxKind.Block && ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement) { +>ifStatement.elseStatement.kind !== ts.SyntaxKind.Block : boolean +>ifStatement.elseStatement.kind : ts.SyntaxKind +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.Block : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>Block : ts.SyntaxKind +>ifStatement.elseStatement.kind !== ts.SyntaxKind.IfStatement : boolean +>ifStatement.elseStatement.kind : ts.SyntaxKind +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement +>kind : ts.SyntaxKind +>ts.SyntaxKind.IfStatement : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>IfStatement : ts.SyntaxKind + + report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); +>report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.") : void +>report : (node: ts.Node, message: string) => void +>ifStatement.elseStatement : ts.Statement +>ifStatement : ts.IfStatement +>elseStatement : ts.Statement + } + break; + + case ts.SyntaxKind.BinaryExpression: +>ts.SyntaxKind.BinaryExpression : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>BinaryExpression : ts.SyntaxKind + + var op = (node).operator; +>op : ts.SyntaxKind +>(node).operator : ts.SyntaxKind +>(node) : ts.BinaryExpression +>node : ts.BinaryExpression +>ts : unknown +>BinaryExpression : ts.BinaryExpression +>node : ts.Node +>operator : ts.SyntaxKind + + if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { +>op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean +>op === ts.SyntaxKind.EqualsEqualsToken : boolean +>op : ts.SyntaxKind +>ts.SyntaxKind.EqualsEqualsToken : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>EqualsEqualsToken : ts.SyntaxKind +>op === ts.SyntaxKind.ExclamationEqualsToken : boolean +>op : ts.SyntaxKind +>ts.SyntaxKind.ExclamationEqualsToken : ts.SyntaxKind +>ts.SyntaxKind : typeof ts.SyntaxKind +>ts : typeof ts +>SyntaxKind : typeof ts.SyntaxKind +>ExclamationEqualsToken : ts.SyntaxKind + + report(node, "Use '===' and '!=='.") +>report(node, "Use '===' and '!=='.") : void +>report : (node: ts.Node, message: string) => void +>node : ts.Node + } + break; + } + + ts.forEachChild(node, delintNode); +>ts.forEachChild(node, delintNode) : void +>ts.forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T +>ts : typeof ts +>forEachChild : (node: ts.Node, cbNode: (node: ts.Node) => T, cbNodeArray?: (nodes: ts.Node[]) => T) => T +>node : ts.Node +>delintNode : (node: ts.Node) => void + } + + function report(node: ts.Node, message: string) { +>report : (node: ts.Node, message: string) => void +>node : ts.Node +>ts : unknown +>Node : ts.Node +>message : string + + var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); +>lineChar : ts.LineAndCharacter +>sourceFile.getLineAndCharacterFromPosition(node.getStart()) : ts.LineAndCharacter +>sourceFile.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>sourceFile : ts.SourceFile +>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>node.getStart() : number +>node.getStart : (sourceFile?: ts.SourceFile) => number +>node : ts.Node +>getStart : (sourceFile?: ts.SourceFile) => number + + console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any +>console.log : any +>console : any +>log : any +>sourceFile.fileName : string +>sourceFile : ts.SourceFile +>fileName : string +>lineChar.line : number +>lineChar : ts.LineAndCharacter +>line : number +>lineChar.character : number +>lineChar : ts.LineAndCharacter +>character : number +>message : string + } +} + +var fileNames = process.argv.slice(2); +>fileNames : any +>process.argv.slice(2) : any +>process.argv.slice : any +>process.argv : any +>process : any +>argv : any +>slice : any + +fileNames.forEach(fileName => { +>fileNames.forEach(fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any +>fileNames.forEach : any +>fileNames : any +>forEach : any +>fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void +>fileName : any + + // Parse a file + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); +>sourceFile : ts.SourceFile +>ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile +>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>ts : typeof ts +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>fileName : any +>fs.readFileSync(fileName).toString() : any +>fs.readFileSync(fileName).toString : any +>fs.readFileSync(fileName) : any +>fs.readFileSync : any +>fs : any +>readFileSync : any +>fileName : any +>toString : any +>ts.ScriptTarget.ES6 : ts.ScriptTarget +>ts.ScriptTarget : typeof ts.ScriptTarget +>ts : typeof ts +>ScriptTarget : typeof ts.ScriptTarget +>ES6 : ts.ScriptTarget + + // delint it + delint(sourceFile); +>delint(sourceFile) : void +>delint : (sourceFile: ts.SourceFile) => void +>sourceFile : ts.SourceFile + +}); + +=== typescript.d.ts === +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { +>Map : Map +>T : T + + [index: string]: T; +>index : string +>T : T + } + interface TextRange { +>TextRange : TextRange + + pos: number; +>pos : number + + end: number; +>end : number + } + const enum SyntaxKind { +>SyntaxKind : SyntaxKind + + Unknown = 0, +>Unknown : SyntaxKind + + EndOfFileToken = 1, +>EndOfFileToken : SyntaxKind + + SingleLineCommentTrivia = 2, +>SingleLineCommentTrivia : SyntaxKind + + MultiLineCommentTrivia = 3, +>MultiLineCommentTrivia : SyntaxKind + + NewLineTrivia = 4, +>NewLineTrivia : SyntaxKind + + WhitespaceTrivia = 5, +>WhitespaceTrivia : SyntaxKind + + ConflictMarkerTrivia = 6, +>ConflictMarkerTrivia : SyntaxKind + + NumericLiteral = 7, +>NumericLiteral : SyntaxKind + + StringLiteral = 8, +>StringLiteral : SyntaxKind + + RegularExpressionLiteral = 9, +>RegularExpressionLiteral : SyntaxKind + + NoSubstitutionTemplateLiteral = 10, +>NoSubstitutionTemplateLiteral : SyntaxKind + + TemplateHead = 11, +>TemplateHead : SyntaxKind + + TemplateMiddle = 12, +>TemplateMiddle : SyntaxKind + + TemplateTail = 13, +>TemplateTail : SyntaxKind + + OpenBraceToken = 14, +>OpenBraceToken : SyntaxKind + + CloseBraceToken = 15, +>CloseBraceToken : SyntaxKind + + OpenParenToken = 16, +>OpenParenToken : SyntaxKind + + CloseParenToken = 17, +>CloseParenToken : SyntaxKind + + OpenBracketToken = 18, +>OpenBracketToken : SyntaxKind + + CloseBracketToken = 19, +>CloseBracketToken : SyntaxKind + + DotToken = 20, +>DotToken : SyntaxKind + + DotDotDotToken = 21, +>DotDotDotToken : SyntaxKind + + SemicolonToken = 22, +>SemicolonToken : SyntaxKind + + CommaToken = 23, +>CommaToken : SyntaxKind + + LessThanToken = 24, +>LessThanToken : SyntaxKind + + GreaterThanToken = 25, +>GreaterThanToken : SyntaxKind + + LessThanEqualsToken = 26, +>LessThanEqualsToken : SyntaxKind + + GreaterThanEqualsToken = 27, +>GreaterThanEqualsToken : SyntaxKind + + EqualsEqualsToken = 28, +>EqualsEqualsToken : SyntaxKind + + ExclamationEqualsToken = 29, +>ExclamationEqualsToken : SyntaxKind + + EqualsEqualsEqualsToken = 30, +>EqualsEqualsEqualsToken : SyntaxKind + + ExclamationEqualsEqualsToken = 31, +>ExclamationEqualsEqualsToken : SyntaxKind + + EqualsGreaterThanToken = 32, +>EqualsGreaterThanToken : SyntaxKind + + PlusToken = 33, +>PlusToken : SyntaxKind + + MinusToken = 34, +>MinusToken : SyntaxKind + + AsteriskToken = 35, +>AsteriskToken : SyntaxKind + + SlashToken = 36, +>SlashToken : SyntaxKind + + PercentToken = 37, +>PercentToken : SyntaxKind + + PlusPlusToken = 38, +>PlusPlusToken : SyntaxKind + + MinusMinusToken = 39, +>MinusMinusToken : SyntaxKind + + LessThanLessThanToken = 40, +>LessThanLessThanToken : SyntaxKind + + GreaterThanGreaterThanToken = 41, +>GreaterThanGreaterThanToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanToken = 42, +>GreaterThanGreaterThanGreaterThanToken : SyntaxKind + + AmpersandToken = 43, +>AmpersandToken : SyntaxKind + + BarToken = 44, +>BarToken : SyntaxKind + + CaretToken = 45, +>CaretToken : SyntaxKind + + ExclamationToken = 46, +>ExclamationToken : SyntaxKind + + TildeToken = 47, +>TildeToken : SyntaxKind + + AmpersandAmpersandToken = 48, +>AmpersandAmpersandToken : SyntaxKind + + BarBarToken = 49, +>BarBarToken : SyntaxKind + + QuestionToken = 50, +>QuestionToken : SyntaxKind + + ColonToken = 51, +>ColonToken : SyntaxKind + + EqualsToken = 52, +>EqualsToken : SyntaxKind + + PlusEqualsToken = 53, +>PlusEqualsToken : SyntaxKind + + MinusEqualsToken = 54, +>MinusEqualsToken : SyntaxKind + + AsteriskEqualsToken = 55, +>AsteriskEqualsToken : SyntaxKind + + SlashEqualsToken = 56, +>SlashEqualsToken : SyntaxKind + + PercentEqualsToken = 57, +>PercentEqualsToken : SyntaxKind + + LessThanLessThanEqualsToken = 58, +>LessThanLessThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanEqualsToken = 59, +>GreaterThanGreaterThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanEqualsToken = 60, +>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind + + AmpersandEqualsToken = 61, +>AmpersandEqualsToken : SyntaxKind + + BarEqualsToken = 62, +>BarEqualsToken : SyntaxKind + + CaretEqualsToken = 63, +>CaretEqualsToken : SyntaxKind + + Identifier = 64, +>Identifier : SyntaxKind + + BreakKeyword = 65, +>BreakKeyword : SyntaxKind + + CaseKeyword = 66, +>CaseKeyword : SyntaxKind + + CatchKeyword = 67, +>CatchKeyword : SyntaxKind + + ClassKeyword = 68, +>ClassKeyword : SyntaxKind + + ConstKeyword = 69, +>ConstKeyword : SyntaxKind + + ContinueKeyword = 70, +>ContinueKeyword : SyntaxKind + + DebuggerKeyword = 71, +>DebuggerKeyword : SyntaxKind + + DefaultKeyword = 72, +>DefaultKeyword : SyntaxKind + + DeleteKeyword = 73, +>DeleteKeyword : SyntaxKind + + DoKeyword = 74, +>DoKeyword : SyntaxKind + + ElseKeyword = 75, +>ElseKeyword : SyntaxKind + + EnumKeyword = 76, +>EnumKeyword : SyntaxKind + + ExportKeyword = 77, +>ExportKeyword : SyntaxKind + + ExtendsKeyword = 78, +>ExtendsKeyword : SyntaxKind + + FalseKeyword = 79, +>FalseKeyword : SyntaxKind + + FinallyKeyword = 80, +>FinallyKeyword : SyntaxKind + + ForKeyword = 81, +>ForKeyword : SyntaxKind + + FunctionKeyword = 82, +>FunctionKeyword : SyntaxKind + + IfKeyword = 83, +>IfKeyword : SyntaxKind + + ImportKeyword = 84, +>ImportKeyword : SyntaxKind + + InKeyword = 85, +>InKeyword : SyntaxKind + + InstanceOfKeyword = 86, +>InstanceOfKeyword : SyntaxKind + + NewKeyword = 87, +>NewKeyword : SyntaxKind + + NullKeyword = 88, +>NullKeyword : SyntaxKind + + ReturnKeyword = 89, +>ReturnKeyword : SyntaxKind + + SuperKeyword = 90, +>SuperKeyword : SyntaxKind + + SwitchKeyword = 91, +>SwitchKeyword : SyntaxKind + + ThisKeyword = 92, +>ThisKeyword : SyntaxKind + + ThrowKeyword = 93, +>ThrowKeyword : SyntaxKind + + TrueKeyword = 94, +>TrueKeyword : SyntaxKind + + TryKeyword = 95, +>TryKeyword : SyntaxKind + + TypeOfKeyword = 96, +>TypeOfKeyword : SyntaxKind + + VarKeyword = 97, +>VarKeyword : SyntaxKind + + VoidKeyword = 98, +>VoidKeyword : SyntaxKind + + WhileKeyword = 99, +>WhileKeyword : SyntaxKind + + WithKeyword = 100, +>WithKeyword : SyntaxKind + + ImplementsKeyword = 101, +>ImplementsKeyword : SyntaxKind + + InterfaceKeyword = 102, +>InterfaceKeyword : SyntaxKind + + LetKeyword = 103, +>LetKeyword : SyntaxKind + + PackageKeyword = 104, +>PackageKeyword : SyntaxKind + + PrivateKeyword = 105, +>PrivateKeyword : SyntaxKind + + ProtectedKeyword = 106, +>ProtectedKeyword : SyntaxKind + + PublicKeyword = 107, +>PublicKeyword : SyntaxKind + + StaticKeyword = 108, +>StaticKeyword : SyntaxKind + + YieldKeyword = 109, +>YieldKeyword : SyntaxKind + + AnyKeyword = 110, +>AnyKeyword : SyntaxKind + + BooleanKeyword = 111, +>BooleanKeyword : SyntaxKind + + ConstructorKeyword = 112, +>ConstructorKeyword : SyntaxKind + + DeclareKeyword = 113, +>DeclareKeyword : SyntaxKind + + GetKeyword = 114, +>GetKeyword : SyntaxKind + + ModuleKeyword = 115, +>ModuleKeyword : SyntaxKind + + RequireKeyword = 116, +>RequireKeyword : SyntaxKind + + NumberKeyword = 117, +>NumberKeyword : SyntaxKind + + SetKeyword = 118, +>SetKeyword : SyntaxKind + + StringKeyword = 119, +>StringKeyword : SyntaxKind + + TypeKeyword = 120, +>TypeKeyword : SyntaxKind + + QualifiedName = 121, +>QualifiedName : SyntaxKind + + ComputedPropertyName = 122, +>ComputedPropertyName : SyntaxKind + + TypeParameter = 123, +>TypeParameter : SyntaxKind + + Parameter = 124, +>Parameter : SyntaxKind + + PropertySignature = 125, +>PropertySignature : SyntaxKind + + PropertyDeclaration = 126, +>PropertyDeclaration : SyntaxKind + + MethodSignature = 127, +>MethodSignature : SyntaxKind + + MethodDeclaration = 128, +>MethodDeclaration : SyntaxKind + + Constructor = 129, +>Constructor : SyntaxKind + + GetAccessor = 130, +>GetAccessor : SyntaxKind + + SetAccessor = 131, +>SetAccessor : SyntaxKind + + CallSignature = 132, +>CallSignature : SyntaxKind + + ConstructSignature = 133, +>ConstructSignature : SyntaxKind + + IndexSignature = 134, +>IndexSignature : SyntaxKind + + TypeReference = 135, +>TypeReference : SyntaxKind + + FunctionType = 136, +>FunctionType : SyntaxKind + + ConstructorType = 137, +>ConstructorType : SyntaxKind + + TypeQuery = 138, +>TypeQuery : SyntaxKind + + TypeLiteral = 139, +>TypeLiteral : SyntaxKind + + ArrayType = 140, +>ArrayType : SyntaxKind + + TupleType = 141, +>TupleType : SyntaxKind + + UnionType = 142, +>UnionType : SyntaxKind + + ParenthesizedType = 143, +>ParenthesizedType : SyntaxKind + + ObjectBindingPattern = 144, +>ObjectBindingPattern : SyntaxKind + + ArrayBindingPattern = 145, +>ArrayBindingPattern : SyntaxKind + + BindingElement = 146, +>BindingElement : SyntaxKind + + ArrayLiteralExpression = 147, +>ArrayLiteralExpression : SyntaxKind + + ObjectLiteralExpression = 148, +>ObjectLiteralExpression : SyntaxKind + + PropertyAccessExpression = 149, +>PropertyAccessExpression : SyntaxKind + + ElementAccessExpression = 150, +>ElementAccessExpression : SyntaxKind + + CallExpression = 151, +>CallExpression : SyntaxKind + + NewExpression = 152, +>NewExpression : SyntaxKind + + TaggedTemplateExpression = 153, +>TaggedTemplateExpression : SyntaxKind + + TypeAssertionExpression = 154, +>TypeAssertionExpression : SyntaxKind + + ParenthesizedExpression = 155, +>ParenthesizedExpression : SyntaxKind + + FunctionExpression = 156, +>FunctionExpression : SyntaxKind + + ArrowFunction = 157, +>ArrowFunction : SyntaxKind + + DeleteExpression = 158, +>DeleteExpression : SyntaxKind + + TypeOfExpression = 159, +>TypeOfExpression : SyntaxKind + + VoidExpression = 160, +>VoidExpression : SyntaxKind + + PrefixUnaryExpression = 161, +>PrefixUnaryExpression : SyntaxKind + + PostfixUnaryExpression = 162, +>PostfixUnaryExpression : SyntaxKind + + BinaryExpression = 163, +>BinaryExpression : SyntaxKind + + ConditionalExpression = 164, +>ConditionalExpression : SyntaxKind + + TemplateExpression = 165, +>TemplateExpression : SyntaxKind + + YieldExpression = 166, +>YieldExpression : SyntaxKind + + SpreadElementExpression = 167, +>SpreadElementExpression : SyntaxKind + + OmittedExpression = 168, +>OmittedExpression : SyntaxKind + + TemplateSpan = 169, +>TemplateSpan : SyntaxKind + + Block = 170, +>Block : SyntaxKind + + VariableStatement = 171, +>VariableStatement : SyntaxKind + + EmptyStatement = 172, +>EmptyStatement : SyntaxKind + + ExpressionStatement = 173, +>ExpressionStatement : SyntaxKind + + IfStatement = 174, +>IfStatement : SyntaxKind + + DoStatement = 175, +>DoStatement : SyntaxKind + + WhileStatement = 176, +>WhileStatement : SyntaxKind + + ForStatement = 177, +>ForStatement : SyntaxKind + + ForInStatement = 178, +>ForInStatement : SyntaxKind + + ContinueStatement = 179, +>ContinueStatement : SyntaxKind + + BreakStatement = 180, +>BreakStatement : SyntaxKind + + ReturnStatement = 181, +>ReturnStatement : SyntaxKind + + WithStatement = 182, +>WithStatement : SyntaxKind + + SwitchStatement = 183, +>SwitchStatement : SyntaxKind + + LabeledStatement = 184, +>LabeledStatement : SyntaxKind + + ThrowStatement = 185, +>ThrowStatement : SyntaxKind + + TryStatement = 186, +>TryStatement : SyntaxKind + + DebuggerStatement = 187, +>DebuggerStatement : SyntaxKind + + VariableDeclaration = 188, +>VariableDeclaration : SyntaxKind + + VariableDeclarationList = 189, +>VariableDeclarationList : SyntaxKind + + FunctionDeclaration = 190, +>FunctionDeclaration : SyntaxKind + + ClassDeclaration = 191, +>ClassDeclaration : SyntaxKind + + InterfaceDeclaration = 192, +>InterfaceDeclaration : SyntaxKind + + TypeAliasDeclaration = 193, +>TypeAliasDeclaration : SyntaxKind + + EnumDeclaration = 194, +>EnumDeclaration : SyntaxKind + + ModuleDeclaration = 195, +>ModuleDeclaration : SyntaxKind + + ModuleBlock = 196, +>ModuleBlock : SyntaxKind + + ImportDeclaration = 197, +>ImportDeclaration : SyntaxKind + + ExportAssignment = 198, +>ExportAssignment : SyntaxKind + + ExternalModuleReference = 199, +>ExternalModuleReference : SyntaxKind + + CaseClause = 200, +>CaseClause : SyntaxKind + + DefaultClause = 201, +>DefaultClause : SyntaxKind + + HeritageClause = 202, +>HeritageClause : SyntaxKind + + CatchClause = 203, +>CatchClause : SyntaxKind + + PropertyAssignment = 204, +>PropertyAssignment : SyntaxKind + + ShorthandPropertyAssignment = 205, +>ShorthandPropertyAssignment : SyntaxKind + + EnumMember = 206, +>EnumMember : SyntaxKind + + SourceFile = 207, +>SourceFile : SyntaxKind + + SyntaxList = 208, +>SyntaxList : SyntaxKind + + Count = 209, +>Count : SyntaxKind + + FirstAssignment = 52, +>FirstAssignment : SyntaxKind + + LastAssignment = 63, +>LastAssignment : SyntaxKind + + FirstReservedWord = 65, +>FirstReservedWord : SyntaxKind + + LastReservedWord = 100, +>LastReservedWord : SyntaxKind + + FirstKeyword = 65, +>FirstKeyword : SyntaxKind + + LastKeyword = 120, +>LastKeyword : SyntaxKind + + FirstFutureReservedWord = 101, +>FirstFutureReservedWord : SyntaxKind + + LastFutureReservedWord = 109, +>LastFutureReservedWord : SyntaxKind + + FirstTypeNode = 135, +>FirstTypeNode : SyntaxKind + + LastTypeNode = 143, +>LastTypeNode : SyntaxKind + + FirstPunctuation = 14, +>FirstPunctuation : SyntaxKind + + LastPunctuation = 63, +>LastPunctuation : SyntaxKind + + FirstToken = 0, +>FirstToken : SyntaxKind + + LastToken = 120, +>LastToken : SyntaxKind + + FirstTriviaToken = 2, +>FirstTriviaToken : SyntaxKind + + LastTriviaToken = 6, +>LastTriviaToken : SyntaxKind + + FirstLiteralToken = 7, +>FirstLiteralToken : SyntaxKind + + LastLiteralToken = 10, +>LastLiteralToken : SyntaxKind + + FirstTemplateToken = 10, +>FirstTemplateToken : SyntaxKind + + LastTemplateToken = 13, +>LastTemplateToken : SyntaxKind + + FirstBinaryOperator = 24, +>FirstBinaryOperator : SyntaxKind + + LastBinaryOperator = 63, +>LastBinaryOperator : SyntaxKind + + FirstNode = 121, +>FirstNode : SyntaxKind + } + const enum NodeFlags { +>NodeFlags : NodeFlags + + Export = 1, +>Export : NodeFlags + + Ambient = 2, +>Ambient : NodeFlags + + Public = 16, +>Public : NodeFlags + + Private = 32, +>Private : NodeFlags + + Protected = 64, +>Protected : NodeFlags + + Static = 128, +>Static : NodeFlags + + MultiLine = 256, +>MultiLine : NodeFlags + + Synthetic = 512, +>Synthetic : NodeFlags + + DeclarationFile = 1024, +>DeclarationFile : NodeFlags + + Let = 2048, +>Let : NodeFlags + + Const = 4096, +>Const : NodeFlags + + OctalLiteral = 8192, +>OctalLiteral : NodeFlags + + Modifier = 243, +>Modifier : NodeFlags + + AccessibilityModifier = 112, +>AccessibilityModifier : NodeFlags + + BlockScoped = 6144, +>BlockScoped : NodeFlags + } + const enum ParserContextFlags { +>ParserContextFlags : ParserContextFlags + + StrictMode = 1, +>StrictMode : ParserContextFlags + + DisallowIn = 2, +>DisallowIn : ParserContextFlags + + Yield = 4, +>Yield : ParserContextFlags + + GeneratorParameter = 8, +>GeneratorParameter : ParserContextFlags + + ThisNodeHasError = 16, +>ThisNodeHasError : ParserContextFlags + + ParserGeneratedFlags = 31, +>ParserGeneratedFlags : ParserContextFlags + + ThisNodeOrAnySubNodesHasError = 32, +>ThisNodeOrAnySubNodesHasError : ParserContextFlags + + HasAggregatedChildData = 64, +>HasAggregatedChildData : ParserContextFlags + } + const enum RelationComparisonResult { +>RelationComparisonResult : RelationComparisonResult + + Succeeded = 1, +>Succeeded : RelationComparisonResult + + Failed = 2, +>Failed : RelationComparisonResult + + FailedAndReported = 3, +>FailedAndReported : RelationComparisonResult + } + interface Node extends TextRange { +>Node : Node +>TextRange : TextRange + + kind: SyntaxKind; +>kind : SyntaxKind +>SyntaxKind : SyntaxKind + + flags: NodeFlags; +>flags : NodeFlags +>NodeFlags : NodeFlags + + parserContextFlags?: ParserContextFlags; +>parserContextFlags : ParserContextFlags +>ParserContextFlags : ParserContextFlags + + id?: number; +>id : number + + parent?: Node; +>parent : Node +>Node : Node + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + + locals?: SymbolTable; +>locals : SymbolTable +>SymbolTable : SymbolTable + + nextContainer?: Node; +>nextContainer : Node +>Node : Node + + localSymbol?: Symbol; +>localSymbol : Symbol +>Symbol : Symbol + + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + } + interface NodeArray extends Array, TextRange { +>NodeArray : NodeArray +>T : T +>Array : T[] +>T : T +>TextRange : TextRange + + hasTrailingComma?: boolean; +>hasTrailingComma : boolean + } + interface ModifiersArray extends NodeArray { +>ModifiersArray : ModifiersArray +>NodeArray : NodeArray +>Node : Node + + flags: number; +>flags : number + } + interface Identifier extends PrimaryExpression { +>Identifier : Identifier +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + } + interface QualifiedName extends Node { +>QualifiedName : QualifiedName +>Node : Node + + left: EntityName; +>left : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + right: Identifier; +>right : Identifier +>Identifier : Identifier + } + type EntityName = Identifier | QualifiedName; +>EntityName : Identifier | QualifiedName +>Identifier : Identifier +>QualifiedName : QualifiedName + + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>Identifier : Identifier +>LiteralExpression : LiteralExpression +>ComputedPropertyName : ComputedPropertyName +>BindingPattern : BindingPattern + + interface Declaration extends Node { +>Declaration : Declaration +>Node : Node + + _declarationBrand: any; +>_declarationBrand : any + + name?: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + } + interface ComputedPropertyName extends Node { +>ComputedPropertyName : ComputedPropertyName +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TypeParameterDeclaration extends Declaration { +>TypeParameterDeclaration : TypeParameterDeclaration +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + constraint?: TypeNode; +>constraint : TypeNode +>TypeNode : TypeNode + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface SignatureDeclaration extends Declaration { +>SignatureDeclaration : SignatureDeclaration +>Declaration : Declaration + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + parameters: NodeArray; +>parameters : NodeArray +>NodeArray : NodeArray +>ParameterDeclaration : ParameterDeclaration + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface VariableDeclaration extends Declaration { +>VariableDeclaration : VariableDeclaration +>Declaration : Declaration + + parent?: VariableDeclarationList; +>parent : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface VariableDeclarationList extends Node { +>VariableDeclarationList : VariableDeclarationList +>Node : Node + + declarations: NodeArray; +>declarations : NodeArray +>NodeArray : NodeArray +>VariableDeclaration : VariableDeclaration + } + interface ParameterDeclaration extends Declaration { +>ParameterDeclaration : ParameterDeclaration +>Declaration : Declaration + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingElement extends Declaration { +>BindingElement : BindingElement +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface PropertyDeclaration extends Declaration, ClassElement { +>PropertyDeclaration : PropertyDeclaration +>Declaration : Declaration +>ClassElement : ClassElement + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface ObjectLiteralElement extends Declaration { +>ObjectLiteralElement : ObjectLiteralElement +>Declaration : Declaration + + _objectLiteralBrandBrand: any; +>_objectLiteralBrandBrand : any + } + interface PropertyAssignment extends ObjectLiteralElement { +>PropertyAssignment : PropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + _propertyAssignmentBrand: any; +>_propertyAssignmentBrand : any + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + initializer: Expression; +>initializer : Expression +>Expression : Expression + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { +>ShorthandPropertyAssignment : ShorthandPropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + questionToken?: Node; +>questionToken : Node +>Node : Node + } + interface VariableLikeDeclaration extends Declaration { +>VariableLikeDeclaration : VariableLikeDeclaration +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingPattern extends Node { +>BindingPattern : BindingPattern +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>BindingElement : BindingElement + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { +>FunctionLikeDeclaration : FunctionLikeDeclaration +>SignatureDeclaration : SignatureDeclaration + + _functionLikeDeclarationBrand: any; +>_functionLikeDeclarationBrand : any + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + questionToken?: Node; +>questionToken : Node +>Node : Node + + body?: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { +>FunctionDeclaration : FunctionDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>Statement : Statement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + body?: Block; +>body : Block +>Block : Block + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>MethodDeclaration : MethodDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + body?: Block; +>body : Block +>Block : Block + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { +>ConstructorDeclaration : ConstructorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement + + body?: Block; +>body : Block +>Block : Block + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>AccessorDeclaration : AccessorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + _accessorDeclarationBrand: any; +>_accessorDeclarationBrand : any + + body: Block; +>body : Block +>Block : Block + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { +>IndexSignatureDeclaration : IndexSignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>ClassElement : ClassElement + + _indexSignatureDeclarationBrand: any; +>_indexSignatureDeclarationBrand : any + } + interface TypeNode extends Node { +>TypeNode : TypeNode +>Node : Node + + _typeNodeBrand: any; +>_typeNodeBrand : any + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { +>FunctionOrConstructorTypeNode : FunctionOrConstructorTypeNode +>TypeNode : TypeNode +>SignatureDeclaration : SignatureDeclaration + + _functionOrConstructorTypeNodeBrand: any; +>_functionOrConstructorTypeNodeBrand : any + } + interface TypeReferenceNode extends TypeNode { +>TypeReferenceNode : TypeReferenceNode +>TypeNode : TypeNode + + typeName: EntityName; +>typeName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface TypeQueryNode extends TypeNode { +>TypeQueryNode : TypeQueryNode +>TypeNode : TypeNode + + exprName: EntityName; +>exprName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + } + interface TypeLiteralNode extends TypeNode, Declaration { +>TypeLiteralNode : TypeLiteralNode +>TypeNode : TypeNode +>Declaration : Declaration + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Node : Node + } + interface ArrayTypeNode extends TypeNode { +>ArrayTypeNode : ArrayTypeNode +>TypeNode : TypeNode + + elementType: TypeNode; +>elementType : TypeNode +>TypeNode : TypeNode + } + interface TupleTypeNode extends TypeNode { +>TupleTypeNode : TupleTypeNode +>TypeNode : TypeNode + + elementTypes: NodeArray; +>elementTypes : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface UnionTypeNode extends TypeNode { +>UnionTypeNode : UnionTypeNode +>TypeNode : TypeNode + + types: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface ParenthesizedTypeNode extends TypeNode { +>ParenthesizedTypeNode : ParenthesizedTypeNode +>TypeNode : TypeNode + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { +>StringLiteralTypeNode : StringLiteralTypeNode +>LiteralExpression : LiteralExpression +>TypeNode : TypeNode + } + interface Expression extends Node { +>Expression : Expression +>Node : Node + + _expressionBrand: any; +>_expressionBrand : any + + contextualType?: Type; +>contextualType : Type +>Type : Type + } + interface UnaryExpression extends Expression { +>UnaryExpression : UnaryExpression +>Expression : Expression + + _unaryExpressionBrand: any; +>_unaryExpressionBrand : any + } + interface PrefixUnaryExpression extends UnaryExpression { +>PrefixUnaryExpression : PrefixUnaryExpression +>UnaryExpression : UnaryExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + operand: UnaryExpression; +>operand : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface PostfixUnaryExpression extends PostfixExpression { +>PostfixUnaryExpression : PostfixUnaryExpression +>PostfixExpression : PostfixExpression + + operand: LeftHandSideExpression; +>operand : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + } + interface PostfixExpression extends UnaryExpression { +>PostfixExpression : PostfixExpression +>UnaryExpression : UnaryExpression + + _postfixExpressionBrand: any; +>_postfixExpressionBrand : any + } + interface LeftHandSideExpression extends PostfixExpression { +>LeftHandSideExpression : LeftHandSideExpression +>PostfixExpression : PostfixExpression + + _leftHandSideExpressionBrand: any; +>_leftHandSideExpressionBrand : any + } + interface MemberExpression extends LeftHandSideExpression { +>MemberExpression : MemberExpression +>LeftHandSideExpression : LeftHandSideExpression + + _memberExpressionBrand: any; +>_memberExpressionBrand : any + } + interface PrimaryExpression extends MemberExpression { +>PrimaryExpression : PrimaryExpression +>MemberExpression : MemberExpression + + _primaryExpressionBrand: any; +>_primaryExpressionBrand : any + } + interface DeleteExpression extends UnaryExpression { +>DeleteExpression : DeleteExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface TypeOfExpression extends UnaryExpression { +>TypeOfExpression : TypeOfExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface VoidExpression extends UnaryExpression { +>VoidExpression : VoidExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface YieldExpression extends Expression { +>YieldExpression : YieldExpression +>Expression : Expression + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BinaryExpression extends Expression { +>BinaryExpression : BinaryExpression +>Expression : Expression + + left: Expression; +>left : Expression +>Expression : Expression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + right: Expression; +>right : Expression +>Expression : Expression + } + interface ConditionalExpression extends Expression { +>ConditionalExpression : ConditionalExpression +>Expression : Expression + + condition: Expression; +>condition : Expression +>Expression : Expression + + whenTrue: Expression; +>whenTrue : Expression +>Expression : Expression + + whenFalse: Expression; +>whenFalse : Expression +>Expression : Expression + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { +>FunctionExpression : FunctionExpression +>PrimaryExpression : PrimaryExpression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface LiteralExpression extends PrimaryExpression { +>LiteralExpression : LiteralExpression +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + + isUnterminated?: boolean; +>isUnterminated : boolean + } + interface StringLiteralExpression extends LiteralExpression { +>StringLiteralExpression : StringLiteralExpression +>LiteralExpression : LiteralExpression + + _stringLiteralExpressionBrand: any; +>_stringLiteralExpressionBrand : any + } + interface TemplateExpression extends PrimaryExpression { +>TemplateExpression : TemplateExpression +>PrimaryExpression : PrimaryExpression + + head: LiteralExpression; +>head : LiteralExpression +>LiteralExpression : LiteralExpression + + templateSpans: NodeArray; +>templateSpans : NodeArray +>NodeArray : NodeArray +>TemplateSpan : TemplateSpan + } + interface TemplateSpan extends Node { +>TemplateSpan : TemplateSpan +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + + literal: LiteralExpression; +>literal : LiteralExpression +>LiteralExpression : LiteralExpression + } + interface ParenthesizedExpression extends PrimaryExpression { +>ParenthesizedExpression : ParenthesizedExpression +>PrimaryExpression : PrimaryExpression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ArrayLiteralExpression extends PrimaryExpression { +>ArrayLiteralExpression : ArrayLiteralExpression +>PrimaryExpression : PrimaryExpression + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface SpreadElementExpression extends Expression { +>SpreadElementExpression : SpreadElementExpression +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { +>ObjectLiteralExpression : ObjectLiteralExpression +>PrimaryExpression : PrimaryExpression +>Declaration : Declaration + + properties: NodeArray; +>properties : NodeArray +>NodeArray : NodeArray +>ObjectLiteralElement : ObjectLiteralElement + } + interface PropertyAccessExpression extends MemberExpression { +>PropertyAccessExpression : PropertyAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ElementAccessExpression extends MemberExpression { +>ElementAccessExpression : ElementAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + argumentExpression?: Expression; +>argumentExpression : Expression +>Expression : Expression + } + interface CallExpression extends LeftHandSideExpression { +>CallExpression : CallExpression +>LeftHandSideExpression : LeftHandSideExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + + arguments: NodeArray; +>arguments : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface NewExpression extends CallExpression, PrimaryExpression { +>NewExpression : NewExpression +>CallExpression : CallExpression +>PrimaryExpression : PrimaryExpression + } + interface TaggedTemplateExpression extends MemberExpression { +>TaggedTemplateExpression : TaggedTemplateExpression +>MemberExpression : MemberExpression + + tag: LeftHandSideExpression; +>tag : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + template: LiteralExpression | TemplateExpression; +>template : LiteralExpression | TemplateExpression +>LiteralExpression : LiteralExpression +>TemplateExpression : TemplateExpression + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>CallExpression : CallExpression +>NewExpression : NewExpression +>TaggedTemplateExpression : TaggedTemplateExpression + + interface TypeAssertion extends UnaryExpression { +>TypeAssertion : TypeAssertion +>UnaryExpression : UnaryExpression + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface Statement extends Node, ModuleElement { +>Statement : Statement +>Node : Node +>ModuleElement : ModuleElement + + _statementBrand: any; +>_statementBrand : any + } + interface Block extends Statement { +>Block : Block +>Statement : Statement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface VariableStatement extends Statement { +>VariableStatement : VariableStatement +>Statement : Statement + + declarationList: VariableDeclarationList; +>declarationList : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + } + interface ExpressionStatement extends Statement { +>ExpressionStatement : ExpressionStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface IfStatement extends Statement { +>IfStatement : IfStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + thenStatement: Statement; +>thenStatement : Statement +>Statement : Statement + + elseStatement?: Statement; +>elseStatement : Statement +>Statement : Statement + } + interface IterationStatement extends Statement { +>IterationStatement : IterationStatement +>Statement : Statement + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface DoStatement extends IterationStatement { +>DoStatement : DoStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface WhileStatement extends IterationStatement { +>WhileStatement : WhileStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForStatement extends IterationStatement { +>ForStatement : ForStatement +>IterationStatement : IterationStatement + + initializer?: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + condition?: Expression; +>condition : Expression +>Expression : Expression + + iterator?: Expression; +>iterator : Expression +>Expression : Expression + } + interface ForInStatement extends IterationStatement { +>ForInStatement : ForInStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BreakOrContinueStatement extends Statement { +>BreakOrContinueStatement : BreakOrContinueStatement +>Statement : Statement + + label?: Identifier; +>label : Identifier +>Identifier : Identifier + } + interface ReturnStatement extends Statement { +>ReturnStatement : ReturnStatement +>Statement : Statement + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface WithStatement extends Statement { +>WithStatement : WithStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface SwitchStatement extends Statement { +>SwitchStatement : SwitchStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + clauses: NodeArray; +>clauses : NodeArray +>NodeArray : NodeArray +>CaseOrDefaultClause : CaseClause | DefaultClause + } + interface CaseClause extends Node { +>CaseClause : CaseClause +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface DefaultClause extends Node { +>DefaultClause : DefaultClause +>Node : Node + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + type CaseOrDefaultClause = CaseClause | DefaultClause; +>CaseOrDefaultClause : CaseClause | DefaultClause +>CaseClause : CaseClause +>DefaultClause : DefaultClause + + interface LabeledStatement extends Statement { +>LabeledStatement : LabeledStatement +>Statement : Statement + + label: Identifier; +>label : Identifier +>Identifier : Identifier + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface ThrowStatement extends Statement { +>ThrowStatement : ThrowStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TryStatement extends Statement { +>TryStatement : TryStatement +>Statement : Statement + + tryBlock: Block; +>tryBlock : Block +>Block : Block + + catchClause?: CatchClause; +>catchClause : CatchClause +>CatchClause : CatchClause + + finallyBlock?: Block; +>finallyBlock : Block +>Block : Block + } + interface CatchClause extends Declaration { +>CatchClause : CatchClause +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + block: Block; +>block : Block +>Block : Block + } + interface ModuleElement extends Node { +>ModuleElement : ModuleElement +>Node : Node + + _moduleElementBrand: any; +>_moduleElementBrand : any + } + interface ClassDeclaration extends Declaration, ModuleElement { +>ClassDeclaration : ClassDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>ClassElement : ClassElement + } + interface ClassElement extends Declaration { +>ClassElement : ClassElement +>Declaration : Declaration + + _classElementBrand: any; +>_classElementBrand : any + } + interface InterfaceDeclaration extends Declaration, ModuleElement { +>InterfaceDeclaration : InterfaceDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Declaration : Declaration + } + interface HeritageClause extends Node { +>HeritageClause : HeritageClause +>Node : Node + + token: SyntaxKind; +>token : SyntaxKind +>SyntaxKind : SyntaxKind + + types?: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeReferenceNode : TypeReferenceNode + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { +>TypeAliasDeclaration : TypeAliasDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface EnumMember extends Declaration { +>EnumMember : EnumMember +>Declaration : Declaration + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface EnumDeclaration extends Declaration, ModuleElement { +>EnumDeclaration : EnumDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>EnumMember : EnumMember + } + interface ModuleDeclaration extends Declaration, ModuleElement { +>ModuleDeclaration : ModuleDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier | LiteralExpression; +>name : Identifier | LiteralExpression +>Identifier : Identifier +>LiteralExpression : LiteralExpression + + body: ModuleBlock | ModuleDeclaration; +>body : ModuleDeclaration | ModuleBlock +>ModuleBlock : ModuleBlock +>ModuleDeclaration : ModuleDeclaration + } + interface ModuleBlock extends Node, ModuleElement { +>ModuleBlock : ModuleBlock +>Node : Node +>ModuleElement : ModuleElement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + } + interface ImportDeclaration extends Declaration, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + moduleReference: EntityName | ExternalModuleReference; +>moduleReference : Identifier | QualifiedName | ExternalModuleReference +>EntityName : Identifier | QualifiedName +>ExternalModuleReference : ExternalModuleReference + } + interface ExternalModuleReference extends Node { +>ExternalModuleReference : ExternalModuleReference +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface ExportAssignment extends Statement, ModuleElement { +>ExportAssignment : ExportAssignment +>Statement : Statement +>ModuleElement : ModuleElement + + exportName: Identifier; +>exportName : Identifier +>Identifier : Identifier + } + interface FileReference extends TextRange { +>FileReference : FileReference +>TextRange : TextRange + + fileName: string; +>fileName : string + } + interface CommentRange extends TextRange { +>CommentRange : CommentRange +>TextRange : TextRange + + hasTrailingNewLine?: boolean; +>hasTrailingNewLine : boolean + } + interface SourceFile extends Declaration { +>SourceFile : SourceFile +>Declaration : Declaration + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + + endOfFileToken: Node; +>endOfFileToken : Node +>Node : Node + + fileName: string; +>fileName : string + + text: string; +>text : string + + amdDependencies: string[]; +>amdDependencies : string[] + + amdModuleName: string; +>amdModuleName : string + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + hasNoDefaultLib: boolean; +>hasNoDefaultLib : boolean + + externalModuleIndicator: Node; +>externalModuleIndicator : Node +>Node : Node + + languageVersion: ScriptTarget; +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + identifiers: Map; +>identifiers : Map +>Map : Map + } + interface ScriptReferenceHost { +>ScriptReferenceHost : ScriptReferenceHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + } + interface WriteFileCallback { +>WriteFileCallback : WriteFileCallback + + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>fileName : string +>data : string +>writeByteOrderMark : boolean +>onError : (message: string) => void +>message : string + } + interface Program extends ScriptReferenceHost { +>Program : Program +>ScriptReferenceHost : ScriptReferenceHost + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; +>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult +>targetSourceFile : SourceFile +>SourceFile : SourceFile +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback +>EmitResult : EmitResult + + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSyntacticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getGlobalDiagnostics(): Diagnostic[]; +>getGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSemanticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getDeclarationDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeChecker(): TypeChecker; +>getTypeChecker : () => TypeChecker +>TypeChecker : TypeChecker + + getCommonSourceDirectory(): string; +>getCommonSourceDirectory : () => string + } + interface SourceMapSpan { +>SourceMapSpan : SourceMapSpan + + emittedLine: number; +>emittedLine : number + + emittedColumn: number; +>emittedColumn : number + + sourceLine: number; +>sourceLine : number + + sourceColumn: number; +>sourceColumn : number + + nameIndex?: number; +>nameIndex : number + + sourceIndex: number; +>sourceIndex : number + } + interface SourceMapData { +>SourceMapData : SourceMapData + + sourceMapFilePath: string; +>sourceMapFilePath : string + + jsSourceMappingURL: string; +>jsSourceMappingURL : string + + sourceMapFile: string; +>sourceMapFile : string + + sourceMapSourceRoot: string; +>sourceMapSourceRoot : string + + sourceMapSources: string[]; +>sourceMapSources : string[] + + inputSourceFileNames: string[]; +>inputSourceFileNames : string[] + + sourceMapNames?: string[]; +>sourceMapNames : string[] + + sourceMapMappings: string; +>sourceMapMappings : string + + sourceMapDecodedMappings: SourceMapSpan[]; +>sourceMapDecodedMappings : SourceMapSpan[] +>SourceMapSpan : SourceMapSpan + } + enum ExitStatus { +>ExitStatus : ExitStatus + + Success = 0, +>Success : ExitStatus + + DiagnosticsPresent_OutputsSkipped = 1, +>DiagnosticsPresent_OutputsSkipped : ExitStatus + + DiagnosticsPresent_OutputsGenerated = 2, +>DiagnosticsPresent_OutputsGenerated : ExitStatus + } + interface EmitResult { +>EmitResult : EmitResult + + emitSkipped: boolean; +>emitSkipped : boolean + + diagnostics: Diagnostic[]; +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + + sourceMaps: SourceMapData[]; +>sourceMaps : SourceMapData[] +>SourceMapData : SourceMapData + } + interface TypeCheckerHost { +>TypeCheckerHost : TypeCheckerHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + } + interface TypeChecker { +>TypeChecker : TypeChecker + + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; +>getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type +>symbol : Symbol +>Symbol : Symbol +>node : Node +>Node : Node +>Type : Type + + getDeclaredTypeOfSymbol(symbol: Symbol): Type; +>getDeclaredTypeOfSymbol : (symbol: Symbol) => Type +>symbol : Symbol +>Symbol : Symbol +>Type : Type + + getPropertiesOfType(type: Type): Symbol[]; +>getPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getPropertyOfType(type: Type, propertyName: string): Symbol; +>getPropertyOfType : (type: Type, propertyName: string) => Symbol +>type : Type +>Type : Type +>propertyName : string +>Symbol : Symbol + + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; +>getSignaturesOfType : (type: Type, kind: SignatureKind) => Signature[] +>type : Type +>Type : Type +>kind : SignatureKind +>SignatureKind : SignatureKind +>Signature : Signature + + getIndexTypeOfType(type: Type, kind: IndexKind): Type; +>getIndexTypeOfType : (type: Type, kind: IndexKind) => Type +>type : Type +>Type : Type +>kind : IndexKind +>IndexKind : IndexKind +>Type : Type + + getReturnTypeOfSignature(signature: Signature): Type; +>getReturnTypeOfSignature : (signature: Signature) => Type +>signature : Signature +>Signature : Signature +>Type : Type + + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; +>getSymbolsInScope : (location: Node, meaning: SymbolFlags) => Symbol[] +>location : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>Symbol : Symbol + + getSymbolAtLocation(node: Node): Symbol; +>getSymbolAtLocation : (node: Node) => Symbol +>node : Node +>Node : Node +>Symbol : Symbol + + getShorthandAssignmentValueSymbol(location: Node): Symbol; +>getShorthandAssignmentValueSymbol : (location: Node) => Symbol +>location : Node +>Node : Node +>Symbol : Symbol + + getTypeAtLocation(node: Node): Type; +>getTypeAtLocation : (node: Node) => Type +>node : Node +>Node : Node +>Type : Type + + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; +>typeToString : (type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => string +>type : Type +>Type : Type +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; +>symbolToString : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => string +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + + getSymbolDisplayBuilder(): SymbolDisplayBuilder; +>getSymbolDisplayBuilder : () => SymbolDisplayBuilder +>SymbolDisplayBuilder : SymbolDisplayBuilder + + getFullyQualifiedName(symbol: Symbol): string; +>getFullyQualifiedName : (symbol: Symbol) => string +>symbol : Symbol +>Symbol : Symbol + + getAugmentedPropertiesOfType(type: Type): Symbol[]; +>getAugmentedPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getRootSymbols(symbol: Symbol): Symbol[]; +>getRootSymbols : (symbol: Symbol) => Symbol[] +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getContextualType(node: Expression): Type; +>getContextualType : (node: Expression) => Type +>node : Expression +>Expression : Expression +>Type : Type + + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; +>getResolvedSignature : (node: CallExpression | NewExpression | TaggedTemplateExpression, candidatesOutArray?: Signature[]) => Signature +>node : CallExpression | NewExpression | TaggedTemplateExpression +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>candidatesOutArray : Signature[] +>Signature : Signature +>Signature : Signature + + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; +>getSignatureFromDeclaration : (declaration: SignatureDeclaration) => Signature +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>Signature : Signature + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + isUndefinedSymbol(symbol: Symbol): boolean; +>isUndefinedSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + isArgumentsSymbol(symbol: Symbol): boolean; +>isArgumentsSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; +>isValidPropertyAccess : (node: QualifiedName | PropertyAccessExpression, propertyName: string) => boolean +>node : QualifiedName | PropertyAccessExpression +>PropertyAccessExpression : PropertyAccessExpression +>QualifiedName : QualifiedName +>propertyName : string + + getAliasedSymbol(symbol: Symbol): Symbol; +>getAliasedSymbol : (symbol: Symbol) => Symbol +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + } + interface SymbolDisplayBuilder { +>SymbolDisplayBuilder : SymbolDisplayBuilder + + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeDisplay : (type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>type : Type +>Type : Type +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; +>buildSymbolDisplay : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>flags : SymbolFormatFlags +>SymbolFormatFlags : SymbolFormatFlags + + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildSignatureDisplay : (signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signatures : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildParameterDisplay : (parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameter : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplay : (tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>tp : TypeParameter +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplayFromSymbol : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaraiton : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForParametersAndDelimiters : (parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameters : Symbol[] +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForTypeParametersAndDelimiters : (typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildReturnTypeDisplay : (signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signature : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + } + interface SymbolWriter { +>SymbolWriter : SymbolWriter + + writeKeyword(text: string): void; +>writeKeyword : (text: string) => void +>text : string + + writeOperator(text: string): void; +>writeOperator : (text: string) => void +>text : string + + writePunctuation(text: string): void; +>writePunctuation : (text: string) => void +>text : string + + writeSpace(text: string): void; +>writeSpace : (text: string) => void +>text : string + + writeStringLiteral(text: string): void; +>writeStringLiteral : (text: string) => void +>text : string + + writeParameter(text: string): void; +>writeParameter : (text: string) => void +>text : string + + writeSymbol(text: string, symbol: Symbol): void; +>writeSymbol : (text: string, symbol: Symbol) => void +>text : string +>symbol : Symbol +>Symbol : Symbol + + writeLine(): void; +>writeLine : () => void + + increaseIndent(): void; +>increaseIndent : () => void + + decreaseIndent(): void; +>decreaseIndent : () => void + + clear(): void; +>clear : () => void + + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; +>trackSymbol : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => void +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + } + const enum TypeFormatFlags { +>TypeFormatFlags : TypeFormatFlags + + None = 0, +>None : TypeFormatFlags + + WriteArrayAsGenericType = 1, +>WriteArrayAsGenericType : TypeFormatFlags + + UseTypeOfFunction = 2, +>UseTypeOfFunction : TypeFormatFlags + + NoTruncation = 4, +>NoTruncation : TypeFormatFlags + + WriteArrowStyleSignature = 8, +>WriteArrowStyleSignature : TypeFormatFlags + + WriteOwnNameForAnyLike = 16, +>WriteOwnNameForAnyLike : TypeFormatFlags + + WriteTypeArgumentsOfSignature = 32, +>WriteTypeArgumentsOfSignature : TypeFormatFlags + + InElementType = 64, +>InElementType : TypeFormatFlags + + UseFullyQualifiedType = 128, +>UseFullyQualifiedType : TypeFormatFlags + } + const enum SymbolFormatFlags { +>SymbolFormatFlags : SymbolFormatFlags + + None = 0, +>None : SymbolFormatFlags + + WriteTypeParametersOrArguments = 1, +>WriteTypeParametersOrArguments : SymbolFormatFlags + + UseOnlyExternalAliasing = 2, +>UseOnlyExternalAliasing : SymbolFormatFlags + } + const enum SymbolAccessibility { +>SymbolAccessibility : SymbolAccessibility + + Accessible = 0, +>Accessible : SymbolAccessibility + + NotAccessible = 1, +>NotAccessible : SymbolAccessibility + + CannotBeNamed = 2, +>CannotBeNamed : SymbolAccessibility + } + interface SymbolVisibilityResult { +>SymbolVisibilityResult : SymbolVisibilityResult + + accessibility: SymbolAccessibility; +>accessibility : SymbolAccessibility +>SymbolAccessibility : SymbolAccessibility + + aliasesToMakeVisible?: ImportDeclaration[]; +>aliasesToMakeVisible : ImportDeclaration[] +>ImportDeclaration : ImportDeclaration + + errorSymbolName?: string; +>errorSymbolName : string + + errorNode?: Node; +>errorNode : Node +>Node : Node + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { +>SymbolAccessiblityResult : SymbolAccessiblityResult +>SymbolVisibilityResult : SymbolVisibilityResult + + errorModuleName?: string; +>errorModuleName : string + } + interface EmitResolver { +>EmitResolver : EmitResolver + + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; +>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string +>container : EnumDeclaration | ModuleDeclaration +>ModuleDeclaration : ModuleDeclaration +>EnumDeclaration : EnumDeclaration + + getExpressionNamePrefix(node: Identifier): string; +>getExpressionNamePrefix : (node: Identifier) => string +>node : Identifier +>Identifier : Identifier + + getExportAssignmentName(node: SourceFile): string; +>getExportAssignmentName : (node: SourceFile) => string +>node : SourceFile +>SourceFile : SourceFile + + isReferencedImportDeclaration(node: ImportDeclaration): boolean; +>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; +>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + getNodeCheckFlags(node: Node): NodeCheckFlags; +>getNodeCheckFlags : (node: Node) => NodeCheckFlags +>node : Node +>Node : Node +>NodeCheckFlags : NodeCheckFlags + + isDeclarationVisible(node: Declaration): boolean; +>isDeclarationVisible : (node: Declaration) => boolean +>node : Declaration +>Declaration : Declaration + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfDeclaration : (declaration: VariableLikeDeclaration | AccessorDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>declaration : VariableLikeDeclaration | AccessorDeclaration +>AccessorDeclaration : AccessorDeclaration +>VariableLikeDeclaration : VariableLikeDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>signatureDeclaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; +>isSymbolAccessible : (symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) => SymbolAccessiblityResult +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>SymbolAccessiblityResult : SymbolAccessiblityResult + + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName +>enclosingDeclaration : Node +>Node : Node +>SymbolVisibilityResult : SymbolVisibilityResult + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean +>location : Node +>Node : Node +>name : string + } + const enum SymbolFlags { +>SymbolFlags : SymbolFlags + + FunctionScopedVariable = 1, +>FunctionScopedVariable : SymbolFlags + + BlockScopedVariable = 2, +>BlockScopedVariable : SymbolFlags + + Property = 4, +>Property : SymbolFlags + + EnumMember = 8, +>EnumMember : SymbolFlags + + Function = 16, +>Function : SymbolFlags + + Class = 32, +>Class : SymbolFlags + + Interface = 64, +>Interface : SymbolFlags + + ConstEnum = 128, +>ConstEnum : SymbolFlags + + RegularEnum = 256, +>RegularEnum : SymbolFlags + + ValueModule = 512, +>ValueModule : SymbolFlags + + NamespaceModule = 1024, +>NamespaceModule : SymbolFlags + + TypeLiteral = 2048, +>TypeLiteral : SymbolFlags + + ObjectLiteral = 4096, +>ObjectLiteral : SymbolFlags + + Method = 8192, +>Method : SymbolFlags + + Constructor = 16384, +>Constructor : SymbolFlags + + GetAccessor = 32768, +>GetAccessor : SymbolFlags + + SetAccessor = 65536, +>SetAccessor : SymbolFlags + + Signature = 131072, +>Signature : SymbolFlags + + TypeParameter = 262144, +>TypeParameter : SymbolFlags + + TypeAlias = 524288, +>TypeAlias : SymbolFlags + + ExportValue = 1048576, +>ExportValue : SymbolFlags + + ExportType = 2097152, +>ExportType : SymbolFlags + + ExportNamespace = 4194304, +>ExportNamespace : SymbolFlags + + Import = 8388608, +>Import : SymbolFlags + + Instantiated = 16777216, +>Instantiated : SymbolFlags + + Merged = 33554432, +>Merged : SymbolFlags + + Transient = 67108864, +>Transient : SymbolFlags + + Prototype = 134217728, +>Prototype : SymbolFlags + + UnionProperty = 268435456, +>UnionProperty : SymbolFlags + + Optional = 536870912, +>Optional : SymbolFlags + + Enum = 384, +>Enum : SymbolFlags + + Variable = 3, +>Variable : SymbolFlags + + Value = 107455, +>Value : SymbolFlags + + Type = 793056, +>Type : SymbolFlags + + Namespace = 1536, +>Namespace : SymbolFlags + + Module = 1536, +>Module : SymbolFlags + + Accessor = 98304, +>Accessor : SymbolFlags + + FunctionScopedVariableExcludes = 107454, +>FunctionScopedVariableExcludes : SymbolFlags + + BlockScopedVariableExcludes = 107455, +>BlockScopedVariableExcludes : SymbolFlags + + ParameterExcludes = 107455, +>ParameterExcludes : SymbolFlags + + PropertyExcludes = 107455, +>PropertyExcludes : SymbolFlags + + EnumMemberExcludes = 107455, +>EnumMemberExcludes : SymbolFlags + + FunctionExcludes = 106927, +>FunctionExcludes : SymbolFlags + + ClassExcludes = 899583, +>ClassExcludes : SymbolFlags + + InterfaceExcludes = 792992, +>InterfaceExcludes : SymbolFlags + + RegularEnumExcludes = 899327, +>RegularEnumExcludes : SymbolFlags + + ConstEnumExcludes = 899967, +>ConstEnumExcludes : SymbolFlags + + ValueModuleExcludes = 106639, +>ValueModuleExcludes : SymbolFlags + + NamespaceModuleExcludes = 0, +>NamespaceModuleExcludes : SymbolFlags + + MethodExcludes = 99263, +>MethodExcludes : SymbolFlags + + GetAccessorExcludes = 41919, +>GetAccessorExcludes : SymbolFlags + + SetAccessorExcludes = 74687, +>SetAccessorExcludes : SymbolFlags + + TypeParameterExcludes = 530912, +>TypeParameterExcludes : SymbolFlags + + TypeAliasExcludes = 793056, +>TypeAliasExcludes : SymbolFlags + + ImportExcludes = 8388608, +>ImportExcludes : SymbolFlags + + ModuleMember = 8914931, +>ModuleMember : SymbolFlags + + ExportHasLocal = 944, +>ExportHasLocal : SymbolFlags + + HasLocals = 255504, +>HasLocals : SymbolFlags + + HasExports = 1952, +>HasExports : SymbolFlags + + HasMembers = 6240, +>HasMembers : SymbolFlags + + IsContainer = 262128, +>IsContainer : SymbolFlags + + PropertyOrAccessor = 98308, +>PropertyOrAccessor : SymbolFlags + + Export = 7340032, +>Export : SymbolFlags + } + interface Symbol { +>Symbol : Symbol + + flags: SymbolFlags; +>flags : SymbolFlags +>SymbolFlags : SymbolFlags + + name: string; +>name : string + + id?: number; +>id : number + + mergeId?: number; +>mergeId : number + + declarations?: Declaration[]; +>declarations : Declaration[] +>Declaration : Declaration + + parent?: Symbol; +>parent : Symbol +>Symbol : Symbol + + members?: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + exports?: SymbolTable; +>exports : SymbolTable +>SymbolTable : SymbolTable + + exportSymbol?: Symbol; +>exportSymbol : Symbol +>Symbol : Symbol + + valueDeclaration?: Declaration; +>valueDeclaration : Declaration +>Declaration : Declaration + + constEnumOnlyModule?: boolean; +>constEnumOnlyModule : boolean + } + interface SymbolLinks { +>SymbolLinks : SymbolLinks + + target?: Symbol; +>target : Symbol +>Symbol : Symbol + + type?: Type; +>type : Type +>Type : Type + + declaredType?: Type; +>declaredType : Type +>Type : Type + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + referenced?: boolean; +>referenced : boolean + + exportAssignSymbol?: Symbol; +>exportAssignSymbol : Symbol +>Symbol : Symbol + + unionType?: UnionType; +>unionType : UnionType +>UnionType : UnionType + } + interface TransientSymbol extends Symbol, SymbolLinks { +>TransientSymbol : TransientSymbol +>Symbol : Symbol +>SymbolLinks : SymbolLinks + } + interface SymbolTable { +>SymbolTable : SymbolTable + + [index: string]: Symbol; +>index : string +>Symbol : Symbol + } + const enum NodeCheckFlags { +>NodeCheckFlags : NodeCheckFlags + + TypeChecked = 1, +>TypeChecked : NodeCheckFlags + + LexicalThis = 2, +>LexicalThis : NodeCheckFlags + + CaptureThis = 4, +>CaptureThis : NodeCheckFlags + + EmitExtends = 8, +>EmitExtends : NodeCheckFlags + + SuperInstance = 16, +>SuperInstance : NodeCheckFlags + + SuperStatic = 32, +>SuperStatic : NodeCheckFlags + + ContextChecked = 64, +>ContextChecked : NodeCheckFlags + + EnumValuesComputed = 128, +>EnumValuesComputed : NodeCheckFlags + } + interface NodeLinks { +>NodeLinks : NodeLinks + + resolvedType?: Type; +>resolvedType : Type +>Type : Type + + resolvedSignature?: Signature; +>resolvedSignature : Signature +>Signature : Signature + + resolvedSymbol?: Symbol; +>resolvedSymbol : Symbol +>Symbol : Symbol + + flags?: NodeCheckFlags; +>flags : NodeCheckFlags +>NodeCheckFlags : NodeCheckFlags + + enumMemberValue?: number; +>enumMemberValue : number + + isIllegalTypeReferenceInConstraint?: boolean; +>isIllegalTypeReferenceInConstraint : boolean + + isVisible?: boolean; +>isVisible : boolean + + localModuleName?: string; +>localModuleName : string + + assignmentChecks?: Map; +>assignmentChecks : Map +>Map : Map + + hasReportedStatementInAmbientContext?: boolean; +>hasReportedStatementInAmbientContext : boolean + + importOnRightSide?: Symbol; +>importOnRightSide : Symbol +>Symbol : Symbol + } + const enum TypeFlags { +>TypeFlags : TypeFlags + + Any = 1, +>Any : TypeFlags + + String = 2, +>String : TypeFlags + + Number = 4, +>Number : TypeFlags + + Boolean = 8, +>Boolean : TypeFlags + + Void = 16, +>Void : TypeFlags + + Undefined = 32, +>Undefined : TypeFlags + + Null = 64, +>Null : TypeFlags + + Enum = 128, +>Enum : TypeFlags + + StringLiteral = 256, +>StringLiteral : TypeFlags + + TypeParameter = 512, +>TypeParameter : TypeFlags + + Class = 1024, +>Class : TypeFlags + + Interface = 2048, +>Interface : TypeFlags + + Reference = 4096, +>Reference : TypeFlags + + Tuple = 8192, +>Tuple : TypeFlags + + Union = 16384, +>Union : TypeFlags + + Anonymous = 32768, +>Anonymous : TypeFlags + + FromSignature = 65536, +>FromSignature : TypeFlags + + ObjectLiteral = 131072, +>ObjectLiteral : TypeFlags + + ContainsUndefinedOrNull = 262144, +>ContainsUndefinedOrNull : TypeFlags + + ContainsObjectLiteral = 524288, +>ContainsObjectLiteral : TypeFlags + + Intrinsic = 127, +>Intrinsic : TypeFlags + + Primitive = 510, +>Primitive : TypeFlags + + StringLike = 258, +>StringLike : TypeFlags + + NumberLike = 132, +>NumberLike : TypeFlags + + ObjectType = 48128, +>ObjectType : TypeFlags + + RequiresWidening = 786432, +>RequiresWidening : TypeFlags + } + interface Type { +>Type : Type + + flags: TypeFlags; +>flags : TypeFlags +>TypeFlags : TypeFlags + + id: number; +>id : number + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + } + interface IntrinsicType extends Type { +>IntrinsicType : IntrinsicType +>Type : Type + + intrinsicName: string; +>intrinsicName : string + } + interface StringLiteralType extends Type { +>StringLiteralType : StringLiteralType +>Type : Type + + text: string; +>text : string + } + interface ObjectType extends Type { +>ObjectType : ObjectType +>Type : Type + } + interface InterfaceType extends ObjectType { +>InterfaceType : InterfaceType +>ObjectType : ObjectType + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + baseTypes: ObjectType[]; +>baseTypes : ObjectType[] +>ObjectType : ObjectType + + declaredProperties: Symbol[]; +>declaredProperties : Symbol[] +>Symbol : Symbol + + declaredCallSignatures: Signature[]; +>declaredCallSignatures : Signature[] +>Signature : Signature + + declaredConstructSignatures: Signature[]; +>declaredConstructSignatures : Signature[] +>Signature : Signature + + declaredStringIndexType: Type; +>declaredStringIndexType : Type +>Type : Type + + declaredNumberIndexType: Type; +>declaredNumberIndexType : Type +>Type : Type + } + interface TypeReference extends ObjectType { +>TypeReference : TypeReference +>ObjectType : ObjectType + + target: GenericType; +>target : GenericType +>GenericType : GenericType + + typeArguments: Type[]; +>typeArguments : Type[] +>Type : Type + } + interface GenericType extends InterfaceType, TypeReference { +>GenericType : GenericType +>InterfaceType : InterfaceType +>TypeReference : TypeReference + + instantiations: Map; +>instantiations : Map +>Map : Map +>TypeReference : TypeReference + } + interface TupleType extends ObjectType { +>TupleType : TupleType +>ObjectType : ObjectType + + elementTypes: Type[]; +>elementTypes : Type[] +>Type : Type + + baseArrayType: TypeReference; +>baseArrayType : TypeReference +>TypeReference : TypeReference + } + interface UnionType extends Type { +>UnionType : UnionType +>Type : Type + + types: Type[]; +>types : Type[] +>Type : Type + + resolvedProperties: SymbolTable; +>resolvedProperties : SymbolTable +>SymbolTable : SymbolTable + } + interface ResolvedType extends ObjectType, UnionType { +>ResolvedType : ResolvedType +>ObjectType : ObjectType +>UnionType : UnionType + + members: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + properties: Symbol[]; +>properties : Symbol[] +>Symbol : Symbol + + callSignatures: Signature[]; +>callSignatures : Signature[] +>Signature : Signature + + constructSignatures: Signature[]; +>constructSignatures : Signature[] +>Signature : Signature + + stringIndexType: Type; +>stringIndexType : Type +>Type : Type + + numberIndexType: Type; +>numberIndexType : Type +>Type : Type + } + interface TypeParameter extends Type { +>TypeParameter : TypeParameter +>Type : Type + + constraint: Type; +>constraint : Type +>Type : Type + + target?: TypeParameter; +>target : TypeParameter +>TypeParameter : TypeParameter + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + } + const enum SignatureKind { +>SignatureKind : SignatureKind + + Call = 0, +>Call : SignatureKind + + Construct = 1, +>Construct : SignatureKind + } + interface Signature { +>Signature : Signature + + declaration: SignatureDeclaration; +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + parameters: Symbol[]; +>parameters : Symbol[] +>Symbol : Symbol + + resolvedReturnType: Type; +>resolvedReturnType : Type +>Type : Type + + minArgumentCount: number; +>minArgumentCount : number + + hasRestParameter: boolean; +>hasRestParameter : boolean + + hasStringLiterals: boolean; +>hasStringLiterals : boolean + + target?: Signature; +>target : Signature +>Signature : Signature + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + unionSignatures?: Signature[]; +>unionSignatures : Signature[] +>Signature : Signature + + erasedSignatureCache?: Signature; +>erasedSignatureCache : Signature +>Signature : Signature + + isolatedSignatureType?: ObjectType; +>isolatedSignatureType : ObjectType +>ObjectType : ObjectType + } + const enum IndexKind { +>IndexKind : IndexKind + + String = 0, +>String : IndexKind + + Number = 1, +>Number : IndexKind + } + interface TypeMapper { +>TypeMapper : TypeMapper + + (t: Type): Type; +>t : Type +>Type : Type +>Type : Type + } + interface TypeInferences { +>TypeInferences : TypeInferences + + primary: Type[]; +>primary : Type[] +>Type : Type + + secondary: Type[]; +>secondary : Type[] +>Type : Type + } + interface InferenceContext { +>InferenceContext : InferenceContext + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + inferUnionTypes: boolean; +>inferUnionTypes : boolean + + inferences: TypeInferences[]; +>inferences : TypeInferences[] +>TypeInferences : TypeInferences + + inferredTypes: Type[]; +>inferredTypes : Type[] +>Type : Type + + failedTypeParameterIndex?: number; +>failedTypeParameterIndex : number + } + interface DiagnosticMessage { +>DiagnosticMessage : DiagnosticMessage + + key: string; +>key : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + interface DiagnosticMessageChain { +>DiagnosticMessageChain : DiagnosticMessageChain + + messageText: string; +>messageText : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + + next?: DiagnosticMessageChain; +>next : DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + } + interface Diagnostic { +>Diagnostic : Diagnostic + + file: SourceFile; +>file : SourceFile +>SourceFile : SourceFile + + start: number; +>start : number + + length: number; +>length : number + + messageText: string | DiagnosticMessageChain; +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = 0, +>Warning : DiagnosticCategory + + Error = 1, +>Error : DiagnosticCategory + + Message = 2, +>Message : DiagnosticCategory + } + interface CompilerOptions { +>CompilerOptions : CompilerOptions + + allowNonTsExtensions?: boolean; +>allowNonTsExtensions : boolean + + charset?: string; +>charset : string + + codepage?: number; +>codepage : number + + declaration?: boolean; +>declaration : boolean + + diagnostics?: boolean; +>diagnostics : boolean + + emitBOM?: boolean; +>emitBOM : boolean + + help?: boolean; +>help : boolean + + listFiles?: boolean; +>listFiles : boolean + + locale?: string; +>locale : string + + mapRoot?: string; +>mapRoot : string + + module?: ModuleKind; +>module : ModuleKind +>ModuleKind : ModuleKind + + noEmit?: boolean; +>noEmit : boolean + + noEmitOnError?: boolean; +>noEmitOnError : boolean + + noErrorTruncation?: boolean; +>noErrorTruncation : boolean + + noImplicitAny?: boolean; +>noImplicitAny : boolean + + noLib?: boolean; +>noLib : boolean + + noLibCheck?: boolean; +>noLibCheck : boolean + + noResolve?: boolean; +>noResolve : boolean + + out?: string; +>out : string + + outDir?: string; +>outDir : string + + preserveConstEnums?: boolean; +>preserveConstEnums : boolean + + project?: string; +>project : string + + removeComments?: boolean; +>removeComments : boolean + + sourceMap?: boolean; +>sourceMap : boolean + + sourceRoot?: string; +>sourceRoot : string + + suppressImplicitAnyIndexErrors?: boolean; +>suppressImplicitAnyIndexErrors : boolean + + target?: ScriptTarget; +>target : ScriptTarget +>ScriptTarget : ScriptTarget + + version?: boolean; +>version : boolean + + watch?: boolean; +>watch : boolean + + stripInternal?: boolean; +>stripInternal : boolean + + [option: string]: string | number | boolean; +>option : string + } + const enum ModuleKind { +>ModuleKind : ModuleKind + + None = 0, +>None : ModuleKind + + CommonJS = 1, +>CommonJS : ModuleKind + + AMD = 2, +>AMD : ModuleKind + } + interface LineAndCharacter { +>LineAndCharacter : LineAndCharacter + + line: number; +>line : number + + character: number; +>character : number + } + const enum ScriptTarget { +>ScriptTarget : ScriptTarget + + ES3 = 0, +>ES3 : ScriptTarget + + ES5 = 1, +>ES5 : ScriptTarget + + ES6 = 2, +>ES6 : ScriptTarget + + Latest = 2, +>Latest : ScriptTarget + } + interface ParsedCommandLine { +>ParsedCommandLine : ParsedCommandLine + + options: CompilerOptions; +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + fileNames: string[]; +>fileNames : string[] + + errors: Diagnostic[]; +>errors : Diagnostic[] +>Diagnostic : Diagnostic + } + interface CommandLineOption { +>CommandLineOption : CommandLineOption + + name: string; +>name : string + + type: string | Map; +>type : string | Map +>Map : Map + + isFilePath?: boolean; +>isFilePath : boolean + + shortName?: string; +>shortName : string + + description?: DiagnosticMessage; +>description : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + paramType?: DiagnosticMessage; +>paramType : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + error?: DiagnosticMessage; +>error : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + experimental?: boolean; +>experimental : boolean + } + const enum CharacterCodes { +>CharacterCodes : CharacterCodes + + nullCharacter = 0, +>nullCharacter : CharacterCodes + + maxAsciiCharacter = 127, +>maxAsciiCharacter : CharacterCodes + + lineFeed = 10, +>lineFeed : CharacterCodes + + carriageReturn = 13, +>carriageReturn : CharacterCodes + + lineSeparator = 8232, +>lineSeparator : CharacterCodes + + paragraphSeparator = 8233, +>paragraphSeparator : CharacterCodes + + nextLine = 133, +>nextLine : CharacterCodes + + space = 32, +>space : CharacterCodes + + nonBreakingSpace = 160, +>nonBreakingSpace : CharacterCodes + + enQuad = 8192, +>enQuad : CharacterCodes + + emQuad = 8193, +>emQuad : CharacterCodes + + enSpace = 8194, +>enSpace : CharacterCodes + + emSpace = 8195, +>emSpace : CharacterCodes + + threePerEmSpace = 8196, +>threePerEmSpace : CharacterCodes + + fourPerEmSpace = 8197, +>fourPerEmSpace : CharacterCodes + + sixPerEmSpace = 8198, +>sixPerEmSpace : CharacterCodes + + figureSpace = 8199, +>figureSpace : CharacterCodes + + punctuationSpace = 8200, +>punctuationSpace : CharacterCodes + + thinSpace = 8201, +>thinSpace : CharacterCodes + + hairSpace = 8202, +>hairSpace : CharacterCodes + + zeroWidthSpace = 8203, +>zeroWidthSpace : CharacterCodes + + narrowNoBreakSpace = 8239, +>narrowNoBreakSpace : CharacterCodes + + ideographicSpace = 12288, +>ideographicSpace : CharacterCodes + + mathematicalSpace = 8287, +>mathematicalSpace : CharacterCodes + + ogham = 5760, +>ogham : CharacterCodes + + _ = 95, +>_ : CharacterCodes + + $ = 36, +>$ : CharacterCodes + + _0 = 48, +>_0 : CharacterCodes + + _1 = 49, +>_1 : CharacterCodes + + _2 = 50, +>_2 : CharacterCodes + + _3 = 51, +>_3 : CharacterCodes + + _4 = 52, +>_4 : CharacterCodes + + _5 = 53, +>_5 : CharacterCodes + + _6 = 54, +>_6 : CharacterCodes + + _7 = 55, +>_7 : CharacterCodes + + _8 = 56, +>_8 : CharacterCodes + + _9 = 57, +>_9 : CharacterCodes + + a = 97, +>a : CharacterCodes + + b = 98, +>b : CharacterCodes + + c = 99, +>c : CharacterCodes + + d = 100, +>d : CharacterCodes + + e = 101, +>e : CharacterCodes + + f = 102, +>f : CharacterCodes + + g = 103, +>g : CharacterCodes + + h = 104, +>h : CharacterCodes + + i = 105, +>i : CharacterCodes + + j = 106, +>j : CharacterCodes + + k = 107, +>k : CharacterCodes + + l = 108, +>l : CharacterCodes + + m = 109, +>m : CharacterCodes + + n = 110, +>n : CharacterCodes + + o = 111, +>o : CharacterCodes + + p = 112, +>p : CharacterCodes + + q = 113, +>q : CharacterCodes + + r = 114, +>r : CharacterCodes + + s = 115, +>s : CharacterCodes + + t = 116, +>t : CharacterCodes + + u = 117, +>u : CharacterCodes + + v = 118, +>v : CharacterCodes + + w = 119, +>w : CharacterCodes + + x = 120, +>x : CharacterCodes + + y = 121, +>y : CharacterCodes + + z = 122, +>z : CharacterCodes + + A = 65, +>A : CharacterCodes + + B = 66, +>B : CharacterCodes + + C = 67, +>C : CharacterCodes + + D = 68, +>D : CharacterCodes + + E = 69, +>E : CharacterCodes + + F = 70, +>F : CharacterCodes + + G = 71, +>G : CharacterCodes + + H = 72, +>H : CharacterCodes + + I = 73, +>I : CharacterCodes + + J = 74, +>J : CharacterCodes + + K = 75, +>K : CharacterCodes + + L = 76, +>L : CharacterCodes + + M = 77, +>M : CharacterCodes + + N = 78, +>N : CharacterCodes + + O = 79, +>O : CharacterCodes + + P = 80, +>P : CharacterCodes + + Q = 81, +>Q : CharacterCodes + + R = 82, +>R : CharacterCodes + + S = 83, +>S : CharacterCodes + + T = 84, +>T : CharacterCodes + + U = 85, +>U : CharacterCodes + + V = 86, +>V : CharacterCodes + + W = 87, +>W : CharacterCodes + + X = 88, +>X : CharacterCodes + + Y = 89, +>Y : CharacterCodes + + Z = 90, +>Z : CharacterCodes + + ampersand = 38, +>ampersand : CharacterCodes + + asterisk = 42, +>asterisk : CharacterCodes + + at = 64, +>at : CharacterCodes + + backslash = 92, +>backslash : CharacterCodes + + backtick = 96, +>backtick : CharacterCodes + + bar = 124, +>bar : CharacterCodes + + caret = 94, +>caret : CharacterCodes + + closeBrace = 125, +>closeBrace : CharacterCodes + + closeBracket = 93, +>closeBracket : CharacterCodes + + closeParen = 41, +>closeParen : CharacterCodes + + colon = 58, +>colon : CharacterCodes + + comma = 44, +>comma : CharacterCodes + + dot = 46, +>dot : CharacterCodes + + doubleQuote = 34, +>doubleQuote : CharacterCodes + + equals = 61, +>equals : CharacterCodes + + exclamation = 33, +>exclamation : CharacterCodes + + greaterThan = 62, +>greaterThan : CharacterCodes + + lessThan = 60, +>lessThan : CharacterCodes + + minus = 45, +>minus : CharacterCodes + + openBrace = 123, +>openBrace : CharacterCodes + + openBracket = 91, +>openBracket : CharacterCodes + + openParen = 40, +>openParen : CharacterCodes + + percent = 37, +>percent : CharacterCodes + + plus = 43, +>plus : CharacterCodes + + question = 63, +>question : CharacterCodes + + semicolon = 59, +>semicolon : CharacterCodes + + singleQuote = 39, +>singleQuote : CharacterCodes + + slash = 47, +>slash : CharacterCodes + + tilde = 126, +>tilde : CharacterCodes + + backspace = 8, +>backspace : CharacterCodes + + formFeed = 12, +>formFeed : CharacterCodes + + byteOrderMark = 65279, +>byteOrderMark : CharacterCodes + + tab = 9, +>tab : CharacterCodes + + verticalTab = 11, +>verticalTab : CharacterCodes + } + interface CancellationToken { +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + } + interface CompilerHost { +>CompilerHost : CompilerHost + + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>onError : (message: string) => void +>message : string +>SourceFile : SourceFile + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + writeFile: WriteFileCallback; +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getCanonicalFileName(fileName: string): string; +>getCanonicalFileName : (fileName: string) => string +>fileName : string + + useCaseSensitiveFileNames(): boolean; +>useCaseSensitiveFileNames : () => boolean + + getNewLine(): string; +>getNewLine : () => string + } + interface TextSpan { +>TextSpan : TextSpan + + start: number; +>start : number + + length: number; +>length : number + } + interface TextChangeRange { +>TextChangeRange : TextChangeRange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newLength: number; +>newLength : number + } +} +declare module "typescript" { + interface ErrorCallback { +>ErrorCallback : ErrorCallback + + (message: DiagnosticMessage, length: number): void; +>message : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage +>length : number + } + interface Scanner { +>Scanner : Scanner + + getStartPos(): number; +>getStartPos : () => number + + getToken(): SyntaxKind; +>getToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + getTextPos(): number; +>getTextPos : () => number + + getTokenPos(): number; +>getTokenPos : () => number + + getTokenText(): string; +>getTokenText : () => string + + getTokenValue(): string; +>getTokenValue : () => string + + hasPrecedingLineBreak(): boolean; +>hasPrecedingLineBreak : () => boolean + + isIdentifier(): boolean; +>isIdentifier : () => boolean + + isReservedWord(): boolean; +>isReservedWord : () => boolean + + isUnterminated(): boolean; +>isUnterminated : () => boolean + + reScanGreaterToken(): SyntaxKind; +>reScanGreaterToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanSlashToken(): SyntaxKind; +>reScanSlashToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanTemplateToken(): SyntaxKind; +>reScanTemplateToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + scan(): SyntaxKind; +>scan : () => SyntaxKind +>SyntaxKind : SyntaxKind + + setText(text: string): void; +>setText : (text: string) => void +>text : string + + setTextPos(textPos: number): void; +>setTextPos : (textPos: number) => void +>textPos : number + + lookAhead(callback: () => T): T; +>lookAhead : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + + tryScan(callback: () => T): T; +>tryScan : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + } + function tokenToString(t: SyntaxKind): string; +>tokenToString : (t: SyntaxKind) => string +>t : SyntaxKind +>SyntaxKind : SyntaxKind + + function computeLineStarts(text: string): number[]; +>computeLineStarts : (text: string) => number[] +>text : string + + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number +>sourceFile : SourceFile +>SourceFile : SourceFile +>line : number +>character : number + + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number +>lineStarts : number[] +>line : number +>character : number + + function getLineStarts(sourceFile: SourceFile): number[]; +>getLineStarts : (sourceFile: SourceFile) => number[] +>sourceFile : SourceFile +>SourceFile : SourceFile + + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } +>lineStarts : number[] +>position : number + + line: number; +>line : number + + character: number; +>character : number + + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter +>sourceFile : SourceFile +>SourceFile : SourceFile +>position : number +>LineAndCharacter : LineAndCharacter + + function isWhiteSpace(ch: number): boolean; +>isWhiteSpace : (ch: number) => boolean +>ch : number + + function isLineBreak(ch: number): boolean; +>isLineBreak : (ch: number) => boolean +>ch : number + + function isOctalDigit(ch: number): boolean; +>isOctalDigit : (ch: number) => boolean +>ch : number + + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; +>skipTrivia : (text: string, pos: number, stopAfterLineBreak?: boolean) => number +>text : string +>pos : number +>stopAfterLineBreak : boolean + + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; +>getLeadingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; +>getTrailingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierStart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierPart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +>createScanner : (languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback) => Scanner +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>skipTrivia : boolean +>text : string +>onError : ErrorCallback +>ErrorCallback : ErrorCallback +>Scanner : Scanner +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; +>getNodeConstructor : (kind: SyntaxKind) => new () => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function createNode(kind: SyntaxKind): Node; +>createNode : (kind: SyntaxKind) => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; +>forEachChild : (node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T) => T +>T : T +>node : Node +>Node : Node +>cbNode : (node: Node) => T +>node : Node +>Node : Node +>T : T +>cbNodeArray : (nodes: Node[]) => T +>nodes : Node[] +>Node : Node +>T : T +>T : T + + function modifierToFlag(token: SyntaxKind): NodeFlags; +>modifierToFlag : (token: SyntaxKind) => NodeFlags +>token : SyntaxKind +>SyntaxKind : SyntaxKind +>NodeFlags : NodeFlags + + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; +>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function isEvalOrArgumentsIdentifier(node: Node): boolean; +>isEvalOrArgumentsIdentifier : (node: Node) => boolean +>node : Node +>Node : Node + + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string +>sourceText : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>setParentNodes : boolean +>SourceFile : SourceFile + + function isLeftHandSideExpression(expr: Expression): boolean; +>isLeftHandSideExpression : (expr: Expression) => boolean +>expr : Expression +>Expression : Expression + + function isAssignmentOperator(token: SyntaxKind): boolean; +>isAssignmentOperator : (token: SyntaxKind) => boolean +>token : SyntaxKind +>SyntaxKind : SyntaxKind +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +>createTypeChecker : (host: TypeCheckerHost, produceDiagnostics: boolean) => TypeChecker +>host : TypeCheckerHost +>TypeCheckerHost : TypeCheckerHost +>produceDiagnostics : boolean +>TypeChecker : TypeChecker +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; +>createCompilerHost : (options: CompilerOptions) => CompilerHost +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>CompilerHost : CompilerHost + + function getPreEmitDiagnostics(program: Program): Diagnostic[]; +>getPreEmitDiagnostics : (program: Program) => Diagnostic[] +>program : Program +>Program : Program +>Diagnostic : Diagnostic + + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; +>flattenDiagnosticMessageText : (messageText: string | DiagnosticMessageChain, newLine: string) => string +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain +>newLine : string + + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +>createProgram : (rootNames: string[], options: CompilerOptions, host?: CompilerHost) => Program +>rootNames : string[] +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>host : CompilerHost +>CompilerHost : CompilerHost +>Program : Program +} +declare module "typescript" { + var servicesVersion: string; +>servicesVersion : string + + interface Node { +>Node : Node + + getSourceFile(): SourceFile; +>getSourceFile : () => SourceFile +>SourceFile : SourceFile + + getChildCount(sourceFile?: SourceFile): number; +>getChildCount : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getChildAt(index: number, sourceFile?: SourceFile): Node; +>getChildAt : (index: number, sourceFile?: SourceFile) => Node +>index : number +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getChildren(sourceFile?: SourceFile): Node[]; +>getChildren : (sourceFile?: SourceFile) => Node[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getStart(sourceFile?: SourceFile): number; +>getStart : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullStart(): number; +>getFullStart : () => number + + getEnd(): number; +>getEnd : () => number + + getWidth(sourceFile?: SourceFile): number; +>getWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullWidth(): number; +>getFullWidth : () => number + + getLeadingTriviaWidth(sourceFile?: SourceFile): number; +>getLeadingTriviaWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullText(sourceFile?: SourceFile): string; +>getFullText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getText(sourceFile?: SourceFile): string; +>getText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFirstToken(sourceFile?: SourceFile): Node; +>getFirstToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getLastToken(sourceFile?: SourceFile): Node; +>getLastToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + } + interface Symbol { +>Symbol : Symbol + + getFlags(): SymbolFlags; +>getFlags : () => SymbolFlags +>SymbolFlags : SymbolFlags + + getName(): string; +>getName : () => string + + getDeclarations(): Declaration[]; +>getDeclarations : () => Declaration[] +>Declaration : Declaration + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface Type { +>Type : Type + + getFlags(): TypeFlags; +>getFlags : () => TypeFlags +>TypeFlags : TypeFlags + + getSymbol(): Symbol; +>getSymbol : () => Symbol +>Symbol : Symbol + + getProperties(): Symbol[]; +>getProperties : () => Symbol[] +>Symbol : Symbol + + getProperty(propertyName: string): Symbol; +>getProperty : (propertyName: string) => Symbol +>propertyName : string +>Symbol : Symbol + + getApparentProperties(): Symbol[]; +>getApparentProperties : () => Symbol[] +>Symbol : Symbol + + getCallSignatures(): Signature[]; +>getCallSignatures : () => Signature[] +>Signature : Signature + + getConstructSignatures(): Signature[]; +>getConstructSignatures : () => Signature[] +>Signature : Signature + + getStringIndexType(): Type; +>getStringIndexType : () => Type +>Type : Type + + getNumberIndexType(): Type; +>getNumberIndexType : () => Type +>Type : Type + } + interface Signature { +>Signature : Signature + + getDeclaration(): SignatureDeclaration; +>getDeclaration : () => SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + getTypeParameters(): Type[]; +>getTypeParameters : () => Type[] +>Type : Type + + getParameters(): Symbol[]; +>getParameters : () => Symbol[] +>Symbol : Symbol + + getReturnType(): Type; +>getReturnType : () => Type +>Type : Type + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface SourceFile { +>SourceFile : SourceFile + + version: string; +>version : string + + scriptSnapshot: IScriptSnapshot; +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot + + nameTable: Map; +>nameTable : Map +>Map : Map + + getNamedDeclarations(): Declaration[]; +>getNamedDeclarations : () => Declaration[] +>Declaration : Declaration + + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; +>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter +>pos : number +>LineAndCharacter : LineAndCharacter + + getLineStarts(): number[]; +>getLineStarts : () => number[] + + getPositionFromLineAndCharacter(line: number, character: number): number; +>getPositionFromLineAndCharacter : (line: number, character: number) => number +>line : number +>character : number + + update(newText: string, textChangeRange: TextChangeRange): SourceFile; +>update : (newText: string, textChangeRange: TextChangeRange) => SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { +>IScriptSnapshot : IScriptSnapshot + + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; +>getText : (start: number, end: number) => string +>start : number +>end : number + + /** Gets the length of this script snapshot. */ + getLength(): number; +>getLength : () => number + + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; +>getChangeRange : (oldSnapshot: IScriptSnapshot) => TextChangeRange +>oldSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>TextChangeRange : TextChangeRange + } + module ScriptSnapshot { +>ScriptSnapshot : typeof ScriptSnapshot + + function fromString(text: string): IScriptSnapshot; +>fromString : (text: string) => IScriptSnapshot +>text : string +>IScriptSnapshot : IScriptSnapshot + } + interface PreProcessedFileInfo { +>PreProcessedFileInfo : PreProcessedFileInfo + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + importedFiles: FileReference[]; +>importedFiles : FileReference[] +>FileReference : FileReference + + isLibFile: boolean; +>isLibFile : boolean + } + interface LanguageServiceHost { +>LanguageServiceHost : LanguageServiceHost + + getCompilationSettings(): CompilerOptions; +>getCompilationSettings : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getNewLine?(): string; +>getNewLine : () => string + + getScriptFileNames(): string[]; +>getScriptFileNames : () => string[] + + getScriptVersion(fileName: string): string; +>getScriptVersion : (fileName: string) => string +>fileName : string + + getScriptSnapshot(fileName: string): IScriptSnapshot; +>getScriptSnapshot : (fileName: string) => IScriptSnapshot +>fileName : string +>IScriptSnapshot : IScriptSnapshot + + getLocalizedDiagnosticMessages?(): any; +>getLocalizedDiagnosticMessages : () => any + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + log?(s: string): void; +>log : (s: string) => void +>s : string + + trace?(s: string): void; +>trace : (s: string) => void +>s : string + + error?(s: string): void; +>error : (s: string) => void +>s : string + } + interface LanguageService { +>LanguageService : LanguageService + + cleanupSemanticCache(): void; +>cleanupSemanticCache : () => void + + getSyntacticDiagnostics(fileName: string): Diagnostic[]; +>getSyntacticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getSemanticDiagnostics(fileName: string): Diagnostic[]; +>getSemanticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getCompilerOptionsDiagnostics(): Diagnostic[]; +>getCompilerOptionsDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSyntacticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSemanticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; +>getCompletionsAtPosition : (fileName: string, position: number) => CompletionInfo +>fileName : string +>position : number +>CompletionInfo : CompletionInfo + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; +>getCompletionEntryDetails : (fileName: string, position: number, entryName: string) => CompletionEntryDetails +>fileName : string +>position : number +>entryName : string +>CompletionEntryDetails : CompletionEntryDetails + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; +>getQuickInfoAtPosition : (fileName: string, position: number) => QuickInfo +>fileName : string +>position : number +>QuickInfo : QuickInfo + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; +>getNameOrDottedNameSpan : (fileName: string, startPos: number, endPos: number) => TextSpan +>fileName : string +>startPos : number +>endPos : number +>TextSpan : TextSpan + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; +>getBreakpointStatementAtPosition : (fileName: string, position: number) => TextSpan +>fileName : string +>position : number +>TextSpan : TextSpan + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; +>getSignatureHelpItems : (fileName: string, position: number) => SignatureHelpItems +>fileName : string +>position : number +>SignatureHelpItems : SignatureHelpItems + + getRenameInfo(fileName: string, position: number): RenameInfo; +>getRenameInfo : (fileName: string, position: number) => RenameInfo +>fileName : string +>position : number +>RenameInfo : RenameInfo + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; +>findRenameLocations : (fileName: string, position: number, findInStrings: boolean, findInComments: boolean) => RenameLocation[] +>fileName : string +>position : number +>findInStrings : boolean +>findInComments : boolean +>RenameLocation : RenameLocation + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; +>getDefinitionAtPosition : (fileName: string, position: number) => DefinitionInfo[] +>fileName : string +>position : number +>DefinitionInfo : DefinitionInfo + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getReferencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getOccurrencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getNavigateToItems(searchValue: string): NavigateToItem[]; +>getNavigateToItems : (searchValue: string) => NavigateToItem[] +>searchValue : string +>NavigateToItem : NavigateToItem + + getNavigationBarItems(fileName: string): NavigationBarItem[]; +>getNavigationBarItems : (fileName: string) => NavigationBarItem[] +>fileName : string +>NavigationBarItem : NavigationBarItem + + getOutliningSpans(fileName: string): OutliningSpan[]; +>getOutliningSpans : (fileName: string) => OutliningSpan[] +>fileName : string +>OutliningSpan : OutliningSpan + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; +>getTodoComments : (fileName: string, descriptors: TodoCommentDescriptor[]) => TodoComment[] +>fileName : string +>descriptors : TodoCommentDescriptor[] +>TodoCommentDescriptor : TodoCommentDescriptor +>TodoComment : TodoComment + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; +>getBraceMatchingAtPosition : (fileName: string, position: number) => TextSpan[] +>fileName : string +>position : number +>TextSpan : TextSpan + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; +>getIndentationAtPosition : (fileName: string, position: number, options: EditorOptions) => number +>fileName : string +>position : number +>options : EditorOptions +>EditorOptions : EditorOptions + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForRange : (fileName: string, start: number, end: number, options: FormatCodeOptions) => TextChange[] +>fileName : string +>start : number +>end : number +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForDocument : (fileName: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsAfterKeystroke : (fileName: string, position: number, key: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>position : number +>key : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getEmitOutput(fileName: string): EmitOutput; +>getEmitOutput : (fileName: string) => EmitOutput +>fileName : string +>EmitOutput : EmitOutput + + getProgram(): Program; +>getProgram : () => Program +>Program : Program + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + dispose(): void; +>dispose : () => void + } + interface ClassifiedSpan { +>ClassifiedSpan : ClassifiedSpan + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + classificationType: string; +>classificationType : string + } + interface NavigationBarItem { +>NavigationBarItem : NavigationBarItem + + text: string; +>text : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + spans: TextSpan[]; +>spans : TextSpan[] +>TextSpan : TextSpan + + childItems: NavigationBarItem[]; +>childItems : NavigationBarItem[] +>NavigationBarItem : NavigationBarItem + + indent: number; +>indent : number + + bolded: boolean; +>bolded : boolean + + grayed: boolean; +>grayed : boolean + } + interface TodoCommentDescriptor { +>TodoCommentDescriptor : TodoCommentDescriptor + + text: string; +>text : string + + priority: number; +>priority : number + } + interface TodoComment { +>TodoComment : TodoComment + + descriptor: TodoCommentDescriptor; +>descriptor : TodoCommentDescriptor +>TodoCommentDescriptor : TodoCommentDescriptor + + message: string; +>message : string + + position: number; +>position : number + } + class TextChange { +>TextChange : TextChange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newText: string; +>newText : string + } + interface RenameLocation { +>RenameLocation : RenameLocation + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + } + interface ReferenceEntry { +>ReferenceEntry : ReferenceEntry + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + + isWriteAccess: boolean; +>isWriteAccess : boolean + } + interface NavigateToItem { +>NavigateToItem : NavigateToItem + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + matchKind: string; +>matchKind : string + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + containerName: string; +>containerName : string + + containerKind: string; +>containerKind : string + } + interface EditorOptions { +>EditorOptions : EditorOptions + + IndentSize: number; +>IndentSize : number + + TabSize: number; +>TabSize : number + + NewLineCharacter: string; +>NewLineCharacter : string + + ConvertTabsToSpaces: boolean; +>ConvertTabsToSpaces : boolean + } + interface FormatCodeOptions extends EditorOptions { +>FormatCodeOptions : FormatCodeOptions +>EditorOptions : EditorOptions + + InsertSpaceAfterCommaDelimiter: boolean; +>InsertSpaceAfterCommaDelimiter : boolean + + InsertSpaceAfterSemicolonInForStatements: boolean; +>InsertSpaceAfterSemicolonInForStatements : boolean + + InsertSpaceBeforeAndAfterBinaryOperators: boolean; +>InsertSpaceBeforeAndAfterBinaryOperators : boolean + + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; +>InsertSpaceAfterKeywordsInControlFlowStatements : boolean + + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; +>InsertSpaceAfterFunctionKeywordForAnonymousFunctions : boolean + + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; +>InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis : boolean + + PlaceOpenBraceOnNewLineForFunctions: boolean; +>PlaceOpenBraceOnNewLineForFunctions : boolean + + PlaceOpenBraceOnNewLineForControlBlocks: boolean; +>PlaceOpenBraceOnNewLineForControlBlocks : boolean + } + interface DefinitionInfo { +>DefinitionInfo : DefinitionInfo + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + kind: string; +>kind : string + + name: string; +>name : string + + containerKind: string; +>containerKind : string + + containerName: string; +>containerName : string + } + enum SymbolDisplayPartKind { +>SymbolDisplayPartKind : SymbolDisplayPartKind + + aliasName = 0, +>aliasName : SymbolDisplayPartKind + + className = 1, +>className : SymbolDisplayPartKind + + enumName = 2, +>enumName : SymbolDisplayPartKind + + fieldName = 3, +>fieldName : SymbolDisplayPartKind + + interfaceName = 4, +>interfaceName : SymbolDisplayPartKind + + keyword = 5, +>keyword : SymbolDisplayPartKind + + lineBreak = 6, +>lineBreak : SymbolDisplayPartKind + + numericLiteral = 7, +>numericLiteral : SymbolDisplayPartKind + + stringLiteral = 8, +>stringLiteral : SymbolDisplayPartKind + + localName = 9, +>localName : SymbolDisplayPartKind + + methodName = 10, +>methodName : SymbolDisplayPartKind + + moduleName = 11, +>moduleName : SymbolDisplayPartKind + + operator = 12, +>operator : SymbolDisplayPartKind + + parameterName = 13, +>parameterName : SymbolDisplayPartKind + + propertyName = 14, +>propertyName : SymbolDisplayPartKind + + punctuation = 15, +>punctuation : SymbolDisplayPartKind + + space = 16, +>space : SymbolDisplayPartKind + + text = 17, +>text : SymbolDisplayPartKind + + typeParameterName = 18, +>typeParameterName : SymbolDisplayPartKind + + enumMemberName = 19, +>enumMemberName : SymbolDisplayPartKind + + functionName = 20, +>functionName : SymbolDisplayPartKind + + regularExpressionLiteral = 21, +>regularExpressionLiteral : SymbolDisplayPartKind + } + interface SymbolDisplayPart { +>SymbolDisplayPart : SymbolDisplayPart + + text: string; +>text : string + + kind: string; +>kind : string + } + interface QuickInfo { +>QuickInfo : QuickInfo + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface RenameInfo { +>RenameInfo : RenameInfo + + canRename: boolean; +>canRename : boolean + + localizedErrorMessage: string; +>localizedErrorMessage : string + + displayName: string; +>displayName : string + + fullDisplayName: string; +>fullDisplayName : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + triggerSpan: TextSpan; +>triggerSpan : TextSpan +>TextSpan : TextSpan + } + interface SignatureHelpParameter { +>SignatureHelpParameter : SignatureHelpParameter + + name: string; +>name : string + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + isOptional: boolean; +>isOptional : boolean + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { +>SignatureHelpItem : SignatureHelpItem + + isVariadic: boolean; +>isVariadic : boolean + + prefixDisplayParts: SymbolDisplayPart[]; +>prefixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + suffixDisplayParts: SymbolDisplayPart[]; +>suffixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + separatorDisplayParts: SymbolDisplayPart[]; +>separatorDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + parameters: SignatureHelpParameter[]; +>parameters : SignatureHelpParameter[] +>SignatureHelpParameter : SignatureHelpParameter + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { +>SignatureHelpItems : SignatureHelpItems + + items: SignatureHelpItem[]; +>items : SignatureHelpItem[] +>SignatureHelpItem : SignatureHelpItem + + applicableSpan: TextSpan; +>applicableSpan : TextSpan +>TextSpan : TextSpan + + selectedItemIndex: number; +>selectedItemIndex : number + + argumentIndex: number; +>argumentIndex : number + + argumentCount: number; +>argumentCount : number + } + interface CompletionInfo { +>CompletionInfo : CompletionInfo + + isMemberCompletion: boolean; +>isMemberCompletion : boolean + + isNewIdentifierLocation: boolean; +>isNewIdentifierLocation : boolean + + entries: CompletionEntry[]; +>entries : CompletionEntry[] +>CompletionEntry : CompletionEntry + } + interface CompletionEntry { +>CompletionEntry : CompletionEntry + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + } + interface CompletionEntryDetails { +>CompletionEntryDetails : CompletionEntryDetails + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface OutliningSpan { +>OutliningSpan : OutliningSpan + + /** The span of the document to actually collapse. */ + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; +>hintSpan : TextSpan +>TextSpan : TextSpan + + /** The text to display in the editor for the collapsed region. */ + bannerText: string; +>bannerText : string + + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; +>autoCollapse : boolean + } + interface EmitOutput { +>EmitOutput : EmitOutput + + outputFiles: OutputFile[]; +>outputFiles : OutputFile[] +>OutputFile : OutputFile + + emitSkipped: boolean; +>emitSkipped : boolean + } + const enum OutputFileType { +>OutputFileType : OutputFileType + + JavaScript = 0, +>JavaScript : OutputFileType + + SourceMap = 1, +>SourceMap : OutputFileType + + Declaration = 2, +>Declaration : OutputFileType + } + interface OutputFile { +>OutputFile : OutputFile + + name: string; +>name : string + + writeByteOrderMark: boolean; +>writeByteOrderMark : boolean + + text: string; +>text : string + } + const enum EndOfLineState { +>EndOfLineState : EndOfLineState + + Start = 0, +>Start : EndOfLineState + + InMultiLineCommentTrivia = 1, +>InMultiLineCommentTrivia : EndOfLineState + + InSingleQuoteStringLiteral = 2, +>InSingleQuoteStringLiteral : EndOfLineState + + InDoubleQuoteStringLiteral = 3, +>InDoubleQuoteStringLiteral : EndOfLineState + } + enum TokenClass { +>TokenClass : TokenClass + + Punctuation = 0, +>Punctuation : TokenClass + + Keyword = 1, +>Keyword : TokenClass + + Operator = 2, +>Operator : TokenClass + + Comment = 3, +>Comment : TokenClass + + Whitespace = 4, +>Whitespace : TokenClass + + Identifier = 5, +>Identifier : TokenClass + + NumberLiteral = 6, +>NumberLiteral : TokenClass + + StringLiteral = 7, +>StringLiteral : TokenClass + + RegExpLiteral = 8, +>RegExpLiteral : TokenClass + } + interface ClassificationResult { +>ClassificationResult : ClassificationResult + + finalLexState: EndOfLineState; +>finalLexState : EndOfLineState +>EndOfLineState : EndOfLineState + + entries: ClassificationInfo[]; +>entries : ClassificationInfo[] +>ClassificationInfo : ClassificationInfo + } + interface ClassificationInfo { +>ClassificationInfo : ClassificationInfo + + length: number; +>length : number + + classification: TokenClass; +>classification : TokenClass +>TokenClass : TokenClass + } + interface Classifier { +>Classifier : Classifier + + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult +>text : string +>lexState : EndOfLineState +>EndOfLineState : EndOfLineState +>classifyKeywordsInGenerics : boolean +>ClassificationResult : ClassificationResult + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { +>DocumentRegistry : DocumentRegistry + + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions + } + class ScriptElementKind { +>ScriptElementKind : ScriptElementKind + + static unknown: string; +>unknown : string + + static keyword: string; +>keyword : string + + static scriptElement: string; +>scriptElement : string + + static moduleElement: string; +>moduleElement : string + + static classElement: string; +>classElement : string + + static interfaceElement: string; +>interfaceElement : string + + static typeElement: string; +>typeElement : string + + static enumElement: string; +>enumElement : string + + static variableElement: string; +>variableElement : string + + static localVariableElement: string; +>localVariableElement : string + + static functionElement: string; +>functionElement : string + + static localFunctionElement: string; +>localFunctionElement : string + + static memberFunctionElement: string; +>memberFunctionElement : string + + static memberGetAccessorElement: string; +>memberGetAccessorElement : string + + static memberSetAccessorElement: string; +>memberSetAccessorElement : string + + static memberVariableElement: string; +>memberVariableElement : string + + static constructorImplementationElement: string; +>constructorImplementationElement : string + + static callSignatureElement: string; +>callSignatureElement : string + + static indexSignatureElement: string; +>indexSignatureElement : string + + static constructSignatureElement: string; +>constructSignatureElement : string + + static parameterElement: string; +>parameterElement : string + + static typeParameterElement: string; +>typeParameterElement : string + + static primitiveType: string; +>primitiveType : string + + static label: string; +>label : string + + static alias: string; +>alias : string + + static constElement: string; +>constElement : string + + static letElement: string; +>letElement : string + } + class ScriptElementKindModifier { +>ScriptElementKindModifier : ScriptElementKindModifier + + static none: string; +>none : string + + static publicMemberModifier: string; +>publicMemberModifier : string + + static privateMemberModifier: string; +>privateMemberModifier : string + + static protectedMemberModifier: string; +>protectedMemberModifier : string + + static exportedModifier: string; +>exportedModifier : string + + static ambientModifier: string; +>ambientModifier : string + + static staticModifier: string; +>staticModifier : string + } + class ClassificationTypeNames { +>ClassificationTypeNames : ClassificationTypeNames + + static comment: string; +>comment : string + + static identifier: string; +>identifier : string + + static keyword: string; +>keyword : string + + static numericLiteral: string; +>numericLiteral : string + + static operator: string; +>operator : string + + static stringLiteral: string; +>stringLiteral : string + + static whiteSpace: string; +>whiteSpace : string + + static text: string; +>text : string + + static punctuation: string; +>punctuation : string + + static className: string; +>className : string + + static enumName: string; +>enumName : string + + static interfaceName: string; +>interfaceName : string + + static moduleName: string; +>moduleName : string + + static typeParameterName: string; +>typeParameterName : string + + static typeAlias: string; +>typeAlias : string + } + interface DisplayPartsSymbolWriter extends SymbolWriter { +>DisplayPartsSymbolWriter : DisplayPartsSymbolWriter +>SymbolWriter : SymbolWriter + + displayParts(): SymbolDisplayPart[]; +>displayParts : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; +>displayPartsToString : (displayParts: SymbolDisplayPart[]) => string +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + function getDefaultCompilerOptions(): CompilerOptions; +>getDefaultCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + class OperationCanceledException { +>OperationCanceledException : OperationCanceledException + } + class CancellationTokenObject { +>CancellationTokenObject : CancellationTokenObject + + private cancellationToken; +>cancellationToken : any + + static None: CancellationTokenObject; +>None : CancellationTokenObject +>CancellationTokenObject : CancellationTokenObject + + constructor(cancellationToken: CancellationToken); +>cancellationToken : CancellationToken +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + + throwIfCancellationRequested(): void; +>throwIfCancellationRequested : () => void + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>scriptTarget : ScriptTarget +>ScriptTarget : ScriptTarget +>version : string +>setNodeParents : boolean +>SourceFile : SourceFile + + var disableIncrementalParsing: boolean; +>disableIncrementalParsing : boolean + + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function createDocumentRegistry(): DocumentRegistry; +>createDocumentRegistry : () => DocumentRegistry +>DocumentRegistry : DocumentRegistry + + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; +>preProcessFile : (sourceText: string, readImportFiles?: boolean) => PreProcessedFileInfo +>sourceText : string +>readImportFiles : boolean +>PreProcessedFileInfo : PreProcessedFileInfo + + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; +>createLanguageService : (host: LanguageServiceHost, documentRegistry?: DocumentRegistry) => LanguageService +>host : LanguageServiceHost +>LanguageServiceHost : LanguageServiceHost +>documentRegistry : DocumentRegistry +>DocumentRegistry : DocumentRegistry +>LanguageService : LanguageService + + function createClassifier(): Classifier; +>createClassifier : () => Classifier +>Classifier : Classifier + + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +>getDefaultLibFilePath : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions +} + diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js new file mode 100644 index 00000000000..ad66d289eb7 --- /dev/null +++ b/tests/baselines/reference/APISample_transform.js @@ -0,0 +1,1991 @@ +//// [tests/cases/compiler/APISample_transform.ts] //// + +//// [APISample_transform.ts] + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +declare var console: any; +declare var fs: any; +declare var path: any; +declare var os: any; + +import ts = require("typescript"); + +function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { + // Sources + var files = { + "file.ts": contents, + "lib.d.ts": fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions)).toString() + }; + + // Generated outputs + var outputs = []; + + // Create a compilerHost object to allow the compiler to read and write files + var compilerHost = { + getSourceFile: (fileName, target) => { + return files[fileName] !== undefined ? + ts.createSourceFile(fileName, files[fileName], target) : undefined; + }, + writeFile: (name, text, writeByteOrderMark) => { + outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); + }, + getDefaultLibFileName: () => "lib.d.ts", + useCaseSensitiveFileNames: () => false, + getCanonicalFileName: (fileName) => fileName, + getCurrentDirectory: () => "", + getNewLine: () => "\n" + }; + + // Create a program from inputs + var program = ts.createProgram(["file.ts"], compilerOptions, compilerHost); + + // Query for early errors + var errors = ts.getPreEmitDiagnostics(program); + var emitResult = program.emit(); + + errors = errors.concat(emitResult.diagnostics); + + return { + outputs: outputs, + errors: errors.map(function (e) { + return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); + }) + }; +} + +// Calling our transform function using a simple TypeScript variable declarations, +// and loading the default library like: +var source = "var x: number = 'string'"; +var result = transform(source); + +console.log(JSON.stringify(result)); +//// [typescript.d.ts] +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { + [index: string]: T; + } + interface TextRange { + pos: number; + end: number; + } + const enum SyntaxKind { + Unknown = 0, + EndOfFileToken = 1, + SingleLineCommentTrivia = 2, + MultiLineCommentTrivia = 3, + NewLineTrivia = 4, + WhitespaceTrivia = 5, + ConflictMarkerTrivia = 6, + NumericLiteral = 7, + StringLiteral = 8, + RegularExpressionLiteral = 9, + NoSubstitutionTemplateLiteral = 10, + TemplateHead = 11, + TemplateMiddle = 12, + TemplateTail = 13, + OpenBraceToken = 14, + CloseBraceToken = 15, + OpenParenToken = 16, + CloseParenToken = 17, + OpenBracketToken = 18, + CloseBracketToken = 19, + DotToken = 20, + DotDotDotToken = 21, + SemicolonToken = 22, + CommaToken = 23, + LessThanToken = 24, + GreaterThanToken = 25, + LessThanEqualsToken = 26, + GreaterThanEqualsToken = 27, + EqualsEqualsToken = 28, + ExclamationEqualsToken = 29, + EqualsEqualsEqualsToken = 30, + ExclamationEqualsEqualsToken = 31, + EqualsGreaterThanToken = 32, + PlusToken = 33, + MinusToken = 34, + AsteriskToken = 35, + SlashToken = 36, + PercentToken = 37, + PlusPlusToken = 38, + MinusMinusToken = 39, + LessThanLessThanToken = 40, + GreaterThanGreaterThanToken = 41, + GreaterThanGreaterThanGreaterThanToken = 42, + AmpersandToken = 43, + BarToken = 44, + CaretToken = 45, + ExclamationToken = 46, + TildeToken = 47, + AmpersandAmpersandToken = 48, + BarBarToken = 49, + QuestionToken = 50, + ColonToken = 51, + EqualsToken = 52, + PlusEqualsToken = 53, + MinusEqualsToken = 54, + AsteriskEqualsToken = 55, + SlashEqualsToken = 56, + PercentEqualsToken = 57, + LessThanLessThanEqualsToken = 58, + GreaterThanGreaterThanEqualsToken = 59, + GreaterThanGreaterThanGreaterThanEqualsToken = 60, + AmpersandEqualsToken = 61, + BarEqualsToken = 62, + CaretEqualsToken = 63, + Identifier = 64, + BreakKeyword = 65, + CaseKeyword = 66, + CatchKeyword = 67, + ClassKeyword = 68, + ConstKeyword = 69, + ContinueKeyword = 70, + DebuggerKeyword = 71, + DefaultKeyword = 72, + DeleteKeyword = 73, + DoKeyword = 74, + ElseKeyword = 75, + EnumKeyword = 76, + ExportKeyword = 77, + ExtendsKeyword = 78, + FalseKeyword = 79, + FinallyKeyword = 80, + ForKeyword = 81, + FunctionKeyword = 82, + IfKeyword = 83, + ImportKeyword = 84, + InKeyword = 85, + InstanceOfKeyword = 86, + NewKeyword = 87, + NullKeyword = 88, + ReturnKeyword = 89, + SuperKeyword = 90, + SwitchKeyword = 91, + ThisKeyword = 92, + ThrowKeyword = 93, + TrueKeyword = 94, + TryKeyword = 95, + TypeOfKeyword = 96, + VarKeyword = 97, + VoidKeyword = 98, + WhileKeyword = 99, + WithKeyword = 100, + ImplementsKeyword = 101, + InterfaceKeyword = 102, + LetKeyword = 103, + PackageKeyword = 104, + PrivateKeyword = 105, + ProtectedKeyword = 106, + PublicKeyword = 107, + StaticKeyword = 108, + YieldKeyword = 109, + AnyKeyword = 110, + BooleanKeyword = 111, + ConstructorKeyword = 112, + DeclareKeyword = 113, + GetKeyword = 114, + ModuleKeyword = 115, + RequireKeyword = 116, + NumberKeyword = 117, + SetKeyword = 118, + StringKeyword = 119, + TypeKeyword = 120, + QualifiedName = 121, + ComputedPropertyName = 122, + TypeParameter = 123, + Parameter = 124, + PropertySignature = 125, + PropertyDeclaration = 126, + MethodSignature = 127, + MethodDeclaration = 128, + Constructor = 129, + GetAccessor = 130, + SetAccessor = 131, + CallSignature = 132, + ConstructSignature = 133, + IndexSignature = 134, + TypeReference = 135, + FunctionType = 136, + ConstructorType = 137, + TypeQuery = 138, + TypeLiteral = 139, + ArrayType = 140, + TupleType = 141, + UnionType = 142, + ParenthesizedType = 143, + ObjectBindingPattern = 144, + ArrayBindingPattern = 145, + BindingElement = 146, + ArrayLiteralExpression = 147, + ObjectLiteralExpression = 148, + PropertyAccessExpression = 149, + ElementAccessExpression = 150, + CallExpression = 151, + NewExpression = 152, + TaggedTemplateExpression = 153, + TypeAssertionExpression = 154, + ParenthesizedExpression = 155, + FunctionExpression = 156, + ArrowFunction = 157, + DeleteExpression = 158, + TypeOfExpression = 159, + VoidExpression = 160, + PrefixUnaryExpression = 161, + PostfixUnaryExpression = 162, + BinaryExpression = 163, + ConditionalExpression = 164, + TemplateExpression = 165, + YieldExpression = 166, + SpreadElementExpression = 167, + OmittedExpression = 168, + TemplateSpan = 169, + Block = 170, + VariableStatement = 171, + EmptyStatement = 172, + ExpressionStatement = 173, + IfStatement = 174, + DoStatement = 175, + WhileStatement = 176, + ForStatement = 177, + ForInStatement = 178, + ContinueStatement = 179, + BreakStatement = 180, + ReturnStatement = 181, + WithStatement = 182, + SwitchStatement = 183, + LabeledStatement = 184, + ThrowStatement = 185, + TryStatement = 186, + DebuggerStatement = 187, + VariableDeclaration = 188, + VariableDeclarationList = 189, + FunctionDeclaration = 190, + ClassDeclaration = 191, + InterfaceDeclaration = 192, + TypeAliasDeclaration = 193, + EnumDeclaration = 194, + ModuleDeclaration = 195, + ModuleBlock = 196, + ImportDeclaration = 197, + ExportAssignment = 198, + ExternalModuleReference = 199, + CaseClause = 200, + DefaultClause = 201, + HeritageClause = 202, + CatchClause = 203, + PropertyAssignment = 204, + ShorthandPropertyAssignment = 205, + EnumMember = 206, + SourceFile = 207, + SyntaxList = 208, + Count = 209, + FirstAssignment = 52, + LastAssignment = 63, + FirstReservedWord = 65, + LastReservedWord = 100, + FirstKeyword = 65, + LastKeyword = 120, + FirstFutureReservedWord = 101, + LastFutureReservedWord = 109, + FirstTypeNode = 135, + LastTypeNode = 143, + FirstPunctuation = 14, + LastPunctuation = 63, + FirstToken = 0, + LastToken = 120, + FirstTriviaToken = 2, + LastTriviaToken = 6, + FirstLiteralToken = 7, + LastLiteralToken = 10, + FirstTemplateToken = 10, + LastTemplateToken = 13, + FirstBinaryOperator = 24, + LastBinaryOperator = 63, + FirstNode = 121, + } + const enum NodeFlags { + Export = 1, + Ambient = 2, + Public = 16, + Private = 32, + Protected = 64, + Static = 128, + MultiLine = 256, + Synthetic = 512, + DeclarationFile = 1024, + Let = 2048, + Const = 4096, + OctalLiteral = 8192, + Modifier = 243, + AccessibilityModifier = 112, + BlockScoped = 6144, + } + const enum ParserContextFlags { + StrictMode = 1, + DisallowIn = 2, + Yield = 4, + GeneratorParameter = 8, + ThisNodeHasError = 16, + ParserGeneratedFlags = 31, + ThisNodeOrAnySubNodesHasError = 32, + HasAggregatedChildData = 64, + } + const enum RelationComparisonResult { + Succeeded = 1, + Failed = 2, + FailedAndReported = 3, + } + interface Node extends TextRange { + kind: SyntaxKind; + flags: NodeFlags; + parserContextFlags?: ParserContextFlags; + id?: number; + parent?: Node; + symbol?: Symbol; + locals?: SymbolTable; + nextContainer?: Node; + localSymbol?: Symbol; + modifiers?: ModifiersArray; + } + interface NodeArray extends Array, TextRange { + hasTrailingComma?: boolean; + } + interface ModifiersArray extends NodeArray { + flags: number; + } + interface Identifier extends PrimaryExpression { + text: string; + } + interface QualifiedName extends Node { + left: EntityName; + right: Identifier; + } + type EntityName = Identifier | QualifiedName; + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + interface Declaration extends Node { + _declarationBrand: any; + name?: DeclarationName; + } + interface ComputedPropertyName extends Node { + expression: Expression; + } + interface TypeParameterDeclaration extends Declaration { + name: Identifier; + constraint?: TypeNode; + expression?: Expression; + } + interface SignatureDeclaration extends Declaration { + typeParameters?: NodeArray; + parameters: NodeArray; + type?: TypeNode; + } + interface VariableDeclaration extends Declaration { + parent?: VariableDeclarationList; + name: Identifier | BindingPattern; + type?: TypeNode; + initializer?: Expression; + } + interface VariableDeclarationList extends Node { + declarations: NodeArray; + } + interface ParameterDeclaration extends Declaration { + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingElement extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + initializer?: Expression; + } + interface PropertyDeclaration extends Declaration, ClassElement { + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + } + interface PropertyAssignment extends ObjectLiteralElement { + _propertyAssignmentBrand: any; + name: DeclarationName; + questionToken?: Node; + initializer: Expression; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + name: Identifier; + questionToken?: Node; + } + interface VariableLikeDeclaration extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingPattern extends Node { + elements: NodeArray; + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { + _functionLikeDeclarationBrand: any; + asteriskToken?: Node; + questionToken?: Node; + body?: Block | Expression; + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { + name: Identifier; + body?: Block; + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + body?: Block; + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + body?: Block; + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + _accessorDeclarationBrand: any; + body: Block; + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { + _indexSignatureDeclarationBrand: any; + } + interface TypeNode extends Node { + _typeNodeBrand: any; + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { + _functionOrConstructorTypeNodeBrand: any; + } + interface TypeReferenceNode extends TypeNode { + typeName: EntityName; + typeArguments?: NodeArray; + } + interface TypeQueryNode extends TypeNode { + exprName: EntityName; + } + interface TypeLiteralNode extends TypeNode, Declaration { + members: NodeArray; + } + interface ArrayTypeNode extends TypeNode { + elementType: TypeNode; + } + interface TupleTypeNode extends TypeNode { + elementTypes: NodeArray; + } + interface UnionTypeNode extends TypeNode { + types: NodeArray; + } + interface ParenthesizedTypeNode extends TypeNode { + type: TypeNode; + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { + } + interface Expression extends Node { + _expressionBrand: any; + contextualType?: Type; + } + interface UnaryExpression extends Expression { + _unaryExpressionBrand: any; + } + interface PrefixUnaryExpression extends UnaryExpression { + operator: SyntaxKind; + operand: UnaryExpression; + } + interface PostfixUnaryExpression extends PostfixExpression { + operand: LeftHandSideExpression; + operator: SyntaxKind; + } + interface PostfixExpression extends UnaryExpression { + _postfixExpressionBrand: any; + } + interface LeftHandSideExpression extends PostfixExpression { + _leftHandSideExpressionBrand: any; + } + interface MemberExpression extends LeftHandSideExpression { + _memberExpressionBrand: any; + } + interface PrimaryExpression extends MemberExpression { + _primaryExpressionBrand: any; + } + interface DeleteExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface TypeOfExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface VoidExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface YieldExpression extends Expression { + asteriskToken?: Node; + expression: Expression; + } + interface BinaryExpression extends Expression { + left: Expression; + operator: SyntaxKind; + right: Expression; + } + interface ConditionalExpression extends Expression { + condition: Expression; + whenTrue: Expression; + whenFalse: Expression; + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + name?: Identifier; + body: Block | Expression; + } + interface LiteralExpression extends PrimaryExpression { + text: string; + isUnterminated?: boolean; + } + interface StringLiteralExpression extends LiteralExpression { + _stringLiteralExpressionBrand: any; + } + interface TemplateExpression extends PrimaryExpression { + head: LiteralExpression; + templateSpans: NodeArray; + } + interface TemplateSpan extends Node { + expression: Expression; + literal: LiteralExpression; + } + interface ParenthesizedExpression extends PrimaryExpression { + expression: Expression; + } + interface ArrayLiteralExpression extends PrimaryExpression { + elements: NodeArray; + } + interface SpreadElementExpression extends Expression { + expression: Expression; + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { + properties: NodeArray; + } + interface PropertyAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + name: Identifier; + } + interface ElementAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + argumentExpression?: Expression; + } + interface CallExpression extends LeftHandSideExpression { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments: NodeArray; + } + interface NewExpression extends CallExpression, PrimaryExpression { + } + interface TaggedTemplateExpression extends MemberExpression { + tag: LeftHandSideExpression; + template: LiteralExpression | TemplateExpression; + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; + interface TypeAssertion extends UnaryExpression { + type: TypeNode; + expression: UnaryExpression; + } + interface Statement extends Node, ModuleElement { + _statementBrand: any; + } + interface Block extends Statement { + statements: NodeArray; + } + interface VariableStatement extends Statement { + declarationList: VariableDeclarationList; + } + interface ExpressionStatement extends Statement { + expression: Expression; + } + interface IfStatement extends Statement { + expression: Expression; + thenStatement: Statement; + elseStatement?: Statement; + } + interface IterationStatement extends Statement { + statement: Statement; + } + interface DoStatement extends IterationStatement { + expression: Expression; + } + interface WhileStatement extends IterationStatement { + expression: Expression; + } + interface ForStatement extends IterationStatement { + initializer?: VariableDeclarationList | Expression; + condition?: Expression; + iterator?: Expression; + } + interface ForInStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + interface BreakOrContinueStatement extends Statement { + label?: Identifier; + } + interface ReturnStatement extends Statement { + expression?: Expression; + } + interface WithStatement extends Statement { + expression: Expression; + statement: Statement; + } + interface SwitchStatement extends Statement { + expression: Expression; + clauses: NodeArray; + } + interface CaseClause extends Node { + expression?: Expression; + statements: NodeArray; + } + interface DefaultClause extends Node { + statements: NodeArray; + } + type CaseOrDefaultClause = CaseClause | DefaultClause; + interface LabeledStatement extends Statement { + label: Identifier; + statement: Statement; + } + interface ThrowStatement extends Statement { + expression: Expression; + } + interface TryStatement extends Statement { + tryBlock: Block; + catchClause?: CatchClause; + finallyBlock?: Block; + } + interface CatchClause extends Declaration { + name: Identifier; + type?: TypeNode; + block: Block; + } + interface ModuleElement extends Node { + _moduleElementBrand: any; + } + interface ClassDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface ClassElement extends Declaration { + _classElementBrand: any; + } + interface InterfaceDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface HeritageClause extends Node { + token: SyntaxKind; + types?: NodeArray; + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { + name: Identifier; + type: TypeNode; + } + interface EnumMember extends Declaration { + name: DeclarationName; + initializer?: Expression; + } + interface EnumDeclaration extends Declaration, ModuleElement { + name: Identifier; + members: NodeArray; + } + interface ModuleDeclaration extends Declaration, ModuleElement { + name: Identifier | LiteralExpression; + body: ModuleBlock | ModuleDeclaration; + } + interface ModuleBlock extends Node, ModuleElement { + statements: NodeArray; + } + interface ImportDeclaration extends Declaration, ModuleElement { + name: Identifier; + moduleReference: EntityName | ExternalModuleReference; + } + interface ExternalModuleReference extends Node { + expression?: Expression; + } + interface ExportAssignment extends Statement, ModuleElement { + exportName: Identifier; + } + interface FileReference extends TextRange { + fileName: string; + } + interface CommentRange extends TextRange { + hasTrailingNewLine?: boolean; + } + interface SourceFile extends Declaration { + statements: NodeArray; + endOfFileToken: Node; + fileName: string; + text: string; + amdDependencies: string[]; + amdModuleName: string; + referencedFiles: FileReference[]; + hasNoDefaultLib: boolean; + externalModuleIndicator: Node; + languageVersion: ScriptTarget; + identifiers: Map; + } + interface ScriptReferenceHost { + getCompilerOptions(): CompilerOptions; + getSourceFile(fileName: string): SourceFile; + getCurrentDirectory(): string; + } + interface WriteFileCallback { + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + } + interface Program extends ScriptReferenceHost { + getSourceFiles(): SourceFile[]; + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeChecker(): TypeChecker; + getCommonSourceDirectory(): string; + } + interface SourceMapSpan { + emittedLine: number; + emittedColumn: number; + sourceLine: number; + sourceColumn: number; + nameIndex?: number; + sourceIndex: number; + } + interface SourceMapData { + sourceMapFilePath: string; + jsSourceMappingURL: string; + sourceMapFile: string; + sourceMapSourceRoot: string; + sourceMapSources: string[]; + inputSourceFileNames: string[]; + sourceMapNames?: string[]; + sourceMapMappings: string; + sourceMapDecodedMappings: SourceMapSpan[]; + } + enum ExitStatus { + Success = 0, + DiagnosticsPresent_OutputsSkipped = 1, + DiagnosticsPresent_OutputsGenerated = 2, + } + interface EmitResult { + emitSkipped: boolean; + diagnostics: Diagnostic[]; + sourceMaps: SourceMapData[]; + } + interface TypeCheckerHost { + getCompilerOptions(): CompilerOptions; + getSourceFiles(): SourceFile[]; + getSourceFile(fileName: string): SourceFile; + } + interface TypeChecker { + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; + getDeclaredTypeOfSymbol(symbol: Symbol): Type; + getPropertiesOfType(type: Type): Symbol[]; + getPropertyOfType(type: Type, propertyName: string): Symbol; + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; + getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getReturnTypeOfSignature(signature: Signature): Type; + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; + getSymbolAtLocation(node: Node): Symbol; + getShorthandAssignmentValueSymbol(location: Node): Symbol; + getTypeAtLocation(node: Node): Type; + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + getSymbolDisplayBuilder(): SymbolDisplayBuilder; + getFullyQualifiedName(symbol: Symbol): string; + getAugmentedPropertiesOfType(type: Type): Symbol[]; + getRootSymbols(symbol: Symbol): Symbol[]; + getContextualType(node: Expression): Type; + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + isUndefinedSymbol(symbol: Symbol): boolean; + isArgumentsSymbol(symbol: Symbol): boolean; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + getAliasedSymbol(symbol: Symbol): Symbol; + } + interface SymbolDisplayBuilder { + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + } + interface SymbolWriter { + writeKeyword(text: string): void; + writeOperator(text: string): void; + writePunctuation(text: string): void; + writeSpace(text: string): void; + writeStringLiteral(text: string): void; + writeParameter(text: string): void; + writeSymbol(text: string, symbol: Symbol): void; + writeLine(): void; + increaseIndent(): void; + decreaseIndent(): void; + clear(): void; + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + } + const enum TypeFormatFlags { + None = 0, + WriteArrayAsGenericType = 1, + UseTypeOfFunction = 2, + NoTruncation = 4, + WriteArrowStyleSignature = 8, + WriteOwnNameForAnyLike = 16, + WriteTypeArgumentsOfSignature = 32, + InElementType = 64, + UseFullyQualifiedType = 128, + } + const enum SymbolFormatFlags { + None = 0, + WriteTypeParametersOrArguments = 1, + UseOnlyExternalAliasing = 2, + } + const enum SymbolAccessibility { + Accessible = 0, + NotAccessible = 1, + CannotBeNamed = 2, + } + interface SymbolVisibilityResult { + accessibility: SymbolAccessibility; + aliasesToMakeVisible?: ImportDeclaration[]; + errorSymbolName?: string; + errorNode?: Node; + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { + errorModuleName?: string; + } + interface EmitResolver { + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; + getExpressionNamePrefix(node: Identifier): string; + getExportAssignmentName(node: SourceFile): string; + isReferencedImportDeclaration(node: ImportDeclaration): boolean; + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + getNodeCheckFlags(node: Node): NodeCheckFlags; + isDeclarationVisible(node: Declaration): boolean; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isUnknownIdentifier(location: Node, name: string): boolean; + } + const enum SymbolFlags { + FunctionScopedVariable = 1, + BlockScopedVariable = 2, + Property = 4, + EnumMember = 8, + Function = 16, + Class = 32, + Interface = 64, + ConstEnum = 128, + RegularEnum = 256, + ValueModule = 512, + NamespaceModule = 1024, + TypeLiteral = 2048, + ObjectLiteral = 4096, + Method = 8192, + Constructor = 16384, + GetAccessor = 32768, + SetAccessor = 65536, + Signature = 131072, + TypeParameter = 262144, + TypeAlias = 524288, + ExportValue = 1048576, + ExportType = 2097152, + ExportNamespace = 4194304, + Import = 8388608, + Instantiated = 16777216, + Merged = 33554432, + Transient = 67108864, + Prototype = 134217728, + UnionProperty = 268435456, + Optional = 536870912, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 793056, + Namespace = 1536, + Module = 1536, + Accessor = 98304, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 107455, + EnumMemberExcludes = 107455, + FunctionExcludes = 106927, + ClassExcludes = 899583, + InterfaceExcludes = 792992, + RegularEnumExcludes = 899327, + ConstEnumExcludes = 899967, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 530912, + TypeAliasExcludes = 793056, + ImportExcludes = 8388608, + ModuleMember = 8914931, + ExportHasLocal = 944, + HasLocals = 255504, + HasExports = 1952, + HasMembers = 6240, + IsContainer = 262128, + PropertyOrAccessor = 98308, + Export = 7340032, + } + interface Symbol { + flags: SymbolFlags; + name: string; + id?: number; + mergeId?: number; + declarations?: Declaration[]; + parent?: Symbol; + members?: SymbolTable; + exports?: SymbolTable; + exportSymbol?: Symbol; + valueDeclaration?: Declaration; + constEnumOnlyModule?: boolean; + } + interface SymbolLinks { + target?: Symbol; + type?: Type; + declaredType?: Type; + mapper?: TypeMapper; + referenced?: boolean; + exportAssignSymbol?: Symbol; + unionType?: UnionType; + } + interface TransientSymbol extends Symbol, SymbolLinks { + } + interface SymbolTable { + [index: string]: Symbol; + } + const enum NodeCheckFlags { + TypeChecked = 1, + LexicalThis = 2, + CaptureThis = 4, + EmitExtends = 8, + SuperInstance = 16, + SuperStatic = 32, + ContextChecked = 64, + EnumValuesComputed = 128, + } + interface NodeLinks { + resolvedType?: Type; + resolvedSignature?: Signature; + resolvedSymbol?: Symbol; + flags?: NodeCheckFlags; + enumMemberValue?: number; + isIllegalTypeReferenceInConstraint?: boolean; + isVisible?: boolean; + localModuleName?: string; + assignmentChecks?: Map; + hasReportedStatementInAmbientContext?: boolean; + importOnRightSide?: Symbol; + } + const enum TypeFlags { + Any = 1, + String = 2, + Number = 4, + Boolean = 8, + Void = 16, + Undefined = 32, + Null = 64, + Enum = 128, + StringLiteral = 256, + TypeParameter = 512, + Class = 1024, + Interface = 2048, + Reference = 4096, + Tuple = 8192, + Union = 16384, + Anonymous = 32768, + FromSignature = 65536, + ObjectLiteral = 131072, + ContainsUndefinedOrNull = 262144, + ContainsObjectLiteral = 524288, + Intrinsic = 127, + Primitive = 510, + StringLike = 258, + NumberLike = 132, + ObjectType = 48128, + RequiresWidening = 786432, + } + interface Type { + flags: TypeFlags; + id: number; + symbol?: Symbol; + } + interface IntrinsicType extends Type { + intrinsicName: string; + } + interface StringLiteralType extends Type { + text: string; + } + interface ObjectType extends Type { + } + interface InterfaceType extends ObjectType { + typeParameters: TypeParameter[]; + baseTypes: ObjectType[]; + declaredProperties: Symbol[]; + declaredCallSignatures: Signature[]; + declaredConstructSignatures: Signature[]; + declaredStringIndexType: Type; + declaredNumberIndexType: Type; + } + interface TypeReference extends ObjectType { + target: GenericType; + typeArguments: Type[]; + } + interface GenericType extends InterfaceType, TypeReference { + instantiations: Map; + } + interface TupleType extends ObjectType { + elementTypes: Type[]; + baseArrayType: TypeReference; + } + interface UnionType extends Type { + types: Type[]; + resolvedProperties: SymbolTable; + } + interface ResolvedType extends ObjectType, UnionType { + members: SymbolTable; + properties: Symbol[]; + callSignatures: Signature[]; + constructSignatures: Signature[]; + stringIndexType: Type; + numberIndexType: Type; + } + interface TypeParameter extends Type { + constraint: Type; + target?: TypeParameter; + mapper?: TypeMapper; + } + const enum SignatureKind { + Call = 0, + Construct = 1, + } + interface Signature { + declaration: SignatureDeclaration; + typeParameters: TypeParameter[]; + parameters: Symbol[]; + resolvedReturnType: Type; + minArgumentCount: number; + hasRestParameter: boolean; + hasStringLiterals: boolean; + target?: Signature; + mapper?: TypeMapper; + unionSignatures?: Signature[]; + erasedSignatureCache?: Signature; + isolatedSignatureType?: ObjectType; + } + const enum IndexKind { + String = 0, + Number = 1, + } + interface TypeMapper { + (t: Type): Type; + } + interface TypeInferences { + primary: Type[]; + secondary: Type[]; + } + interface InferenceContext { + typeParameters: TypeParameter[]; + inferUnionTypes: boolean; + inferences: TypeInferences[]; + inferredTypes: Type[]; + failedTypeParameterIndex?: number; + } + interface DiagnosticMessage { + key: string; + category: DiagnosticCategory; + code: number; + } + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; + } + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string | DiagnosticMessageChain; + category: DiagnosticCategory; + code: number; + } + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, + } + interface CompilerOptions { + allowNonTsExtensions?: boolean; + charset?: string; + codepage?: number; + declaration?: boolean; + diagnostics?: boolean; + emitBOM?: boolean; + help?: boolean; + listFiles?: boolean; + locale?: string; + mapRoot?: string; + module?: ModuleKind; + noEmit?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noImplicitAny?: boolean; + noLib?: boolean; + noLibCheck?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + preserveConstEnums?: boolean; + project?: string; + removeComments?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + version?: boolean; + watch?: boolean; + stripInternal?: boolean; + [option: string]: string | number | boolean; + } + const enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + } + interface LineAndCharacter { + line: number; + character: number; + } + const enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES6 = 2, + Latest = 2, + } + interface ParsedCommandLine { + options: CompilerOptions; + fileNames: string[]; + errors: Diagnostic[]; + } + interface CommandLineOption { + name: string; + type: string | Map; + isFilePath?: boolean; + shortName?: string; + description?: DiagnosticMessage; + paramType?: DiagnosticMessage; + error?: DiagnosticMessage; + experimental?: boolean; + } + const enum CharacterCodes { + nullCharacter = 0, + maxAsciiCharacter = 127, + lineFeed = 10, + carriageReturn = 13, + lineSeparator = 8232, + paragraphSeparator = 8233, + nextLine = 133, + space = 32, + nonBreakingSpace = 160, + enQuad = 8192, + emQuad = 8193, + enSpace = 8194, + emSpace = 8195, + threePerEmSpace = 8196, + fourPerEmSpace = 8197, + sixPerEmSpace = 8198, + figureSpace = 8199, + punctuationSpace = 8200, + thinSpace = 8201, + hairSpace = 8202, + zeroWidthSpace = 8203, + narrowNoBreakSpace = 8239, + ideographicSpace = 12288, + mathematicalSpace = 8287, + ogham = 5760, + _ = 95, + $ = 36, + _0 = 48, + _1 = 49, + _2 = 50, + _3 = 51, + _4 = 52, + _5 = 53, + _6 = 54, + _7 = 55, + _8 = 56, + _9 = 57, + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + ampersand = 38, + asterisk = 42, + at = 64, + backslash = 92, + backtick = 96, + bar = 124, + caret = 94, + closeBrace = 125, + closeBracket = 93, + closeParen = 41, + colon = 58, + comma = 44, + dot = 46, + doubleQuote = 34, + equals = 61, + exclamation = 33, + greaterThan = 62, + lessThan = 60, + minus = 45, + openBrace = 123, + openBracket = 91, + openParen = 40, + percent = 37, + plus = 43, + question = 63, + semicolon = 59, + singleQuote = 39, + slash = 47, + tilde = 126, + backspace = 8, + formFeed = 12, + byteOrderMark = 65279, + tab = 9, + verticalTab = 11, + } + interface CancellationToken { + isCancellationRequested(): boolean; + } + interface CompilerHost { + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; + getCancellationToken?(): CancellationToken; + writeFile: WriteFileCallback; + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + } + interface TextSpan { + start: number; + length: number; + } + interface TextChangeRange { + span: TextSpan; + newLength: number; + } +} +declare module "typescript" { + interface ErrorCallback { + (message: DiagnosticMessage, length: number): void; + } + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scan(): SyntaxKind; + setText(text: string): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + tryScan(callback: () => T): T; + } + function tokenToString(t: SyntaxKind): string; + function computeLineStarts(text: string): number[]; + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getLineStarts(sourceFile: SourceFile): number[]; + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + line: number; + character: number; + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function isWhiteSpace(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function isOctalDigit(ch: number): boolean; + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; + function createNode(kind: SyntaxKind): Node; + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; + function modifierToFlag(token: SyntaxKind): NodeFlags; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; + function isEvalOrArgumentsIdentifier(node: Node): boolean; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function isLeftHandSideExpression(expr: Expression): boolean; + function isAssignmentOperator(token: SyntaxKind): boolean; +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; + function getPreEmitDiagnostics(program: Program): Diagnostic[]; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +} +declare module "typescript" { + var servicesVersion: string; + interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile): number; + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFile): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; + } + interface Symbol { + getFlags(): SymbolFlags; + getName(): string; + getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface Type { + getFlags(): TypeFlags; + getSymbol(): Symbol; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol; + getApparentProperties(): Symbol[]; + getCallSignatures(): Signature[]; + getConstructSignatures(): Signature[]; + getStringIndexType(): Type; + getNumberIndexType(): Type; + } + interface Signature { + getDeclaration(): SignatureDeclaration; + getTypeParameters(): Type[]; + getParameters(): Symbol[]; + getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface SourceFile { + version: string; + scriptSnapshot: IScriptSnapshot; + nameTable: Map; + getNamedDeclarations(): Declaration[]; + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineStarts(): number[]; + getPositionFromLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; + /** Gets the length of this script snapshot. */ + getLength(): number; + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; + } + module ScriptSnapshot { + function fromString(text: string): IScriptSnapshot; + } + interface PreProcessedFileInfo { + referencedFiles: FileReference[]; + importedFiles: FileReference[]; + isLibFile: boolean; + } + interface LanguageServiceHost { + getCompilationSettings(): CompilerOptions; + getNewLine?(): string; + getScriptFileNames(): string[]; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): IScriptSnapshot; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + log?(s: string): void; + trace?(s: string): void; + error?(s: string): void; + } + interface LanguageService { + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; + getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigationBarItems(fileName: string): NavigationBarItem[]; + getOutliningSpans(fileName: string): OutliningSpan[]; + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getEmitOutput(fileName: string): EmitOutput; + getProgram(): Program; + getSourceFile(fileName: string): SourceFile; + dispose(): void; + } + interface ClassifiedSpan { + textSpan: TextSpan; + classificationType: string; + } + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; + } + interface TodoCommentDescriptor { + text: string; + priority: number; + } + interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; + } + class TextChange { + span: TextSpan; + newText: string; + } + interface RenameLocation { + textSpan: TextSpan; + fileName: string; + } + interface ReferenceEntry { + textSpan: TextSpan; + fileName: string; + isWriteAccess: boolean; + } + interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; + fileName: string; + textSpan: TextSpan; + containerName: string; + containerKind: string; + } + interface EditorOptions { + IndentSize: number; + TabSize: number; + NewLineCharacter: string; + ConvertTabsToSpaces: boolean; + } + interface FormatCodeOptions extends EditorOptions { + InsertSpaceAfterCommaDelimiter: boolean; + InsertSpaceAfterSemicolonInForStatements: boolean; + InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + PlaceOpenBraceOnNewLineForFunctions: boolean; + PlaceOpenBraceOnNewLineForControlBlocks: boolean; + } + interface DefinitionInfo { + fileName: string; + textSpan: TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; + } + enum SymbolDisplayPartKind { + aliasName = 0, + className = 1, + enumName = 2, + fieldName = 3, + interfaceName = 4, + keyword = 5, + lineBreak = 6, + numericLiteral = 7, + stringLiteral = 8, + localName = 9, + methodName = 10, + moduleName = 11, + operator = 12, + parameterName = 13, + propertyName = 14, + punctuation = 15, + space = 16, + text = 17, + typeParameterName = 18, + enumMemberName = 19, + functionName = 20, + regularExpressionLiteral = 21, + } + interface SymbolDisplayPart { + text: string; + kind: string; + } + interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TextSpan; + } + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; + } + interface CompletionInfo { + isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; + entries: CompletionEntry[]; + } + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + } + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface OutliningSpan { + /** The span of the document to actually collapse. */ + textSpan: TextSpan; + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; + /** The text to display in the editor for the collapsed region. */ + bannerText: string; + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; + } + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + const enum OutputFileType { + JavaScript = 0, + SourceMap = 1, + Declaration = 2, + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } + const enum EndOfLineState { + Start = 0, + InMultiLineCommentTrivia = 1, + InSingleQuoteStringLiteral = 2, + InDoubleQuoteStringLiteral = 3, + } + enum TokenClass { + Punctuation = 0, + Keyword = 1, + Operator = 2, + Comment = 3, + Whitespace = 4, + Identifier = 5, + NumberLiteral = 6, + StringLiteral = 7, + RegExpLiteral = 8, + } + interface ClassificationResult { + finalLexState: EndOfLineState; + entries: ClassificationInfo[]; + } + interface ClassificationInfo { + length: number; + classification: TokenClass; + } + interface Classifier { + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + } + class ScriptElementKind { + static unknown: string; + static keyword: string; + static scriptElement: string; + static moduleElement: string; + static classElement: string; + static interfaceElement: string; + static typeElement: string; + static enumElement: string; + static variableElement: string; + static localVariableElement: string; + static functionElement: string; + static localFunctionElement: string; + static memberFunctionElement: string; + static memberGetAccessorElement: string; + static memberSetAccessorElement: string; + static memberVariableElement: string; + static constructorImplementationElement: string; + static callSignatureElement: string; + static indexSignatureElement: string; + static constructSignatureElement: string; + static parameterElement: string; + static typeParameterElement: string; + static primitiveType: string; + static label: string; + static alias: string; + static constElement: string; + static letElement: string; + } + class ScriptElementKindModifier { + static none: string; + static publicMemberModifier: string; + static privateMemberModifier: string; + static protectedMemberModifier: string; + static exportedModifier: string; + static ambientModifier: string; + static staticModifier: string; + } + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAlias: string; + } + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; + function getDefaultCompilerOptions(): CompilerOptions; + class OperationCanceledException { + } + class CancellationTokenObject { + private cancellationToken; + static None: CancellationTokenObject; + constructor(cancellationToken: CancellationToken); + isCancellationRequested(): boolean; + throwIfCancellationRequested(): void; + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + var disableIncrementalParsing: boolean; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + function createDocumentRegistry(): DocumentRegistry; + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function createClassifier(): Classifier; + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +} + + +//// [APISample_transform.js] +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ +var ts = require("typescript"); +function transform(contents, compilerOptions) { + if (compilerOptions === void 0) { compilerOptions = {}; } + // Sources + var files = { + "file.ts": contents, + "lib.d.ts": fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions)).toString() + }; + // Generated outputs + var outputs = []; + // Create a compilerHost object to allow the compiler to read and write files + var compilerHost = { + getSourceFile: function (fileName, target) { + return files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined; + }, + writeFile: function (name, text, writeByteOrderMark) { + outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); + }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, + useCaseSensitiveFileNames: function () { return false; }, + getCanonicalFileName: function (fileName) { return fileName; }, + getCurrentDirectory: function () { return ""; }, + getNewLine: function () { return "\n"; } + }; + // Create a program from inputs + var program = ts.createProgram(["file.ts"], compilerOptions, compilerHost); + // Query for early errors + var errors = ts.getPreEmitDiagnostics(program); + var emitResult = program.emit(); + errors = errors.concat(emitResult.diagnostics); + return { + outputs: outputs, + errors: errors.map(function (e) { + return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); + }) + }; +} +// Calling our transform function using a simple TypeScript variable declarations, +// and loading the default library like: +var source = "var x: number = 'string'"; +var result = transform(source); +console.log(JSON.stringify(result)); diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types new file mode 100644 index 00000000000..c6d74cc811d --- /dev/null +++ b/tests/baselines/reference/APISample_transform.types @@ -0,0 +1,6037 @@ +=== tests/cases/compiler/APISample_transform.ts === + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +>process : any + +declare var console: any; +>console : any + +declare var fs: any; +>fs : any + +declare var path: any; +>path : any + +declare var os: any; +>os : any + +import ts = require("typescript"); +>ts : typeof ts + +function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { +>transform : (contents: string, compilerOptions?: ts.CompilerOptions) => { outputs: any[]; errors: string[]; } +>contents : string +>compilerOptions : ts.CompilerOptions +>ts : unknown +>CompilerOptions : ts.CompilerOptions +>{} : { [x: string]: undefined; } + + // Sources + var files = { +>files : { "file.ts": string; "lib.d.ts": any; } +>{ "file.ts": contents, "lib.d.ts": fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions)).toString() } : { "file.ts": string; "lib.d.ts": any; } + + "file.ts": contents, +>contents : string + + "lib.d.ts": fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions)).toString() +>fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions)).toString() : any +>fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions)).toString : any +>fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions)) : any +>fs.readFileSync : any +>fs : any +>readFileSync : any +>ts.getDefaultLibFilePath(compilerOptions) : string +>ts.getDefaultLibFilePath : (options: ts.CompilerOptions) => string +>ts : typeof ts +>getDefaultLibFilePath : (options: ts.CompilerOptions) => string +>compilerOptions : ts.CompilerOptions +>toString : any + + }; + + // Generated outputs + var outputs = []; +>outputs : any[] +>[] : undefined[] + + // Create a compilerHost object to allow the compiler to read and write files + var compilerHost = { +>compilerHost : { getSourceFile: (fileName: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFileName: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (fileName: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } +>{ getSourceFile: (fileName, target) => { return files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined; }, writeFile: (name, text, writeByteOrderMark) => { outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, getDefaultLibFileName: () => "lib.d.ts", useCaseSensitiveFileNames: () => false, getCanonicalFileName: (fileName) => fileName, getCurrentDirectory: () => "", getNewLine: () => "\n" } : { getSourceFile: (fileName: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFileName: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (fileName: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } + + getSourceFile: (fileName, target) => { +>getSourceFile : (fileName: any, target: any) => ts.SourceFile +>(fileName, target) => { return files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined; } : (fileName: any, target: any) => ts.SourceFile +>fileName : any +>target : any + + return files[fileName] !== undefined ? +>files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined : ts.SourceFile +>files[fileName] !== undefined : boolean +>files[fileName] : any +>files : { "file.ts": string; "lib.d.ts": any; } +>fileName : any +>undefined : undefined + + ts.createSourceFile(fileName, files[fileName], target) : undefined; +>ts.createSourceFile(fileName, files[fileName], target) : ts.SourceFile +>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>ts : typeof ts +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>fileName : any +>files[fileName] : any +>files : { "file.ts": string; "lib.d.ts": any; } +>fileName : any +>target : any +>undefined : undefined + + }, + writeFile: (name, text, writeByteOrderMark) => { +>writeFile : (name: any, text: any, writeByteOrderMark: any) => void +>(name, text, writeByteOrderMark) => { outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); } : (name: any, text: any, writeByteOrderMark: any) => void +>name : any +>text : any +>writeByteOrderMark : any + + outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); +>outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }) : number +>outputs.push : (...items: any[]) => number +>outputs : any[] +>push : (...items: any[]) => number +>{ name: name, text: text, writeByteOrderMark: writeByteOrderMark } : { name: any; text: any; writeByteOrderMark: any; } +>name : any +>name : any +>text : any +>text : any +>writeByteOrderMark : any +>writeByteOrderMark : any + + }, + getDefaultLibFileName: () => "lib.d.ts", +>getDefaultLibFileName : () => string +>() => "lib.d.ts" : () => string + + useCaseSensitiveFileNames: () => false, +>useCaseSensitiveFileNames : () => boolean +>() => false : () => boolean + + getCanonicalFileName: (fileName) => fileName, +>getCanonicalFileName : (fileName: any) => any +>(fileName) => fileName : (fileName: any) => any +>fileName : any +>fileName : any + + getCurrentDirectory: () => "", +>getCurrentDirectory : () => string +>() => "" : () => string + + getNewLine: () => "\n" +>getNewLine : () => string +>() => "\n" : () => string + + }; + + // Create a program from inputs + var program = ts.createProgram(["file.ts"], compilerOptions, compilerHost); +>program : ts.Program +>ts.createProgram(["file.ts"], compilerOptions, compilerHost) : ts.Program +>ts.createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program +>ts : typeof ts +>createProgram : (rootNames: string[], options: ts.CompilerOptions, host?: ts.CompilerHost) => ts.Program +>["file.ts"] : string[] +>compilerOptions : ts.CompilerOptions +>compilerHost : { getSourceFile: (fileName: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFileName: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (fileName: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } + + // Query for early errors + var errors = ts.getPreEmitDiagnostics(program); +>errors : ts.Diagnostic[] +>ts.getPreEmitDiagnostics(program) : ts.Diagnostic[] +>ts.getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[] +>ts : typeof ts +>getPreEmitDiagnostics : (program: ts.Program) => ts.Diagnostic[] +>program : ts.Program + + var emitResult = program.emit(); +>emitResult : ts.EmitResult +>program.emit() : ts.EmitResult +>program.emit : (targetSourceFile?: ts.SourceFile, writeFile?: ts.WriteFileCallback) => ts.EmitResult +>program : ts.Program +>emit : (targetSourceFile?: ts.SourceFile, writeFile?: ts.WriteFileCallback) => ts.EmitResult + + errors = errors.concat(emitResult.diagnostics); +>errors = errors.concat(emitResult.diagnostics) : ts.Diagnostic[] +>errors : ts.Diagnostic[] +>errors.concat(emitResult.diagnostics) : ts.Diagnostic[] +>errors.concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>errors : ts.Diagnostic[] +>concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>emitResult.diagnostics : ts.Diagnostic[] +>emitResult : ts.EmitResult +>diagnostics : ts.Diagnostic[] + + return { +>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } + + outputs: outputs, +>outputs : any[] +>outputs : any[] + + errors: errors.map(function (e) { +>errors : string[] +>errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] +>errors.map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] +>errors : ts.Diagnostic[] +>map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] +>function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string +>e : ts.Diagnostic + + return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " +>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string +>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string +>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string +>e.file.fileName + "(" : string +>e.file.fileName : string +>e.file : ts.SourceFile +>e : ts.Diagnostic +>file : ts.SourceFile +>fileName : string +>e.file.getLineAndCharacterFromPosition(e.start).line : number +>e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter +>e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>e.file : ts.SourceFile +>e : ts.Diagnostic +>file : ts.SourceFile +>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>e.start : number +>e : ts.Diagnostic +>start : number +>line : number + + + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); +>ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string +>ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string +>ts : typeof ts +>flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string +>e.messageText : string | ts.DiagnosticMessageChain +>e : ts.Diagnostic +>messageText : string | ts.DiagnosticMessageChain +>os.EOL : any +>os : any +>EOL : any + + }) + }; +} + +// Calling our transform function using a simple TypeScript variable declarations, +// and loading the default library like: +var source = "var x: number = 'string'"; +>source : string + +var result = transform(source); +>result : { outputs: any[]; errors: string[]; } +>transform(source) : { outputs: any[]; errors: string[]; } +>transform : (contents: string, compilerOptions?: ts.CompilerOptions) => { outputs: any[]; errors: string[]; } +>source : string + +console.log(JSON.stringify(result)); +>console.log(JSON.stringify(result)) : any +>console.log : any +>console : any +>log : any +>JSON.stringify(result) : string +>JSON.stringify : { (value: any): string; (value: any, replacer: (key: string, value: any) => any): string; (value: any, replacer: any[]): string; (value: any, replacer: (key: string, value: any) => any, space: any): string; (value: any, replacer: any[], space: any): string; } +>JSON : JSON +>stringify : { (value: any): string; (value: any, replacer: (key: string, value: any) => any): string; (value: any, replacer: any[]): string; (value: any, replacer: (key: string, value: any) => any, space: any): string; (value: any, replacer: any[], space: any): string; } +>result : { outputs: any[]; errors: string[]; } + +=== typescript.d.ts === +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { +>Map : Map +>T : T + + [index: string]: T; +>index : string +>T : T + } + interface TextRange { +>TextRange : TextRange + + pos: number; +>pos : number + + end: number; +>end : number + } + const enum SyntaxKind { +>SyntaxKind : SyntaxKind + + Unknown = 0, +>Unknown : SyntaxKind + + EndOfFileToken = 1, +>EndOfFileToken : SyntaxKind + + SingleLineCommentTrivia = 2, +>SingleLineCommentTrivia : SyntaxKind + + MultiLineCommentTrivia = 3, +>MultiLineCommentTrivia : SyntaxKind + + NewLineTrivia = 4, +>NewLineTrivia : SyntaxKind + + WhitespaceTrivia = 5, +>WhitespaceTrivia : SyntaxKind + + ConflictMarkerTrivia = 6, +>ConflictMarkerTrivia : SyntaxKind + + NumericLiteral = 7, +>NumericLiteral : SyntaxKind + + StringLiteral = 8, +>StringLiteral : SyntaxKind + + RegularExpressionLiteral = 9, +>RegularExpressionLiteral : SyntaxKind + + NoSubstitutionTemplateLiteral = 10, +>NoSubstitutionTemplateLiteral : SyntaxKind + + TemplateHead = 11, +>TemplateHead : SyntaxKind + + TemplateMiddle = 12, +>TemplateMiddle : SyntaxKind + + TemplateTail = 13, +>TemplateTail : SyntaxKind + + OpenBraceToken = 14, +>OpenBraceToken : SyntaxKind + + CloseBraceToken = 15, +>CloseBraceToken : SyntaxKind + + OpenParenToken = 16, +>OpenParenToken : SyntaxKind + + CloseParenToken = 17, +>CloseParenToken : SyntaxKind + + OpenBracketToken = 18, +>OpenBracketToken : SyntaxKind + + CloseBracketToken = 19, +>CloseBracketToken : SyntaxKind + + DotToken = 20, +>DotToken : SyntaxKind + + DotDotDotToken = 21, +>DotDotDotToken : SyntaxKind + + SemicolonToken = 22, +>SemicolonToken : SyntaxKind + + CommaToken = 23, +>CommaToken : SyntaxKind + + LessThanToken = 24, +>LessThanToken : SyntaxKind + + GreaterThanToken = 25, +>GreaterThanToken : SyntaxKind + + LessThanEqualsToken = 26, +>LessThanEqualsToken : SyntaxKind + + GreaterThanEqualsToken = 27, +>GreaterThanEqualsToken : SyntaxKind + + EqualsEqualsToken = 28, +>EqualsEqualsToken : SyntaxKind + + ExclamationEqualsToken = 29, +>ExclamationEqualsToken : SyntaxKind + + EqualsEqualsEqualsToken = 30, +>EqualsEqualsEqualsToken : SyntaxKind + + ExclamationEqualsEqualsToken = 31, +>ExclamationEqualsEqualsToken : SyntaxKind + + EqualsGreaterThanToken = 32, +>EqualsGreaterThanToken : SyntaxKind + + PlusToken = 33, +>PlusToken : SyntaxKind + + MinusToken = 34, +>MinusToken : SyntaxKind + + AsteriskToken = 35, +>AsteriskToken : SyntaxKind + + SlashToken = 36, +>SlashToken : SyntaxKind + + PercentToken = 37, +>PercentToken : SyntaxKind + + PlusPlusToken = 38, +>PlusPlusToken : SyntaxKind + + MinusMinusToken = 39, +>MinusMinusToken : SyntaxKind + + LessThanLessThanToken = 40, +>LessThanLessThanToken : SyntaxKind + + GreaterThanGreaterThanToken = 41, +>GreaterThanGreaterThanToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanToken = 42, +>GreaterThanGreaterThanGreaterThanToken : SyntaxKind + + AmpersandToken = 43, +>AmpersandToken : SyntaxKind + + BarToken = 44, +>BarToken : SyntaxKind + + CaretToken = 45, +>CaretToken : SyntaxKind + + ExclamationToken = 46, +>ExclamationToken : SyntaxKind + + TildeToken = 47, +>TildeToken : SyntaxKind + + AmpersandAmpersandToken = 48, +>AmpersandAmpersandToken : SyntaxKind + + BarBarToken = 49, +>BarBarToken : SyntaxKind + + QuestionToken = 50, +>QuestionToken : SyntaxKind + + ColonToken = 51, +>ColonToken : SyntaxKind + + EqualsToken = 52, +>EqualsToken : SyntaxKind + + PlusEqualsToken = 53, +>PlusEqualsToken : SyntaxKind + + MinusEqualsToken = 54, +>MinusEqualsToken : SyntaxKind + + AsteriskEqualsToken = 55, +>AsteriskEqualsToken : SyntaxKind + + SlashEqualsToken = 56, +>SlashEqualsToken : SyntaxKind + + PercentEqualsToken = 57, +>PercentEqualsToken : SyntaxKind + + LessThanLessThanEqualsToken = 58, +>LessThanLessThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanEqualsToken = 59, +>GreaterThanGreaterThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanEqualsToken = 60, +>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind + + AmpersandEqualsToken = 61, +>AmpersandEqualsToken : SyntaxKind + + BarEqualsToken = 62, +>BarEqualsToken : SyntaxKind + + CaretEqualsToken = 63, +>CaretEqualsToken : SyntaxKind + + Identifier = 64, +>Identifier : SyntaxKind + + BreakKeyword = 65, +>BreakKeyword : SyntaxKind + + CaseKeyword = 66, +>CaseKeyword : SyntaxKind + + CatchKeyword = 67, +>CatchKeyword : SyntaxKind + + ClassKeyword = 68, +>ClassKeyword : SyntaxKind + + ConstKeyword = 69, +>ConstKeyword : SyntaxKind + + ContinueKeyword = 70, +>ContinueKeyword : SyntaxKind + + DebuggerKeyword = 71, +>DebuggerKeyword : SyntaxKind + + DefaultKeyword = 72, +>DefaultKeyword : SyntaxKind + + DeleteKeyword = 73, +>DeleteKeyword : SyntaxKind + + DoKeyword = 74, +>DoKeyword : SyntaxKind + + ElseKeyword = 75, +>ElseKeyword : SyntaxKind + + EnumKeyword = 76, +>EnumKeyword : SyntaxKind + + ExportKeyword = 77, +>ExportKeyword : SyntaxKind + + ExtendsKeyword = 78, +>ExtendsKeyword : SyntaxKind + + FalseKeyword = 79, +>FalseKeyword : SyntaxKind + + FinallyKeyword = 80, +>FinallyKeyword : SyntaxKind + + ForKeyword = 81, +>ForKeyword : SyntaxKind + + FunctionKeyword = 82, +>FunctionKeyword : SyntaxKind + + IfKeyword = 83, +>IfKeyword : SyntaxKind + + ImportKeyword = 84, +>ImportKeyword : SyntaxKind + + InKeyword = 85, +>InKeyword : SyntaxKind + + InstanceOfKeyword = 86, +>InstanceOfKeyword : SyntaxKind + + NewKeyword = 87, +>NewKeyword : SyntaxKind + + NullKeyword = 88, +>NullKeyword : SyntaxKind + + ReturnKeyword = 89, +>ReturnKeyword : SyntaxKind + + SuperKeyword = 90, +>SuperKeyword : SyntaxKind + + SwitchKeyword = 91, +>SwitchKeyword : SyntaxKind + + ThisKeyword = 92, +>ThisKeyword : SyntaxKind + + ThrowKeyword = 93, +>ThrowKeyword : SyntaxKind + + TrueKeyword = 94, +>TrueKeyword : SyntaxKind + + TryKeyword = 95, +>TryKeyword : SyntaxKind + + TypeOfKeyword = 96, +>TypeOfKeyword : SyntaxKind + + VarKeyword = 97, +>VarKeyword : SyntaxKind + + VoidKeyword = 98, +>VoidKeyword : SyntaxKind + + WhileKeyword = 99, +>WhileKeyword : SyntaxKind + + WithKeyword = 100, +>WithKeyword : SyntaxKind + + ImplementsKeyword = 101, +>ImplementsKeyword : SyntaxKind + + InterfaceKeyword = 102, +>InterfaceKeyword : SyntaxKind + + LetKeyword = 103, +>LetKeyword : SyntaxKind + + PackageKeyword = 104, +>PackageKeyword : SyntaxKind + + PrivateKeyword = 105, +>PrivateKeyword : SyntaxKind + + ProtectedKeyword = 106, +>ProtectedKeyword : SyntaxKind + + PublicKeyword = 107, +>PublicKeyword : SyntaxKind + + StaticKeyword = 108, +>StaticKeyword : SyntaxKind + + YieldKeyword = 109, +>YieldKeyword : SyntaxKind + + AnyKeyword = 110, +>AnyKeyword : SyntaxKind + + BooleanKeyword = 111, +>BooleanKeyword : SyntaxKind + + ConstructorKeyword = 112, +>ConstructorKeyword : SyntaxKind + + DeclareKeyword = 113, +>DeclareKeyword : SyntaxKind + + GetKeyword = 114, +>GetKeyword : SyntaxKind + + ModuleKeyword = 115, +>ModuleKeyword : SyntaxKind + + RequireKeyword = 116, +>RequireKeyword : SyntaxKind + + NumberKeyword = 117, +>NumberKeyword : SyntaxKind + + SetKeyword = 118, +>SetKeyword : SyntaxKind + + StringKeyword = 119, +>StringKeyword : SyntaxKind + + TypeKeyword = 120, +>TypeKeyword : SyntaxKind + + QualifiedName = 121, +>QualifiedName : SyntaxKind + + ComputedPropertyName = 122, +>ComputedPropertyName : SyntaxKind + + TypeParameter = 123, +>TypeParameter : SyntaxKind + + Parameter = 124, +>Parameter : SyntaxKind + + PropertySignature = 125, +>PropertySignature : SyntaxKind + + PropertyDeclaration = 126, +>PropertyDeclaration : SyntaxKind + + MethodSignature = 127, +>MethodSignature : SyntaxKind + + MethodDeclaration = 128, +>MethodDeclaration : SyntaxKind + + Constructor = 129, +>Constructor : SyntaxKind + + GetAccessor = 130, +>GetAccessor : SyntaxKind + + SetAccessor = 131, +>SetAccessor : SyntaxKind + + CallSignature = 132, +>CallSignature : SyntaxKind + + ConstructSignature = 133, +>ConstructSignature : SyntaxKind + + IndexSignature = 134, +>IndexSignature : SyntaxKind + + TypeReference = 135, +>TypeReference : SyntaxKind + + FunctionType = 136, +>FunctionType : SyntaxKind + + ConstructorType = 137, +>ConstructorType : SyntaxKind + + TypeQuery = 138, +>TypeQuery : SyntaxKind + + TypeLiteral = 139, +>TypeLiteral : SyntaxKind + + ArrayType = 140, +>ArrayType : SyntaxKind + + TupleType = 141, +>TupleType : SyntaxKind + + UnionType = 142, +>UnionType : SyntaxKind + + ParenthesizedType = 143, +>ParenthesizedType : SyntaxKind + + ObjectBindingPattern = 144, +>ObjectBindingPattern : SyntaxKind + + ArrayBindingPattern = 145, +>ArrayBindingPattern : SyntaxKind + + BindingElement = 146, +>BindingElement : SyntaxKind + + ArrayLiteralExpression = 147, +>ArrayLiteralExpression : SyntaxKind + + ObjectLiteralExpression = 148, +>ObjectLiteralExpression : SyntaxKind + + PropertyAccessExpression = 149, +>PropertyAccessExpression : SyntaxKind + + ElementAccessExpression = 150, +>ElementAccessExpression : SyntaxKind + + CallExpression = 151, +>CallExpression : SyntaxKind + + NewExpression = 152, +>NewExpression : SyntaxKind + + TaggedTemplateExpression = 153, +>TaggedTemplateExpression : SyntaxKind + + TypeAssertionExpression = 154, +>TypeAssertionExpression : SyntaxKind + + ParenthesizedExpression = 155, +>ParenthesizedExpression : SyntaxKind + + FunctionExpression = 156, +>FunctionExpression : SyntaxKind + + ArrowFunction = 157, +>ArrowFunction : SyntaxKind + + DeleteExpression = 158, +>DeleteExpression : SyntaxKind + + TypeOfExpression = 159, +>TypeOfExpression : SyntaxKind + + VoidExpression = 160, +>VoidExpression : SyntaxKind + + PrefixUnaryExpression = 161, +>PrefixUnaryExpression : SyntaxKind + + PostfixUnaryExpression = 162, +>PostfixUnaryExpression : SyntaxKind + + BinaryExpression = 163, +>BinaryExpression : SyntaxKind + + ConditionalExpression = 164, +>ConditionalExpression : SyntaxKind + + TemplateExpression = 165, +>TemplateExpression : SyntaxKind + + YieldExpression = 166, +>YieldExpression : SyntaxKind + + SpreadElementExpression = 167, +>SpreadElementExpression : SyntaxKind + + OmittedExpression = 168, +>OmittedExpression : SyntaxKind + + TemplateSpan = 169, +>TemplateSpan : SyntaxKind + + Block = 170, +>Block : SyntaxKind + + VariableStatement = 171, +>VariableStatement : SyntaxKind + + EmptyStatement = 172, +>EmptyStatement : SyntaxKind + + ExpressionStatement = 173, +>ExpressionStatement : SyntaxKind + + IfStatement = 174, +>IfStatement : SyntaxKind + + DoStatement = 175, +>DoStatement : SyntaxKind + + WhileStatement = 176, +>WhileStatement : SyntaxKind + + ForStatement = 177, +>ForStatement : SyntaxKind + + ForInStatement = 178, +>ForInStatement : SyntaxKind + + ContinueStatement = 179, +>ContinueStatement : SyntaxKind + + BreakStatement = 180, +>BreakStatement : SyntaxKind + + ReturnStatement = 181, +>ReturnStatement : SyntaxKind + + WithStatement = 182, +>WithStatement : SyntaxKind + + SwitchStatement = 183, +>SwitchStatement : SyntaxKind + + LabeledStatement = 184, +>LabeledStatement : SyntaxKind + + ThrowStatement = 185, +>ThrowStatement : SyntaxKind + + TryStatement = 186, +>TryStatement : SyntaxKind + + DebuggerStatement = 187, +>DebuggerStatement : SyntaxKind + + VariableDeclaration = 188, +>VariableDeclaration : SyntaxKind + + VariableDeclarationList = 189, +>VariableDeclarationList : SyntaxKind + + FunctionDeclaration = 190, +>FunctionDeclaration : SyntaxKind + + ClassDeclaration = 191, +>ClassDeclaration : SyntaxKind + + InterfaceDeclaration = 192, +>InterfaceDeclaration : SyntaxKind + + TypeAliasDeclaration = 193, +>TypeAliasDeclaration : SyntaxKind + + EnumDeclaration = 194, +>EnumDeclaration : SyntaxKind + + ModuleDeclaration = 195, +>ModuleDeclaration : SyntaxKind + + ModuleBlock = 196, +>ModuleBlock : SyntaxKind + + ImportDeclaration = 197, +>ImportDeclaration : SyntaxKind + + ExportAssignment = 198, +>ExportAssignment : SyntaxKind + + ExternalModuleReference = 199, +>ExternalModuleReference : SyntaxKind + + CaseClause = 200, +>CaseClause : SyntaxKind + + DefaultClause = 201, +>DefaultClause : SyntaxKind + + HeritageClause = 202, +>HeritageClause : SyntaxKind + + CatchClause = 203, +>CatchClause : SyntaxKind + + PropertyAssignment = 204, +>PropertyAssignment : SyntaxKind + + ShorthandPropertyAssignment = 205, +>ShorthandPropertyAssignment : SyntaxKind + + EnumMember = 206, +>EnumMember : SyntaxKind + + SourceFile = 207, +>SourceFile : SyntaxKind + + SyntaxList = 208, +>SyntaxList : SyntaxKind + + Count = 209, +>Count : SyntaxKind + + FirstAssignment = 52, +>FirstAssignment : SyntaxKind + + LastAssignment = 63, +>LastAssignment : SyntaxKind + + FirstReservedWord = 65, +>FirstReservedWord : SyntaxKind + + LastReservedWord = 100, +>LastReservedWord : SyntaxKind + + FirstKeyword = 65, +>FirstKeyword : SyntaxKind + + LastKeyword = 120, +>LastKeyword : SyntaxKind + + FirstFutureReservedWord = 101, +>FirstFutureReservedWord : SyntaxKind + + LastFutureReservedWord = 109, +>LastFutureReservedWord : SyntaxKind + + FirstTypeNode = 135, +>FirstTypeNode : SyntaxKind + + LastTypeNode = 143, +>LastTypeNode : SyntaxKind + + FirstPunctuation = 14, +>FirstPunctuation : SyntaxKind + + LastPunctuation = 63, +>LastPunctuation : SyntaxKind + + FirstToken = 0, +>FirstToken : SyntaxKind + + LastToken = 120, +>LastToken : SyntaxKind + + FirstTriviaToken = 2, +>FirstTriviaToken : SyntaxKind + + LastTriviaToken = 6, +>LastTriviaToken : SyntaxKind + + FirstLiteralToken = 7, +>FirstLiteralToken : SyntaxKind + + LastLiteralToken = 10, +>LastLiteralToken : SyntaxKind + + FirstTemplateToken = 10, +>FirstTemplateToken : SyntaxKind + + LastTemplateToken = 13, +>LastTemplateToken : SyntaxKind + + FirstBinaryOperator = 24, +>FirstBinaryOperator : SyntaxKind + + LastBinaryOperator = 63, +>LastBinaryOperator : SyntaxKind + + FirstNode = 121, +>FirstNode : SyntaxKind + } + const enum NodeFlags { +>NodeFlags : NodeFlags + + Export = 1, +>Export : NodeFlags + + Ambient = 2, +>Ambient : NodeFlags + + Public = 16, +>Public : NodeFlags + + Private = 32, +>Private : NodeFlags + + Protected = 64, +>Protected : NodeFlags + + Static = 128, +>Static : NodeFlags + + MultiLine = 256, +>MultiLine : NodeFlags + + Synthetic = 512, +>Synthetic : NodeFlags + + DeclarationFile = 1024, +>DeclarationFile : NodeFlags + + Let = 2048, +>Let : NodeFlags + + Const = 4096, +>Const : NodeFlags + + OctalLiteral = 8192, +>OctalLiteral : NodeFlags + + Modifier = 243, +>Modifier : NodeFlags + + AccessibilityModifier = 112, +>AccessibilityModifier : NodeFlags + + BlockScoped = 6144, +>BlockScoped : NodeFlags + } + const enum ParserContextFlags { +>ParserContextFlags : ParserContextFlags + + StrictMode = 1, +>StrictMode : ParserContextFlags + + DisallowIn = 2, +>DisallowIn : ParserContextFlags + + Yield = 4, +>Yield : ParserContextFlags + + GeneratorParameter = 8, +>GeneratorParameter : ParserContextFlags + + ThisNodeHasError = 16, +>ThisNodeHasError : ParserContextFlags + + ParserGeneratedFlags = 31, +>ParserGeneratedFlags : ParserContextFlags + + ThisNodeOrAnySubNodesHasError = 32, +>ThisNodeOrAnySubNodesHasError : ParserContextFlags + + HasAggregatedChildData = 64, +>HasAggregatedChildData : ParserContextFlags + } + const enum RelationComparisonResult { +>RelationComparisonResult : RelationComparisonResult + + Succeeded = 1, +>Succeeded : RelationComparisonResult + + Failed = 2, +>Failed : RelationComparisonResult + + FailedAndReported = 3, +>FailedAndReported : RelationComparisonResult + } + interface Node extends TextRange { +>Node : Node +>TextRange : TextRange + + kind: SyntaxKind; +>kind : SyntaxKind +>SyntaxKind : SyntaxKind + + flags: NodeFlags; +>flags : NodeFlags +>NodeFlags : NodeFlags + + parserContextFlags?: ParserContextFlags; +>parserContextFlags : ParserContextFlags +>ParserContextFlags : ParserContextFlags + + id?: number; +>id : number + + parent?: Node; +>parent : Node +>Node : Node + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + + locals?: SymbolTable; +>locals : SymbolTable +>SymbolTable : SymbolTable + + nextContainer?: Node; +>nextContainer : Node +>Node : Node + + localSymbol?: Symbol; +>localSymbol : Symbol +>Symbol : Symbol + + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + } + interface NodeArray extends Array, TextRange { +>NodeArray : NodeArray +>T : T +>Array : T[] +>T : T +>TextRange : TextRange + + hasTrailingComma?: boolean; +>hasTrailingComma : boolean + } + interface ModifiersArray extends NodeArray { +>ModifiersArray : ModifiersArray +>NodeArray : NodeArray +>Node : Node + + flags: number; +>flags : number + } + interface Identifier extends PrimaryExpression { +>Identifier : Identifier +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + } + interface QualifiedName extends Node { +>QualifiedName : QualifiedName +>Node : Node + + left: EntityName; +>left : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + right: Identifier; +>right : Identifier +>Identifier : Identifier + } + type EntityName = Identifier | QualifiedName; +>EntityName : Identifier | QualifiedName +>Identifier : Identifier +>QualifiedName : QualifiedName + + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>Identifier : Identifier +>LiteralExpression : LiteralExpression +>ComputedPropertyName : ComputedPropertyName +>BindingPattern : BindingPattern + + interface Declaration extends Node { +>Declaration : Declaration +>Node : Node + + _declarationBrand: any; +>_declarationBrand : any + + name?: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + } + interface ComputedPropertyName extends Node { +>ComputedPropertyName : ComputedPropertyName +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TypeParameterDeclaration extends Declaration { +>TypeParameterDeclaration : TypeParameterDeclaration +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + constraint?: TypeNode; +>constraint : TypeNode +>TypeNode : TypeNode + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface SignatureDeclaration extends Declaration { +>SignatureDeclaration : SignatureDeclaration +>Declaration : Declaration + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + parameters: NodeArray; +>parameters : NodeArray +>NodeArray : NodeArray +>ParameterDeclaration : ParameterDeclaration + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface VariableDeclaration extends Declaration { +>VariableDeclaration : VariableDeclaration +>Declaration : Declaration + + parent?: VariableDeclarationList; +>parent : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface VariableDeclarationList extends Node { +>VariableDeclarationList : VariableDeclarationList +>Node : Node + + declarations: NodeArray; +>declarations : NodeArray +>NodeArray : NodeArray +>VariableDeclaration : VariableDeclaration + } + interface ParameterDeclaration extends Declaration { +>ParameterDeclaration : ParameterDeclaration +>Declaration : Declaration + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingElement extends Declaration { +>BindingElement : BindingElement +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface PropertyDeclaration extends Declaration, ClassElement { +>PropertyDeclaration : PropertyDeclaration +>Declaration : Declaration +>ClassElement : ClassElement + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface ObjectLiteralElement extends Declaration { +>ObjectLiteralElement : ObjectLiteralElement +>Declaration : Declaration + + _objectLiteralBrandBrand: any; +>_objectLiteralBrandBrand : any + } + interface PropertyAssignment extends ObjectLiteralElement { +>PropertyAssignment : PropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + _propertyAssignmentBrand: any; +>_propertyAssignmentBrand : any + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + initializer: Expression; +>initializer : Expression +>Expression : Expression + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { +>ShorthandPropertyAssignment : ShorthandPropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + questionToken?: Node; +>questionToken : Node +>Node : Node + } + interface VariableLikeDeclaration extends Declaration { +>VariableLikeDeclaration : VariableLikeDeclaration +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingPattern extends Node { +>BindingPattern : BindingPattern +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>BindingElement : BindingElement + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { +>FunctionLikeDeclaration : FunctionLikeDeclaration +>SignatureDeclaration : SignatureDeclaration + + _functionLikeDeclarationBrand: any; +>_functionLikeDeclarationBrand : any + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + questionToken?: Node; +>questionToken : Node +>Node : Node + + body?: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { +>FunctionDeclaration : FunctionDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>Statement : Statement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + body?: Block; +>body : Block +>Block : Block + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>MethodDeclaration : MethodDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + body?: Block; +>body : Block +>Block : Block + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { +>ConstructorDeclaration : ConstructorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement + + body?: Block; +>body : Block +>Block : Block + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>AccessorDeclaration : AccessorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + _accessorDeclarationBrand: any; +>_accessorDeclarationBrand : any + + body: Block; +>body : Block +>Block : Block + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { +>IndexSignatureDeclaration : IndexSignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>ClassElement : ClassElement + + _indexSignatureDeclarationBrand: any; +>_indexSignatureDeclarationBrand : any + } + interface TypeNode extends Node { +>TypeNode : TypeNode +>Node : Node + + _typeNodeBrand: any; +>_typeNodeBrand : any + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { +>FunctionOrConstructorTypeNode : FunctionOrConstructorTypeNode +>TypeNode : TypeNode +>SignatureDeclaration : SignatureDeclaration + + _functionOrConstructorTypeNodeBrand: any; +>_functionOrConstructorTypeNodeBrand : any + } + interface TypeReferenceNode extends TypeNode { +>TypeReferenceNode : TypeReferenceNode +>TypeNode : TypeNode + + typeName: EntityName; +>typeName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface TypeQueryNode extends TypeNode { +>TypeQueryNode : TypeQueryNode +>TypeNode : TypeNode + + exprName: EntityName; +>exprName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + } + interface TypeLiteralNode extends TypeNode, Declaration { +>TypeLiteralNode : TypeLiteralNode +>TypeNode : TypeNode +>Declaration : Declaration + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Node : Node + } + interface ArrayTypeNode extends TypeNode { +>ArrayTypeNode : ArrayTypeNode +>TypeNode : TypeNode + + elementType: TypeNode; +>elementType : TypeNode +>TypeNode : TypeNode + } + interface TupleTypeNode extends TypeNode { +>TupleTypeNode : TupleTypeNode +>TypeNode : TypeNode + + elementTypes: NodeArray; +>elementTypes : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface UnionTypeNode extends TypeNode { +>UnionTypeNode : UnionTypeNode +>TypeNode : TypeNode + + types: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface ParenthesizedTypeNode extends TypeNode { +>ParenthesizedTypeNode : ParenthesizedTypeNode +>TypeNode : TypeNode + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { +>StringLiteralTypeNode : StringLiteralTypeNode +>LiteralExpression : LiteralExpression +>TypeNode : TypeNode + } + interface Expression extends Node { +>Expression : Expression +>Node : Node + + _expressionBrand: any; +>_expressionBrand : any + + contextualType?: Type; +>contextualType : Type +>Type : Type + } + interface UnaryExpression extends Expression { +>UnaryExpression : UnaryExpression +>Expression : Expression + + _unaryExpressionBrand: any; +>_unaryExpressionBrand : any + } + interface PrefixUnaryExpression extends UnaryExpression { +>PrefixUnaryExpression : PrefixUnaryExpression +>UnaryExpression : UnaryExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + operand: UnaryExpression; +>operand : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface PostfixUnaryExpression extends PostfixExpression { +>PostfixUnaryExpression : PostfixUnaryExpression +>PostfixExpression : PostfixExpression + + operand: LeftHandSideExpression; +>operand : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + } + interface PostfixExpression extends UnaryExpression { +>PostfixExpression : PostfixExpression +>UnaryExpression : UnaryExpression + + _postfixExpressionBrand: any; +>_postfixExpressionBrand : any + } + interface LeftHandSideExpression extends PostfixExpression { +>LeftHandSideExpression : LeftHandSideExpression +>PostfixExpression : PostfixExpression + + _leftHandSideExpressionBrand: any; +>_leftHandSideExpressionBrand : any + } + interface MemberExpression extends LeftHandSideExpression { +>MemberExpression : MemberExpression +>LeftHandSideExpression : LeftHandSideExpression + + _memberExpressionBrand: any; +>_memberExpressionBrand : any + } + interface PrimaryExpression extends MemberExpression { +>PrimaryExpression : PrimaryExpression +>MemberExpression : MemberExpression + + _primaryExpressionBrand: any; +>_primaryExpressionBrand : any + } + interface DeleteExpression extends UnaryExpression { +>DeleteExpression : DeleteExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface TypeOfExpression extends UnaryExpression { +>TypeOfExpression : TypeOfExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface VoidExpression extends UnaryExpression { +>VoidExpression : VoidExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface YieldExpression extends Expression { +>YieldExpression : YieldExpression +>Expression : Expression + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BinaryExpression extends Expression { +>BinaryExpression : BinaryExpression +>Expression : Expression + + left: Expression; +>left : Expression +>Expression : Expression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + right: Expression; +>right : Expression +>Expression : Expression + } + interface ConditionalExpression extends Expression { +>ConditionalExpression : ConditionalExpression +>Expression : Expression + + condition: Expression; +>condition : Expression +>Expression : Expression + + whenTrue: Expression; +>whenTrue : Expression +>Expression : Expression + + whenFalse: Expression; +>whenFalse : Expression +>Expression : Expression + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { +>FunctionExpression : FunctionExpression +>PrimaryExpression : PrimaryExpression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface LiteralExpression extends PrimaryExpression { +>LiteralExpression : LiteralExpression +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + + isUnterminated?: boolean; +>isUnterminated : boolean + } + interface StringLiteralExpression extends LiteralExpression { +>StringLiteralExpression : StringLiteralExpression +>LiteralExpression : LiteralExpression + + _stringLiteralExpressionBrand: any; +>_stringLiteralExpressionBrand : any + } + interface TemplateExpression extends PrimaryExpression { +>TemplateExpression : TemplateExpression +>PrimaryExpression : PrimaryExpression + + head: LiteralExpression; +>head : LiteralExpression +>LiteralExpression : LiteralExpression + + templateSpans: NodeArray; +>templateSpans : NodeArray +>NodeArray : NodeArray +>TemplateSpan : TemplateSpan + } + interface TemplateSpan extends Node { +>TemplateSpan : TemplateSpan +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + + literal: LiteralExpression; +>literal : LiteralExpression +>LiteralExpression : LiteralExpression + } + interface ParenthesizedExpression extends PrimaryExpression { +>ParenthesizedExpression : ParenthesizedExpression +>PrimaryExpression : PrimaryExpression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ArrayLiteralExpression extends PrimaryExpression { +>ArrayLiteralExpression : ArrayLiteralExpression +>PrimaryExpression : PrimaryExpression + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface SpreadElementExpression extends Expression { +>SpreadElementExpression : SpreadElementExpression +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { +>ObjectLiteralExpression : ObjectLiteralExpression +>PrimaryExpression : PrimaryExpression +>Declaration : Declaration + + properties: NodeArray; +>properties : NodeArray +>NodeArray : NodeArray +>ObjectLiteralElement : ObjectLiteralElement + } + interface PropertyAccessExpression extends MemberExpression { +>PropertyAccessExpression : PropertyAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ElementAccessExpression extends MemberExpression { +>ElementAccessExpression : ElementAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + argumentExpression?: Expression; +>argumentExpression : Expression +>Expression : Expression + } + interface CallExpression extends LeftHandSideExpression { +>CallExpression : CallExpression +>LeftHandSideExpression : LeftHandSideExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + + arguments: NodeArray; +>arguments : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface NewExpression extends CallExpression, PrimaryExpression { +>NewExpression : NewExpression +>CallExpression : CallExpression +>PrimaryExpression : PrimaryExpression + } + interface TaggedTemplateExpression extends MemberExpression { +>TaggedTemplateExpression : TaggedTemplateExpression +>MemberExpression : MemberExpression + + tag: LeftHandSideExpression; +>tag : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + template: LiteralExpression | TemplateExpression; +>template : LiteralExpression | TemplateExpression +>LiteralExpression : LiteralExpression +>TemplateExpression : TemplateExpression + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>CallExpression : CallExpression +>NewExpression : NewExpression +>TaggedTemplateExpression : TaggedTemplateExpression + + interface TypeAssertion extends UnaryExpression { +>TypeAssertion : TypeAssertion +>UnaryExpression : UnaryExpression + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface Statement extends Node, ModuleElement { +>Statement : Statement +>Node : Node +>ModuleElement : ModuleElement + + _statementBrand: any; +>_statementBrand : any + } + interface Block extends Statement { +>Block : Block +>Statement : Statement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface VariableStatement extends Statement { +>VariableStatement : VariableStatement +>Statement : Statement + + declarationList: VariableDeclarationList; +>declarationList : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + } + interface ExpressionStatement extends Statement { +>ExpressionStatement : ExpressionStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface IfStatement extends Statement { +>IfStatement : IfStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + thenStatement: Statement; +>thenStatement : Statement +>Statement : Statement + + elseStatement?: Statement; +>elseStatement : Statement +>Statement : Statement + } + interface IterationStatement extends Statement { +>IterationStatement : IterationStatement +>Statement : Statement + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface DoStatement extends IterationStatement { +>DoStatement : DoStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface WhileStatement extends IterationStatement { +>WhileStatement : WhileStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForStatement extends IterationStatement { +>ForStatement : ForStatement +>IterationStatement : IterationStatement + + initializer?: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + condition?: Expression; +>condition : Expression +>Expression : Expression + + iterator?: Expression; +>iterator : Expression +>Expression : Expression + } + interface ForInStatement extends IterationStatement { +>ForInStatement : ForInStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BreakOrContinueStatement extends Statement { +>BreakOrContinueStatement : BreakOrContinueStatement +>Statement : Statement + + label?: Identifier; +>label : Identifier +>Identifier : Identifier + } + interface ReturnStatement extends Statement { +>ReturnStatement : ReturnStatement +>Statement : Statement + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface WithStatement extends Statement { +>WithStatement : WithStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface SwitchStatement extends Statement { +>SwitchStatement : SwitchStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + clauses: NodeArray; +>clauses : NodeArray +>NodeArray : NodeArray +>CaseOrDefaultClause : CaseClause | DefaultClause + } + interface CaseClause extends Node { +>CaseClause : CaseClause +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface DefaultClause extends Node { +>DefaultClause : DefaultClause +>Node : Node + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + type CaseOrDefaultClause = CaseClause | DefaultClause; +>CaseOrDefaultClause : CaseClause | DefaultClause +>CaseClause : CaseClause +>DefaultClause : DefaultClause + + interface LabeledStatement extends Statement { +>LabeledStatement : LabeledStatement +>Statement : Statement + + label: Identifier; +>label : Identifier +>Identifier : Identifier + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface ThrowStatement extends Statement { +>ThrowStatement : ThrowStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TryStatement extends Statement { +>TryStatement : TryStatement +>Statement : Statement + + tryBlock: Block; +>tryBlock : Block +>Block : Block + + catchClause?: CatchClause; +>catchClause : CatchClause +>CatchClause : CatchClause + + finallyBlock?: Block; +>finallyBlock : Block +>Block : Block + } + interface CatchClause extends Declaration { +>CatchClause : CatchClause +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + block: Block; +>block : Block +>Block : Block + } + interface ModuleElement extends Node { +>ModuleElement : ModuleElement +>Node : Node + + _moduleElementBrand: any; +>_moduleElementBrand : any + } + interface ClassDeclaration extends Declaration, ModuleElement { +>ClassDeclaration : ClassDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>ClassElement : ClassElement + } + interface ClassElement extends Declaration { +>ClassElement : ClassElement +>Declaration : Declaration + + _classElementBrand: any; +>_classElementBrand : any + } + interface InterfaceDeclaration extends Declaration, ModuleElement { +>InterfaceDeclaration : InterfaceDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Declaration : Declaration + } + interface HeritageClause extends Node { +>HeritageClause : HeritageClause +>Node : Node + + token: SyntaxKind; +>token : SyntaxKind +>SyntaxKind : SyntaxKind + + types?: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeReferenceNode : TypeReferenceNode + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { +>TypeAliasDeclaration : TypeAliasDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface EnumMember extends Declaration { +>EnumMember : EnumMember +>Declaration : Declaration + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface EnumDeclaration extends Declaration, ModuleElement { +>EnumDeclaration : EnumDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>EnumMember : EnumMember + } + interface ModuleDeclaration extends Declaration, ModuleElement { +>ModuleDeclaration : ModuleDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier | LiteralExpression; +>name : Identifier | LiteralExpression +>Identifier : Identifier +>LiteralExpression : LiteralExpression + + body: ModuleBlock | ModuleDeclaration; +>body : ModuleDeclaration | ModuleBlock +>ModuleBlock : ModuleBlock +>ModuleDeclaration : ModuleDeclaration + } + interface ModuleBlock extends Node, ModuleElement { +>ModuleBlock : ModuleBlock +>Node : Node +>ModuleElement : ModuleElement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + } + interface ImportDeclaration extends Declaration, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + moduleReference: EntityName | ExternalModuleReference; +>moduleReference : Identifier | QualifiedName | ExternalModuleReference +>EntityName : Identifier | QualifiedName +>ExternalModuleReference : ExternalModuleReference + } + interface ExternalModuleReference extends Node { +>ExternalModuleReference : ExternalModuleReference +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface ExportAssignment extends Statement, ModuleElement { +>ExportAssignment : ExportAssignment +>Statement : Statement +>ModuleElement : ModuleElement + + exportName: Identifier; +>exportName : Identifier +>Identifier : Identifier + } + interface FileReference extends TextRange { +>FileReference : FileReference +>TextRange : TextRange + + fileName: string; +>fileName : string + } + interface CommentRange extends TextRange { +>CommentRange : CommentRange +>TextRange : TextRange + + hasTrailingNewLine?: boolean; +>hasTrailingNewLine : boolean + } + interface SourceFile extends Declaration { +>SourceFile : SourceFile +>Declaration : Declaration + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + + endOfFileToken: Node; +>endOfFileToken : Node +>Node : Node + + fileName: string; +>fileName : string + + text: string; +>text : string + + amdDependencies: string[]; +>amdDependencies : string[] + + amdModuleName: string; +>amdModuleName : string + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + hasNoDefaultLib: boolean; +>hasNoDefaultLib : boolean + + externalModuleIndicator: Node; +>externalModuleIndicator : Node +>Node : Node + + languageVersion: ScriptTarget; +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + identifiers: Map; +>identifiers : Map +>Map : Map + } + interface ScriptReferenceHost { +>ScriptReferenceHost : ScriptReferenceHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + } + interface WriteFileCallback { +>WriteFileCallback : WriteFileCallback + + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>fileName : string +>data : string +>writeByteOrderMark : boolean +>onError : (message: string) => void +>message : string + } + interface Program extends ScriptReferenceHost { +>Program : Program +>ScriptReferenceHost : ScriptReferenceHost + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; +>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult +>targetSourceFile : SourceFile +>SourceFile : SourceFile +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback +>EmitResult : EmitResult + + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSyntacticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getGlobalDiagnostics(): Diagnostic[]; +>getGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSemanticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getDeclarationDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeChecker(): TypeChecker; +>getTypeChecker : () => TypeChecker +>TypeChecker : TypeChecker + + getCommonSourceDirectory(): string; +>getCommonSourceDirectory : () => string + } + interface SourceMapSpan { +>SourceMapSpan : SourceMapSpan + + emittedLine: number; +>emittedLine : number + + emittedColumn: number; +>emittedColumn : number + + sourceLine: number; +>sourceLine : number + + sourceColumn: number; +>sourceColumn : number + + nameIndex?: number; +>nameIndex : number + + sourceIndex: number; +>sourceIndex : number + } + interface SourceMapData { +>SourceMapData : SourceMapData + + sourceMapFilePath: string; +>sourceMapFilePath : string + + jsSourceMappingURL: string; +>jsSourceMappingURL : string + + sourceMapFile: string; +>sourceMapFile : string + + sourceMapSourceRoot: string; +>sourceMapSourceRoot : string + + sourceMapSources: string[]; +>sourceMapSources : string[] + + inputSourceFileNames: string[]; +>inputSourceFileNames : string[] + + sourceMapNames?: string[]; +>sourceMapNames : string[] + + sourceMapMappings: string; +>sourceMapMappings : string + + sourceMapDecodedMappings: SourceMapSpan[]; +>sourceMapDecodedMappings : SourceMapSpan[] +>SourceMapSpan : SourceMapSpan + } + enum ExitStatus { +>ExitStatus : ExitStatus + + Success = 0, +>Success : ExitStatus + + DiagnosticsPresent_OutputsSkipped = 1, +>DiagnosticsPresent_OutputsSkipped : ExitStatus + + DiagnosticsPresent_OutputsGenerated = 2, +>DiagnosticsPresent_OutputsGenerated : ExitStatus + } + interface EmitResult { +>EmitResult : EmitResult + + emitSkipped: boolean; +>emitSkipped : boolean + + diagnostics: Diagnostic[]; +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + + sourceMaps: SourceMapData[]; +>sourceMaps : SourceMapData[] +>SourceMapData : SourceMapData + } + interface TypeCheckerHost { +>TypeCheckerHost : TypeCheckerHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + } + interface TypeChecker { +>TypeChecker : TypeChecker + + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; +>getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type +>symbol : Symbol +>Symbol : Symbol +>node : Node +>Node : Node +>Type : Type + + getDeclaredTypeOfSymbol(symbol: Symbol): Type; +>getDeclaredTypeOfSymbol : (symbol: Symbol) => Type +>symbol : Symbol +>Symbol : Symbol +>Type : Type + + getPropertiesOfType(type: Type): Symbol[]; +>getPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getPropertyOfType(type: Type, propertyName: string): Symbol; +>getPropertyOfType : (type: Type, propertyName: string) => Symbol +>type : Type +>Type : Type +>propertyName : string +>Symbol : Symbol + + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; +>getSignaturesOfType : (type: Type, kind: SignatureKind) => Signature[] +>type : Type +>Type : Type +>kind : SignatureKind +>SignatureKind : SignatureKind +>Signature : Signature + + getIndexTypeOfType(type: Type, kind: IndexKind): Type; +>getIndexTypeOfType : (type: Type, kind: IndexKind) => Type +>type : Type +>Type : Type +>kind : IndexKind +>IndexKind : IndexKind +>Type : Type + + getReturnTypeOfSignature(signature: Signature): Type; +>getReturnTypeOfSignature : (signature: Signature) => Type +>signature : Signature +>Signature : Signature +>Type : Type + + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; +>getSymbolsInScope : (location: Node, meaning: SymbolFlags) => Symbol[] +>location : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>Symbol : Symbol + + getSymbolAtLocation(node: Node): Symbol; +>getSymbolAtLocation : (node: Node) => Symbol +>node : Node +>Node : Node +>Symbol : Symbol + + getShorthandAssignmentValueSymbol(location: Node): Symbol; +>getShorthandAssignmentValueSymbol : (location: Node) => Symbol +>location : Node +>Node : Node +>Symbol : Symbol + + getTypeAtLocation(node: Node): Type; +>getTypeAtLocation : (node: Node) => Type +>node : Node +>Node : Node +>Type : Type + + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; +>typeToString : (type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => string +>type : Type +>Type : Type +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; +>symbolToString : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => string +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + + getSymbolDisplayBuilder(): SymbolDisplayBuilder; +>getSymbolDisplayBuilder : () => SymbolDisplayBuilder +>SymbolDisplayBuilder : SymbolDisplayBuilder + + getFullyQualifiedName(symbol: Symbol): string; +>getFullyQualifiedName : (symbol: Symbol) => string +>symbol : Symbol +>Symbol : Symbol + + getAugmentedPropertiesOfType(type: Type): Symbol[]; +>getAugmentedPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getRootSymbols(symbol: Symbol): Symbol[]; +>getRootSymbols : (symbol: Symbol) => Symbol[] +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getContextualType(node: Expression): Type; +>getContextualType : (node: Expression) => Type +>node : Expression +>Expression : Expression +>Type : Type + + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; +>getResolvedSignature : (node: CallExpression | NewExpression | TaggedTemplateExpression, candidatesOutArray?: Signature[]) => Signature +>node : CallExpression | NewExpression | TaggedTemplateExpression +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>candidatesOutArray : Signature[] +>Signature : Signature +>Signature : Signature + + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; +>getSignatureFromDeclaration : (declaration: SignatureDeclaration) => Signature +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>Signature : Signature + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + isUndefinedSymbol(symbol: Symbol): boolean; +>isUndefinedSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + isArgumentsSymbol(symbol: Symbol): boolean; +>isArgumentsSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; +>isValidPropertyAccess : (node: QualifiedName | PropertyAccessExpression, propertyName: string) => boolean +>node : QualifiedName | PropertyAccessExpression +>PropertyAccessExpression : PropertyAccessExpression +>QualifiedName : QualifiedName +>propertyName : string + + getAliasedSymbol(symbol: Symbol): Symbol; +>getAliasedSymbol : (symbol: Symbol) => Symbol +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + } + interface SymbolDisplayBuilder { +>SymbolDisplayBuilder : SymbolDisplayBuilder + + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeDisplay : (type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>type : Type +>Type : Type +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; +>buildSymbolDisplay : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>flags : SymbolFormatFlags +>SymbolFormatFlags : SymbolFormatFlags + + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildSignatureDisplay : (signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signatures : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildParameterDisplay : (parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameter : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplay : (tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>tp : TypeParameter +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplayFromSymbol : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaraiton : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForParametersAndDelimiters : (parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameters : Symbol[] +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForTypeParametersAndDelimiters : (typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildReturnTypeDisplay : (signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signature : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + } + interface SymbolWriter { +>SymbolWriter : SymbolWriter + + writeKeyword(text: string): void; +>writeKeyword : (text: string) => void +>text : string + + writeOperator(text: string): void; +>writeOperator : (text: string) => void +>text : string + + writePunctuation(text: string): void; +>writePunctuation : (text: string) => void +>text : string + + writeSpace(text: string): void; +>writeSpace : (text: string) => void +>text : string + + writeStringLiteral(text: string): void; +>writeStringLiteral : (text: string) => void +>text : string + + writeParameter(text: string): void; +>writeParameter : (text: string) => void +>text : string + + writeSymbol(text: string, symbol: Symbol): void; +>writeSymbol : (text: string, symbol: Symbol) => void +>text : string +>symbol : Symbol +>Symbol : Symbol + + writeLine(): void; +>writeLine : () => void + + increaseIndent(): void; +>increaseIndent : () => void + + decreaseIndent(): void; +>decreaseIndent : () => void + + clear(): void; +>clear : () => void + + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; +>trackSymbol : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => void +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + } + const enum TypeFormatFlags { +>TypeFormatFlags : TypeFormatFlags + + None = 0, +>None : TypeFormatFlags + + WriteArrayAsGenericType = 1, +>WriteArrayAsGenericType : TypeFormatFlags + + UseTypeOfFunction = 2, +>UseTypeOfFunction : TypeFormatFlags + + NoTruncation = 4, +>NoTruncation : TypeFormatFlags + + WriteArrowStyleSignature = 8, +>WriteArrowStyleSignature : TypeFormatFlags + + WriteOwnNameForAnyLike = 16, +>WriteOwnNameForAnyLike : TypeFormatFlags + + WriteTypeArgumentsOfSignature = 32, +>WriteTypeArgumentsOfSignature : TypeFormatFlags + + InElementType = 64, +>InElementType : TypeFormatFlags + + UseFullyQualifiedType = 128, +>UseFullyQualifiedType : TypeFormatFlags + } + const enum SymbolFormatFlags { +>SymbolFormatFlags : SymbolFormatFlags + + None = 0, +>None : SymbolFormatFlags + + WriteTypeParametersOrArguments = 1, +>WriteTypeParametersOrArguments : SymbolFormatFlags + + UseOnlyExternalAliasing = 2, +>UseOnlyExternalAliasing : SymbolFormatFlags + } + const enum SymbolAccessibility { +>SymbolAccessibility : SymbolAccessibility + + Accessible = 0, +>Accessible : SymbolAccessibility + + NotAccessible = 1, +>NotAccessible : SymbolAccessibility + + CannotBeNamed = 2, +>CannotBeNamed : SymbolAccessibility + } + interface SymbolVisibilityResult { +>SymbolVisibilityResult : SymbolVisibilityResult + + accessibility: SymbolAccessibility; +>accessibility : SymbolAccessibility +>SymbolAccessibility : SymbolAccessibility + + aliasesToMakeVisible?: ImportDeclaration[]; +>aliasesToMakeVisible : ImportDeclaration[] +>ImportDeclaration : ImportDeclaration + + errorSymbolName?: string; +>errorSymbolName : string + + errorNode?: Node; +>errorNode : Node +>Node : Node + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { +>SymbolAccessiblityResult : SymbolAccessiblityResult +>SymbolVisibilityResult : SymbolVisibilityResult + + errorModuleName?: string; +>errorModuleName : string + } + interface EmitResolver { +>EmitResolver : EmitResolver + + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; +>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string +>container : EnumDeclaration | ModuleDeclaration +>ModuleDeclaration : ModuleDeclaration +>EnumDeclaration : EnumDeclaration + + getExpressionNamePrefix(node: Identifier): string; +>getExpressionNamePrefix : (node: Identifier) => string +>node : Identifier +>Identifier : Identifier + + getExportAssignmentName(node: SourceFile): string; +>getExportAssignmentName : (node: SourceFile) => string +>node : SourceFile +>SourceFile : SourceFile + + isReferencedImportDeclaration(node: ImportDeclaration): boolean; +>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; +>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + getNodeCheckFlags(node: Node): NodeCheckFlags; +>getNodeCheckFlags : (node: Node) => NodeCheckFlags +>node : Node +>Node : Node +>NodeCheckFlags : NodeCheckFlags + + isDeclarationVisible(node: Declaration): boolean; +>isDeclarationVisible : (node: Declaration) => boolean +>node : Declaration +>Declaration : Declaration + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfDeclaration : (declaration: VariableLikeDeclaration | AccessorDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>declaration : VariableLikeDeclaration | AccessorDeclaration +>AccessorDeclaration : AccessorDeclaration +>VariableLikeDeclaration : VariableLikeDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>signatureDeclaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; +>isSymbolAccessible : (symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) => SymbolAccessiblityResult +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>SymbolAccessiblityResult : SymbolAccessiblityResult + + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName +>enclosingDeclaration : Node +>Node : Node +>SymbolVisibilityResult : SymbolVisibilityResult + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean +>location : Node +>Node : Node +>name : string + } + const enum SymbolFlags { +>SymbolFlags : SymbolFlags + + FunctionScopedVariable = 1, +>FunctionScopedVariable : SymbolFlags + + BlockScopedVariable = 2, +>BlockScopedVariable : SymbolFlags + + Property = 4, +>Property : SymbolFlags + + EnumMember = 8, +>EnumMember : SymbolFlags + + Function = 16, +>Function : SymbolFlags + + Class = 32, +>Class : SymbolFlags + + Interface = 64, +>Interface : SymbolFlags + + ConstEnum = 128, +>ConstEnum : SymbolFlags + + RegularEnum = 256, +>RegularEnum : SymbolFlags + + ValueModule = 512, +>ValueModule : SymbolFlags + + NamespaceModule = 1024, +>NamespaceModule : SymbolFlags + + TypeLiteral = 2048, +>TypeLiteral : SymbolFlags + + ObjectLiteral = 4096, +>ObjectLiteral : SymbolFlags + + Method = 8192, +>Method : SymbolFlags + + Constructor = 16384, +>Constructor : SymbolFlags + + GetAccessor = 32768, +>GetAccessor : SymbolFlags + + SetAccessor = 65536, +>SetAccessor : SymbolFlags + + Signature = 131072, +>Signature : SymbolFlags + + TypeParameter = 262144, +>TypeParameter : SymbolFlags + + TypeAlias = 524288, +>TypeAlias : SymbolFlags + + ExportValue = 1048576, +>ExportValue : SymbolFlags + + ExportType = 2097152, +>ExportType : SymbolFlags + + ExportNamespace = 4194304, +>ExportNamespace : SymbolFlags + + Import = 8388608, +>Import : SymbolFlags + + Instantiated = 16777216, +>Instantiated : SymbolFlags + + Merged = 33554432, +>Merged : SymbolFlags + + Transient = 67108864, +>Transient : SymbolFlags + + Prototype = 134217728, +>Prototype : SymbolFlags + + UnionProperty = 268435456, +>UnionProperty : SymbolFlags + + Optional = 536870912, +>Optional : SymbolFlags + + Enum = 384, +>Enum : SymbolFlags + + Variable = 3, +>Variable : SymbolFlags + + Value = 107455, +>Value : SymbolFlags + + Type = 793056, +>Type : SymbolFlags + + Namespace = 1536, +>Namespace : SymbolFlags + + Module = 1536, +>Module : SymbolFlags + + Accessor = 98304, +>Accessor : SymbolFlags + + FunctionScopedVariableExcludes = 107454, +>FunctionScopedVariableExcludes : SymbolFlags + + BlockScopedVariableExcludes = 107455, +>BlockScopedVariableExcludes : SymbolFlags + + ParameterExcludes = 107455, +>ParameterExcludes : SymbolFlags + + PropertyExcludes = 107455, +>PropertyExcludes : SymbolFlags + + EnumMemberExcludes = 107455, +>EnumMemberExcludes : SymbolFlags + + FunctionExcludes = 106927, +>FunctionExcludes : SymbolFlags + + ClassExcludes = 899583, +>ClassExcludes : SymbolFlags + + InterfaceExcludes = 792992, +>InterfaceExcludes : SymbolFlags + + RegularEnumExcludes = 899327, +>RegularEnumExcludes : SymbolFlags + + ConstEnumExcludes = 899967, +>ConstEnumExcludes : SymbolFlags + + ValueModuleExcludes = 106639, +>ValueModuleExcludes : SymbolFlags + + NamespaceModuleExcludes = 0, +>NamespaceModuleExcludes : SymbolFlags + + MethodExcludes = 99263, +>MethodExcludes : SymbolFlags + + GetAccessorExcludes = 41919, +>GetAccessorExcludes : SymbolFlags + + SetAccessorExcludes = 74687, +>SetAccessorExcludes : SymbolFlags + + TypeParameterExcludes = 530912, +>TypeParameterExcludes : SymbolFlags + + TypeAliasExcludes = 793056, +>TypeAliasExcludes : SymbolFlags + + ImportExcludes = 8388608, +>ImportExcludes : SymbolFlags + + ModuleMember = 8914931, +>ModuleMember : SymbolFlags + + ExportHasLocal = 944, +>ExportHasLocal : SymbolFlags + + HasLocals = 255504, +>HasLocals : SymbolFlags + + HasExports = 1952, +>HasExports : SymbolFlags + + HasMembers = 6240, +>HasMembers : SymbolFlags + + IsContainer = 262128, +>IsContainer : SymbolFlags + + PropertyOrAccessor = 98308, +>PropertyOrAccessor : SymbolFlags + + Export = 7340032, +>Export : SymbolFlags + } + interface Symbol { +>Symbol : Symbol + + flags: SymbolFlags; +>flags : SymbolFlags +>SymbolFlags : SymbolFlags + + name: string; +>name : string + + id?: number; +>id : number + + mergeId?: number; +>mergeId : number + + declarations?: Declaration[]; +>declarations : Declaration[] +>Declaration : Declaration + + parent?: Symbol; +>parent : Symbol +>Symbol : Symbol + + members?: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + exports?: SymbolTable; +>exports : SymbolTable +>SymbolTable : SymbolTable + + exportSymbol?: Symbol; +>exportSymbol : Symbol +>Symbol : Symbol + + valueDeclaration?: Declaration; +>valueDeclaration : Declaration +>Declaration : Declaration + + constEnumOnlyModule?: boolean; +>constEnumOnlyModule : boolean + } + interface SymbolLinks { +>SymbolLinks : SymbolLinks + + target?: Symbol; +>target : Symbol +>Symbol : Symbol + + type?: Type; +>type : Type +>Type : Type + + declaredType?: Type; +>declaredType : Type +>Type : Type + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + referenced?: boolean; +>referenced : boolean + + exportAssignSymbol?: Symbol; +>exportAssignSymbol : Symbol +>Symbol : Symbol + + unionType?: UnionType; +>unionType : UnionType +>UnionType : UnionType + } + interface TransientSymbol extends Symbol, SymbolLinks { +>TransientSymbol : TransientSymbol +>Symbol : Symbol +>SymbolLinks : SymbolLinks + } + interface SymbolTable { +>SymbolTable : SymbolTable + + [index: string]: Symbol; +>index : string +>Symbol : Symbol + } + const enum NodeCheckFlags { +>NodeCheckFlags : NodeCheckFlags + + TypeChecked = 1, +>TypeChecked : NodeCheckFlags + + LexicalThis = 2, +>LexicalThis : NodeCheckFlags + + CaptureThis = 4, +>CaptureThis : NodeCheckFlags + + EmitExtends = 8, +>EmitExtends : NodeCheckFlags + + SuperInstance = 16, +>SuperInstance : NodeCheckFlags + + SuperStatic = 32, +>SuperStatic : NodeCheckFlags + + ContextChecked = 64, +>ContextChecked : NodeCheckFlags + + EnumValuesComputed = 128, +>EnumValuesComputed : NodeCheckFlags + } + interface NodeLinks { +>NodeLinks : NodeLinks + + resolvedType?: Type; +>resolvedType : Type +>Type : Type + + resolvedSignature?: Signature; +>resolvedSignature : Signature +>Signature : Signature + + resolvedSymbol?: Symbol; +>resolvedSymbol : Symbol +>Symbol : Symbol + + flags?: NodeCheckFlags; +>flags : NodeCheckFlags +>NodeCheckFlags : NodeCheckFlags + + enumMemberValue?: number; +>enumMemberValue : number + + isIllegalTypeReferenceInConstraint?: boolean; +>isIllegalTypeReferenceInConstraint : boolean + + isVisible?: boolean; +>isVisible : boolean + + localModuleName?: string; +>localModuleName : string + + assignmentChecks?: Map; +>assignmentChecks : Map +>Map : Map + + hasReportedStatementInAmbientContext?: boolean; +>hasReportedStatementInAmbientContext : boolean + + importOnRightSide?: Symbol; +>importOnRightSide : Symbol +>Symbol : Symbol + } + const enum TypeFlags { +>TypeFlags : TypeFlags + + Any = 1, +>Any : TypeFlags + + String = 2, +>String : TypeFlags + + Number = 4, +>Number : TypeFlags + + Boolean = 8, +>Boolean : TypeFlags + + Void = 16, +>Void : TypeFlags + + Undefined = 32, +>Undefined : TypeFlags + + Null = 64, +>Null : TypeFlags + + Enum = 128, +>Enum : TypeFlags + + StringLiteral = 256, +>StringLiteral : TypeFlags + + TypeParameter = 512, +>TypeParameter : TypeFlags + + Class = 1024, +>Class : TypeFlags + + Interface = 2048, +>Interface : TypeFlags + + Reference = 4096, +>Reference : TypeFlags + + Tuple = 8192, +>Tuple : TypeFlags + + Union = 16384, +>Union : TypeFlags + + Anonymous = 32768, +>Anonymous : TypeFlags + + FromSignature = 65536, +>FromSignature : TypeFlags + + ObjectLiteral = 131072, +>ObjectLiteral : TypeFlags + + ContainsUndefinedOrNull = 262144, +>ContainsUndefinedOrNull : TypeFlags + + ContainsObjectLiteral = 524288, +>ContainsObjectLiteral : TypeFlags + + Intrinsic = 127, +>Intrinsic : TypeFlags + + Primitive = 510, +>Primitive : TypeFlags + + StringLike = 258, +>StringLike : TypeFlags + + NumberLike = 132, +>NumberLike : TypeFlags + + ObjectType = 48128, +>ObjectType : TypeFlags + + RequiresWidening = 786432, +>RequiresWidening : TypeFlags + } + interface Type { +>Type : Type + + flags: TypeFlags; +>flags : TypeFlags +>TypeFlags : TypeFlags + + id: number; +>id : number + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + } + interface IntrinsicType extends Type { +>IntrinsicType : IntrinsicType +>Type : Type + + intrinsicName: string; +>intrinsicName : string + } + interface StringLiteralType extends Type { +>StringLiteralType : StringLiteralType +>Type : Type + + text: string; +>text : string + } + interface ObjectType extends Type { +>ObjectType : ObjectType +>Type : Type + } + interface InterfaceType extends ObjectType { +>InterfaceType : InterfaceType +>ObjectType : ObjectType + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + baseTypes: ObjectType[]; +>baseTypes : ObjectType[] +>ObjectType : ObjectType + + declaredProperties: Symbol[]; +>declaredProperties : Symbol[] +>Symbol : Symbol + + declaredCallSignatures: Signature[]; +>declaredCallSignatures : Signature[] +>Signature : Signature + + declaredConstructSignatures: Signature[]; +>declaredConstructSignatures : Signature[] +>Signature : Signature + + declaredStringIndexType: Type; +>declaredStringIndexType : Type +>Type : Type + + declaredNumberIndexType: Type; +>declaredNumberIndexType : Type +>Type : Type + } + interface TypeReference extends ObjectType { +>TypeReference : TypeReference +>ObjectType : ObjectType + + target: GenericType; +>target : GenericType +>GenericType : GenericType + + typeArguments: Type[]; +>typeArguments : Type[] +>Type : Type + } + interface GenericType extends InterfaceType, TypeReference { +>GenericType : GenericType +>InterfaceType : InterfaceType +>TypeReference : TypeReference + + instantiations: Map; +>instantiations : Map +>Map : Map +>TypeReference : TypeReference + } + interface TupleType extends ObjectType { +>TupleType : TupleType +>ObjectType : ObjectType + + elementTypes: Type[]; +>elementTypes : Type[] +>Type : Type + + baseArrayType: TypeReference; +>baseArrayType : TypeReference +>TypeReference : TypeReference + } + interface UnionType extends Type { +>UnionType : UnionType +>Type : Type + + types: Type[]; +>types : Type[] +>Type : Type + + resolvedProperties: SymbolTable; +>resolvedProperties : SymbolTable +>SymbolTable : SymbolTable + } + interface ResolvedType extends ObjectType, UnionType { +>ResolvedType : ResolvedType +>ObjectType : ObjectType +>UnionType : UnionType + + members: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + properties: Symbol[]; +>properties : Symbol[] +>Symbol : Symbol + + callSignatures: Signature[]; +>callSignatures : Signature[] +>Signature : Signature + + constructSignatures: Signature[]; +>constructSignatures : Signature[] +>Signature : Signature + + stringIndexType: Type; +>stringIndexType : Type +>Type : Type + + numberIndexType: Type; +>numberIndexType : Type +>Type : Type + } + interface TypeParameter extends Type { +>TypeParameter : TypeParameter +>Type : Type + + constraint: Type; +>constraint : Type +>Type : Type + + target?: TypeParameter; +>target : TypeParameter +>TypeParameter : TypeParameter + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + } + const enum SignatureKind { +>SignatureKind : SignatureKind + + Call = 0, +>Call : SignatureKind + + Construct = 1, +>Construct : SignatureKind + } + interface Signature { +>Signature : Signature + + declaration: SignatureDeclaration; +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + parameters: Symbol[]; +>parameters : Symbol[] +>Symbol : Symbol + + resolvedReturnType: Type; +>resolvedReturnType : Type +>Type : Type + + minArgumentCount: number; +>minArgumentCount : number + + hasRestParameter: boolean; +>hasRestParameter : boolean + + hasStringLiterals: boolean; +>hasStringLiterals : boolean + + target?: Signature; +>target : Signature +>Signature : Signature + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + unionSignatures?: Signature[]; +>unionSignatures : Signature[] +>Signature : Signature + + erasedSignatureCache?: Signature; +>erasedSignatureCache : Signature +>Signature : Signature + + isolatedSignatureType?: ObjectType; +>isolatedSignatureType : ObjectType +>ObjectType : ObjectType + } + const enum IndexKind { +>IndexKind : IndexKind + + String = 0, +>String : IndexKind + + Number = 1, +>Number : IndexKind + } + interface TypeMapper { +>TypeMapper : TypeMapper + + (t: Type): Type; +>t : Type +>Type : Type +>Type : Type + } + interface TypeInferences { +>TypeInferences : TypeInferences + + primary: Type[]; +>primary : Type[] +>Type : Type + + secondary: Type[]; +>secondary : Type[] +>Type : Type + } + interface InferenceContext { +>InferenceContext : InferenceContext + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + inferUnionTypes: boolean; +>inferUnionTypes : boolean + + inferences: TypeInferences[]; +>inferences : TypeInferences[] +>TypeInferences : TypeInferences + + inferredTypes: Type[]; +>inferredTypes : Type[] +>Type : Type + + failedTypeParameterIndex?: number; +>failedTypeParameterIndex : number + } + interface DiagnosticMessage { +>DiagnosticMessage : DiagnosticMessage + + key: string; +>key : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + interface DiagnosticMessageChain { +>DiagnosticMessageChain : DiagnosticMessageChain + + messageText: string; +>messageText : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + + next?: DiagnosticMessageChain; +>next : DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + } + interface Diagnostic { +>Diagnostic : Diagnostic + + file: SourceFile; +>file : SourceFile +>SourceFile : SourceFile + + start: number; +>start : number + + length: number; +>length : number + + messageText: string | DiagnosticMessageChain; +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = 0, +>Warning : DiagnosticCategory + + Error = 1, +>Error : DiagnosticCategory + + Message = 2, +>Message : DiagnosticCategory + } + interface CompilerOptions { +>CompilerOptions : CompilerOptions + + allowNonTsExtensions?: boolean; +>allowNonTsExtensions : boolean + + charset?: string; +>charset : string + + codepage?: number; +>codepage : number + + declaration?: boolean; +>declaration : boolean + + diagnostics?: boolean; +>diagnostics : boolean + + emitBOM?: boolean; +>emitBOM : boolean + + help?: boolean; +>help : boolean + + listFiles?: boolean; +>listFiles : boolean + + locale?: string; +>locale : string + + mapRoot?: string; +>mapRoot : string + + module?: ModuleKind; +>module : ModuleKind +>ModuleKind : ModuleKind + + noEmit?: boolean; +>noEmit : boolean + + noEmitOnError?: boolean; +>noEmitOnError : boolean + + noErrorTruncation?: boolean; +>noErrorTruncation : boolean + + noImplicitAny?: boolean; +>noImplicitAny : boolean + + noLib?: boolean; +>noLib : boolean + + noLibCheck?: boolean; +>noLibCheck : boolean + + noResolve?: boolean; +>noResolve : boolean + + out?: string; +>out : string + + outDir?: string; +>outDir : string + + preserveConstEnums?: boolean; +>preserveConstEnums : boolean + + project?: string; +>project : string + + removeComments?: boolean; +>removeComments : boolean + + sourceMap?: boolean; +>sourceMap : boolean + + sourceRoot?: string; +>sourceRoot : string + + suppressImplicitAnyIndexErrors?: boolean; +>suppressImplicitAnyIndexErrors : boolean + + target?: ScriptTarget; +>target : ScriptTarget +>ScriptTarget : ScriptTarget + + version?: boolean; +>version : boolean + + watch?: boolean; +>watch : boolean + + stripInternal?: boolean; +>stripInternal : boolean + + [option: string]: string | number | boolean; +>option : string + } + const enum ModuleKind { +>ModuleKind : ModuleKind + + None = 0, +>None : ModuleKind + + CommonJS = 1, +>CommonJS : ModuleKind + + AMD = 2, +>AMD : ModuleKind + } + interface LineAndCharacter { +>LineAndCharacter : LineAndCharacter + + line: number; +>line : number + + character: number; +>character : number + } + const enum ScriptTarget { +>ScriptTarget : ScriptTarget + + ES3 = 0, +>ES3 : ScriptTarget + + ES5 = 1, +>ES5 : ScriptTarget + + ES6 = 2, +>ES6 : ScriptTarget + + Latest = 2, +>Latest : ScriptTarget + } + interface ParsedCommandLine { +>ParsedCommandLine : ParsedCommandLine + + options: CompilerOptions; +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + fileNames: string[]; +>fileNames : string[] + + errors: Diagnostic[]; +>errors : Diagnostic[] +>Diagnostic : Diagnostic + } + interface CommandLineOption { +>CommandLineOption : CommandLineOption + + name: string; +>name : string + + type: string | Map; +>type : string | Map +>Map : Map + + isFilePath?: boolean; +>isFilePath : boolean + + shortName?: string; +>shortName : string + + description?: DiagnosticMessage; +>description : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + paramType?: DiagnosticMessage; +>paramType : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + error?: DiagnosticMessage; +>error : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + experimental?: boolean; +>experimental : boolean + } + const enum CharacterCodes { +>CharacterCodes : CharacterCodes + + nullCharacter = 0, +>nullCharacter : CharacterCodes + + maxAsciiCharacter = 127, +>maxAsciiCharacter : CharacterCodes + + lineFeed = 10, +>lineFeed : CharacterCodes + + carriageReturn = 13, +>carriageReturn : CharacterCodes + + lineSeparator = 8232, +>lineSeparator : CharacterCodes + + paragraphSeparator = 8233, +>paragraphSeparator : CharacterCodes + + nextLine = 133, +>nextLine : CharacterCodes + + space = 32, +>space : CharacterCodes + + nonBreakingSpace = 160, +>nonBreakingSpace : CharacterCodes + + enQuad = 8192, +>enQuad : CharacterCodes + + emQuad = 8193, +>emQuad : CharacterCodes + + enSpace = 8194, +>enSpace : CharacterCodes + + emSpace = 8195, +>emSpace : CharacterCodes + + threePerEmSpace = 8196, +>threePerEmSpace : CharacterCodes + + fourPerEmSpace = 8197, +>fourPerEmSpace : CharacterCodes + + sixPerEmSpace = 8198, +>sixPerEmSpace : CharacterCodes + + figureSpace = 8199, +>figureSpace : CharacterCodes + + punctuationSpace = 8200, +>punctuationSpace : CharacterCodes + + thinSpace = 8201, +>thinSpace : CharacterCodes + + hairSpace = 8202, +>hairSpace : CharacterCodes + + zeroWidthSpace = 8203, +>zeroWidthSpace : CharacterCodes + + narrowNoBreakSpace = 8239, +>narrowNoBreakSpace : CharacterCodes + + ideographicSpace = 12288, +>ideographicSpace : CharacterCodes + + mathematicalSpace = 8287, +>mathematicalSpace : CharacterCodes + + ogham = 5760, +>ogham : CharacterCodes + + _ = 95, +>_ : CharacterCodes + + $ = 36, +>$ : CharacterCodes + + _0 = 48, +>_0 : CharacterCodes + + _1 = 49, +>_1 : CharacterCodes + + _2 = 50, +>_2 : CharacterCodes + + _3 = 51, +>_3 : CharacterCodes + + _4 = 52, +>_4 : CharacterCodes + + _5 = 53, +>_5 : CharacterCodes + + _6 = 54, +>_6 : CharacterCodes + + _7 = 55, +>_7 : CharacterCodes + + _8 = 56, +>_8 : CharacterCodes + + _9 = 57, +>_9 : CharacterCodes + + a = 97, +>a : CharacterCodes + + b = 98, +>b : CharacterCodes + + c = 99, +>c : CharacterCodes + + d = 100, +>d : CharacterCodes + + e = 101, +>e : CharacterCodes + + f = 102, +>f : CharacterCodes + + g = 103, +>g : CharacterCodes + + h = 104, +>h : CharacterCodes + + i = 105, +>i : CharacterCodes + + j = 106, +>j : CharacterCodes + + k = 107, +>k : CharacterCodes + + l = 108, +>l : CharacterCodes + + m = 109, +>m : CharacterCodes + + n = 110, +>n : CharacterCodes + + o = 111, +>o : CharacterCodes + + p = 112, +>p : CharacterCodes + + q = 113, +>q : CharacterCodes + + r = 114, +>r : CharacterCodes + + s = 115, +>s : CharacterCodes + + t = 116, +>t : CharacterCodes + + u = 117, +>u : CharacterCodes + + v = 118, +>v : CharacterCodes + + w = 119, +>w : CharacterCodes + + x = 120, +>x : CharacterCodes + + y = 121, +>y : CharacterCodes + + z = 122, +>z : CharacterCodes + + A = 65, +>A : CharacterCodes + + B = 66, +>B : CharacterCodes + + C = 67, +>C : CharacterCodes + + D = 68, +>D : CharacterCodes + + E = 69, +>E : CharacterCodes + + F = 70, +>F : CharacterCodes + + G = 71, +>G : CharacterCodes + + H = 72, +>H : CharacterCodes + + I = 73, +>I : CharacterCodes + + J = 74, +>J : CharacterCodes + + K = 75, +>K : CharacterCodes + + L = 76, +>L : CharacterCodes + + M = 77, +>M : CharacterCodes + + N = 78, +>N : CharacterCodes + + O = 79, +>O : CharacterCodes + + P = 80, +>P : CharacterCodes + + Q = 81, +>Q : CharacterCodes + + R = 82, +>R : CharacterCodes + + S = 83, +>S : CharacterCodes + + T = 84, +>T : CharacterCodes + + U = 85, +>U : CharacterCodes + + V = 86, +>V : CharacterCodes + + W = 87, +>W : CharacterCodes + + X = 88, +>X : CharacterCodes + + Y = 89, +>Y : CharacterCodes + + Z = 90, +>Z : CharacterCodes + + ampersand = 38, +>ampersand : CharacterCodes + + asterisk = 42, +>asterisk : CharacterCodes + + at = 64, +>at : CharacterCodes + + backslash = 92, +>backslash : CharacterCodes + + backtick = 96, +>backtick : CharacterCodes + + bar = 124, +>bar : CharacterCodes + + caret = 94, +>caret : CharacterCodes + + closeBrace = 125, +>closeBrace : CharacterCodes + + closeBracket = 93, +>closeBracket : CharacterCodes + + closeParen = 41, +>closeParen : CharacterCodes + + colon = 58, +>colon : CharacterCodes + + comma = 44, +>comma : CharacterCodes + + dot = 46, +>dot : CharacterCodes + + doubleQuote = 34, +>doubleQuote : CharacterCodes + + equals = 61, +>equals : CharacterCodes + + exclamation = 33, +>exclamation : CharacterCodes + + greaterThan = 62, +>greaterThan : CharacterCodes + + lessThan = 60, +>lessThan : CharacterCodes + + minus = 45, +>minus : CharacterCodes + + openBrace = 123, +>openBrace : CharacterCodes + + openBracket = 91, +>openBracket : CharacterCodes + + openParen = 40, +>openParen : CharacterCodes + + percent = 37, +>percent : CharacterCodes + + plus = 43, +>plus : CharacterCodes + + question = 63, +>question : CharacterCodes + + semicolon = 59, +>semicolon : CharacterCodes + + singleQuote = 39, +>singleQuote : CharacterCodes + + slash = 47, +>slash : CharacterCodes + + tilde = 126, +>tilde : CharacterCodes + + backspace = 8, +>backspace : CharacterCodes + + formFeed = 12, +>formFeed : CharacterCodes + + byteOrderMark = 65279, +>byteOrderMark : CharacterCodes + + tab = 9, +>tab : CharacterCodes + + verticalTab = 11, +>verticalTab : CharacterCodes + } + interface CancellationToken { +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + } + interface CompilerHost { +>CompilerHost : CompilerHost + + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>onError : (message: string) => void +>message : string +>SourceFile : SourceFile + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + writeFile: WriteFileCallback; +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getCanonicalFileName(fileName: string): string; +>getCanonicalFileName : (fileName: string) => string +>fileName : string + + useCaseSensitiveFileNames(): boolean; +>useCaseSensitiveFileNames : () => boolean + + getNewLine(): string; +>getNewLine : () => string + } + interface TextSpan { +>TextSpan : TextSpan + + start: number; +>start : number + + length: number; +>length : number + } + interface TextChangeRange { +>TextChangeRange : TextChangeRange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newLength: number; +>newLength : number + } +} +declare module "typescript" { + interface ErrorCallback { +>ErrorCallback : ErrorCallback + + (message: DiagnosticMessage, length: number): void; +>message : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage +>length : number + } + interface Scanner { +>Scanner : Scanner + + getStartPos(): number; +>getStartPos : () => number + + getToken(): SyntaxKind; +>getToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + getTextPos(): number; +>getTextPos : () => number + + getTokenPos(): number; +>getTokenPos : () => number + + getTokenText(): string; +>getTokenText : () => string + + getTokenValue(): string; +>getTokenValue : () => string + + hasPrecedingLineBreak(): boolean; +>hasPrecedingLineBreak : () => boolean + + isIdentifier(): boolean; +>isIdentifier : () => boolean + + isReservedWord(): boolean; +>isReservedWord : () => boolean + + isUnterminated(): boolean; +>isUnterminated : () => boolean + + reScanGreaterToken(): SyntaxKind; +>reScanGreaterToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanSlashToken(): SyntaxKind; +>reScanSlashToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanTemplateToken(): SyntaxKind; +>reScanTemplateToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + scan(): SyntaxKind; +>scan : () => SyntaxKind +>SyntaxKind : SyntaxKind + + setText(text: string): void; +>setText : (text: string) => void +>text : string + + setTextPos(textPos: number): void; +>setTextPos : (textPos: number) => void +>textPos : number + + lookAhead(callback: () => T): T; +>lookAhead : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + + tryScan(callback: () => T): T; +>tryScan : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + } + function tokenToString(t: SyntaxKind): string; +>tokenToString : (t: SyntaxKind) => string +>t : SyntaxKind +>SyntaxKind : SyntaxKind + + function computeLineStarts(text: string): number[]; +>computeLineStarts : (text: string) => number[] +>text : string + + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number +>sourceFile : SourceFile +>SourceFile : SourceFile +>line : number +>character : number + + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number +>lineStarts : number[] +>line : number +>character : number + + function getLineStarts(sourceFile: SourceFile): number[]; +>getLineStarts : (sourceFile: SourceFile) => number[] +>sourceFile : SourceFile +>SourceFile : SourceFile + + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } +>lineStarts : number[] +>position : number + + line: number; +>line : number + + character: number; +>character : number + + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter +>sourceFile : SourceFile +>SourceFile : SourceFile +>position : number +>LineAndCharacter : LineAndCharacter + + function isWhiteSpace(ch: number): boolean; +>isWhiteSpace : (ch: number) => boolean +>ch : number + + function isLineBreak(ch: number): boolean; +>isLineBreak : (ch: number) => boolean +>ch : number + + function isOctalDigit(ch: number): boolean; +>isOctalDigit : (ch: number) => boolean +>ch : number + + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; +>skipTrivia : (text: string, pos: number, stopAfterLineBreak?: boolean) => number +>text : string +>pos : number +>stopAfterLineBreak : boolean + + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; +>getLeadingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; +>getTrailingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierStart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierPart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +>createScanner : (languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback) => Scanner +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>skipTrivia : boolean +>text : string +>onError : ErrorCallback +>ErrorCallback : ErrorCallback +>Scanner : Scanner +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; +>getNodeConstructor : (kind: SyntaxKind) => new () => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function createNode(kind: SyntaxKind): Node; +>createNode : (kind: SyntaxKind) => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; +>forEachChild : (node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T) => T +>T : T +>node : Node +>Node : Node +>cbNode : (node: Node) => T +>node : Node +>Node : Node +>T : T +>cbNodeArray : (nodes: Node[]) => T +>nodes : Node[] +>Node : Node +>T : T +>T : T + + function modifierToFlag(token: SyntaxKind): NodeFlags; +>modifierToFlag : (token: SyntaxKind) => NodeFlags +>token : SyntaxKind +>SyntaxKind : SyntaxKind +>NodeFlags : NodeFlags + + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; +>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function isEvalOrArgumentsIdentifier(node: Node): boolean; +>isEvalOrArgumentsIdentifier : (node: Node) => boolean +>node : Node +>Node : Node + + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string +>sourceText : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>setParentNodes : boolean +>SourceFile : SourceFile + + function isLeftHandSideExpression(expr: Expression): boolean; +>isLeftHandSideExpression : (expr: Expression) => boolean +>expr : Expression +>Expression : Expression + + function isAssignmentOperator(token: SyntaxKind): boolean; +>isAssignmentOperator : (token: SyntaxKind) => boolean +>token : SyntaxKind +>SyntaxKind : SyntaxKind +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +>createTypeChecker : (host: TypeCheckerHost, produceDiagnostics: boolean) => TypeChecker +>host : TypeCheckerHost +>TypeCheckerHost : TypeCheckerHost +>produceDiagnostics : boolean +>TypeChecker : TypeChecker +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; +>createCompilerHost : (options: CompilerOptions) => CompilerHost +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>CompilerHost : CompilerHost + + function getPreEmitDiagnostics(program: Program): Diagnostic[]; +>getPreEmitDiagnostics : (program: Program) => Diagnostic[] +>program : Program +>Program : Program +>Diagnostic : Diagnostic + + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; +>flattenDiagnosticMessageText : (messageText: string | DiagnosticMessageChain, newLine: string) => string +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain +>newLine : string + + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +>createProgram : (rootNames: string[], options: CompilerOptions, host?: CompilerHost) => Program +>rootNames : string[] +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>host : CompilerHost +>CompilerHost : CompilerHost +>Program : Program +} +declare module "typescript" { + var servicesVersion: string; +>servicesVersion : string + + interface Node { +>Node : Node + + getSourceFile(): SourceFile; +>getSourceFile : () => SourceFile +>SourceFile : SourceFile + + getChildCount(sourceFile?: SourceFile): number; +>getChildCount : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getChildAt(index: number, sourceFile?: SourceFile): Node; +>getChildAt : (index: number, sourceFile?: SourceFile) => Node +>index : number +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getChildren(sourceFile?: SourceFile): Node[]; +>getChildren : (sourceFile?: SourceFile) => Node[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getStart(sourceFile?: SourceFile): number; +>getStart : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullStart(): number; +>getFullStart : () => number + + getEnd(): number; +>getEnd : () => number + + getWidth(sourceFile?: SourceFile): number; +>getWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullWidth(): number; +>getFullWidth : () => number + + getLeadingTriviaWidth(sourceFile?: SourceFile): number; +>getLeadingTriviaWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullText(sourceFile?: SourceFile): string; +>getFullText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getText(sourceFile?: SourceFile): string; +>getText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFirstToken(sourceFile?: SourceFile): Node; +>getFirstToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getLastToken(sourceFile?: SourceFile): Node; +>getLastToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + } + interface Symbol { +>Symbol : Symbol + + getFlags(): SymbolFlags; +>getFlags : () => SymbolFlags +>SymbolFlags : SymbolFlags + + getName(): string; +>getName : () => string + + getDeclarations(): Declaration[]; +>getDeclarations : () => Declaration[] +>Declaration : Declaration + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface Type { +>Type : Type + + getFlags(): TypeFlags; +>getFlags : () => TypeFlags +>TypeFlags : TypeFlags + + getSymbol(): Symbol; +>getSymbol : () => Symbol +>Symbol : Symbol + + getProperties(): Symbol[]; +>getProperties : () => Symbol[] +>Symbol : Symbol + + getProperty(propertyName: string): Symbol; +>getProperty : (propertyName: string) => Symbol +>propertyName : string +>Symbol : Symbol + + getApparentProperties(): Symbol[]; +>getApparentProperties : () => Symbol[] +>Symbol : Symbol + + getCallSignatures(): Signature[]; +>getCallSignatures : () => Signature[] +>Signature : Signature + + getConstructSignatures(): Signature[]; +>getConstructSignatures : () => Signature[] +>Signature : Signature + + getStringIndexType(): Type; +>getStringIndexType : () => Type +>Type : Type + + getNumberIndexType(): Type; +>getNumberIndexType : () => Type +>Type : Type + } + interface Signature { +>Signature : Signature + + getDeclaration(): SignatureDeclaration; +>getDeclaration : () => SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + getTypeParameters(): Type[]; +>getTypeParameters : () => Type[] +>Type : Type + + getParameters(): Symbol[]; +>getParameters : () => Symbol[] +>Symbol : Symbol + + getReturnType(): Type; +>getReturnType : () => Type +>Type : Type + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface SourceFile { +>SourceFile : SourceFile + + version: string; +>version : string + + scriptSnapshot: IScriptSnapshot; +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot + + nameTable: Map; +>nameTable : Map +>Map : Map + + getNamedDeclarations(): Declaration[]; +>getNamedDeclarations : () => Declaration[] +>Declaration : Declaration + + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; +>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter +>pos : number +>LineAndCharacter : LineAndCharacter + + getLineStarts(): number[]; +>getLineStarts : () => number[] + + getPositionFromLineAndCharacter(line: number, character: number): number; +>getPositionFromLineAndCharacter : (line: number, character: number) => number +>line : number +>character : number + + update(newText: string, textChangeRange: TextChangeRange): SourceFile; +>update : (newText: string, textChangeRange: TextChangeRange) => SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { +>IScriptSnapshot : IScriptSnapshot + + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; +>getText : (start: number, end: number) => string +>start : number +>end : number + + /** Gets the length of this script snapshot. */ + getLength(): number; +>getLength : () => number + + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; +>getChangeRange : (oldSnapshot: IScriptSnapshot) => TextChangeRange +>oldSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>TextChangeRange : TextChangeRange + } + module ScriptSnapshot { +>ScriptSnapshot : typeof ScriptSnapshot + + function fromString(text: string): IScriptSnapshot; +>fromString : (text: string) => IScriptSnapshot +>text : string +>IScriptSnapshot : IScriptSnapshot + } + interface PreProcessedFileInfo { +>PreProcessedFileInfo : PreProcessedFileInfo + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + importedFiles: FileReference[]; +>importedFiles : FileReference[] +>FileReference : FileReference + + isLibFile: boolean; +>isLibFile : boolean + } + interface LanguageServiceHost { +>LanguageServiceHost : LanguageServiceHost + + getCompilationSettings(): CompilerOptions; +>getCompilationSettings : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getNewLine?(): string; +>getNewLine : () => string + + getScriptFileNames(): string[]; +>getScriptFileNames : () => string[] + + getScriptVersion(fileName: string): string; +>getScriptVersion : (fileName: string) => string +>fileName : string + + getScriptSnapshot(fileName: string): IScriptSnapshot; +>getScriptSnapshot : (fileName: string) => IScriptSnapshot +>fileName : string +>IScriptSnapshot : IScriptSnapshot + + getLocalizedDiagnosticMessages?(): any; +>getLocalizedDiagnosticMessages : () => any + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + log?(s: string): void; +>log : (s: string) => void +>s : string + + trace?(s: string): void; +>trace : (s: string) => void +>s : string + + error?(s: string): void; +>error : (s: string) => void +>s : string + } + interface LanguageService { +>LanguageService : LanguageService + + cleanupSemanticCache(): void; +>cleanupSemanticCache : () => void + + getSyntacticDiagnostics(fileName: string): Diagnostic[]; +>getSyntacticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getSemanticDiagnostics(fileName: string): Diagnostic[]; +>getSemanticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getCompilerOptionsDiagnostics(): Diagnostic[]; +>getCompilerOptionsDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSyntacticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSemanticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; +>getCompletionsAtPosition : (fileName: string, position: number) => CompletionInfo +>fileName : string +>position : number +>CompletionInfo : CompletionInfo + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; +>getCompletionEntryDetails : (fileName: string, position: number, entryName: string) => CompletionEntryDetails +>fileName : string +>position : number +>entryName : string +>CompletionEntryDetails : CompletionEntryDetails + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; +>getQuickInfoAtPosition : (fileName: string, position: number) => QuickInfo +>fileName : string +>position : number +>QuickInfo : QuickInfo + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; +>getNameOrDottedNameSpan : (fileName: string, startPos: number, endPos: number) => TextSpan +>fileName : string +>startPos : number +>endPos : number +>TextSpan : TextSpan + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; +>getBreakpointStatementAtPosition : (fileName: string, position: number) => TextSpan +>fileName : string +>position : number +>TextSpan : TextSpan + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; +>getSignatureHelpItems : (fileName: string, position: number) => SignatureHelpItems +>fileName : string +>position : number +>SignatureHelpItems : SignatureHelpItems + + getRenameInfo(fileName: string, position: number): RenameInfo; +>getRenameInfo : (fileName: string, position: number) => RenameInfo +>fileName : string +>position : number +>RenameInfo : RenameInfo + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; +>findRenameLocations : (fileName: string, position: number, findInStrings: boolean, findInComments: boolean) => RenameLocation[] +>fileName : string +>position : number +>findInStrings : boolean +>findInComments : boolean +>RenameLocation : RenameLocation + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; +>getDefinitionAtPosition : (fileName: string, position: number) => DefinitionInfo[] +>fileName : string +>position : number +>DefinitionInfo : DefinitionInfo + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getReferencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getOccurrencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getNavigateToItems(searchValue: string): NavigateToItem[]; +>getNavigateToItems : (searchValue: string) => NavigateToItem[] +>searchValue : string +>NavigateToItem : NavigateToItem + + getNavigationBarItems(fileName: string): NavigationBarItem[]; +>getNavigationBarItems : (fileName: string) => NavigationBarItem[] +>fileName : string +>NavigationBarItem : NavigationBarItem + + getOutliningSpans(fileName: string): OutliningSpan[]; +>getOutliningSpans : (fileName: string) => OutliningSpan[] +>fileName : string +>OutliningSpan : OutliningSpan + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; +>getTodoComments : (fileName: string, descriptors: TodoCommentDescriptor[]) => TodoComment[] +>fileName : string +>descriptors : TodoCommentDescriptor[] +>TodoCommentDescriptor : TodoCommentDescriptor +>TodoComment : TodoComment + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; +>getBraceMatchingAtPosition : (fileName: string, position: number) => TextSpan[] +>fileName : string +>position : number +>TextSpan : TextSpan + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; +>getIndentationAtPosition : (fileName: string, position: number, options: EditorOptions) => number +>fileName : string +>position : number +>options : EditorOptions +>EditorOptions : EditorOptions + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForRange : (fileName: string, start: number, end: number, options: FormatCodeOptions) => TextChange[] +>fileName : string +>start : number +>end : number +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForDocument : (fileName: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsAfterKeystroke : (fileName: string, position: number, key: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>position : number +>key : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getEmitOutput(fileName: string): EmitOutput; +>getEmitOutput : (fileName: string) => EmitOutput +>fileName : string +>EmitOutput : EmitOutput + + getProgram(): Program; +>getProgram : () => Program +>Program : Program + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + dispose(): void; +>dispose : () => void + } + interface ClassifiedSpan { +>ClassifiedSpan : ClassifiedSpan + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + classificationType: string; +>classificationType : string + } + interface NavigationBarItem { +>NavigationBarItem : NavigationBarItem + + text: string; +>text : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + spans: TextSpan[]; +>spans : TextSpan[] +>TextSpan : TextSpan + + childItems: NavigationBarItem[]; +>childItems : NavigationBarItem[] +>NavigationBarItem : NavigationBarItem + + indent: number; +>indent : number + + bolded: boolean; +>bolded : boolean + + grayed: boolean; +>grayed : boolean + } + interface TodoCommentDescriptor { +>TodoCommentDescriptor : TodoCommentDescriptor + + text: string; +>text : string + + priority: number; +>priority : number + } + interface TodoComment { +>TodoComment : TodoComment + + descriptor: TodoCommentDescriptor; +>descriptor : TodoCommentDescriptor +>TodoCommentDescriptor : TodoCommentDescriptor + + message: string; +>message : string + + position: number; +>position : number + } + class TextChange { +>TextChange : TextChange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newText: string; +>newText : string + } + interface RenameLocation { +>RenameLocation : RenameLocation + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + } + interface ReferenceEntry { +>ReferenceEntry : ReferenceEntry + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + + isWriteAccess: boolean; +>isWriteAccess : boolean + } + interface NavigateToItem { +>NavigateToItem : NavigateToItem + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + matchKind: string; +>matchKind : string + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + containerName: string; +>containerName : string + + containerKind: string; +>containerKind : string + } + interface EditorOptions { +>EditorOptions : EditorOptions + + IndentSize: number; +>IndentSize : number + + TabSize: number; +>TabSize : number + + NewLineCharacter: string; +>NewLineCharacter : string + + ConvertTabsToSpaces: boolean; +>ConvertTabsToSpaces : boolean + } + interface FormatCodeOptions extends EditorOptions { +>FormatCodeOptions : FormatCodeOptions +>EditorOptions : EditorOptions + + InsertSpaceAfterCommaDelimiter: boolean; +>InsertSpaceAfterCommaDelimiter : boolean + + InsertSpaceAfterSemicolonInForStatements: boolean; +>InsertSpaceAfterSemicolonInForStatements : boolean + + InsertSpaceBeforeAndAfterBinaryOperators: boolean; +>InsertSpaceBeforeAndAfterBinaryOperators : boolean + + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; +>InsertSpaceAfterKeywordsInControlFlowStatements : boolean + + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; +>InsertSpaceAfterFunctionKeywordForAnonymousFunctions : boolean + + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; +>InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis : boolean + + PlaceOpenBraceOnNewLineForFunctions: boolean; +>PlaceOpenBraceOnNewLineForFunctions : boolean + + PlaceOpenBraceOnNewLineForControlBlocks: boolean; +>PlaceOpenBraceOnNewLineForControlBlocks : boolean + } + interface DefinitionInfo { +>DefinitionInfo : DefinitionInfo + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + kind: string; +>kind : string + + name: string; +>name : string + + containerKind: string; +>containerKind : string + + containerName: string; +>containerName : string + } + enum SymbolDisplayPartKind { +>SymbolDisplayPartKind : SymbolDisplayPartKind + + aliasName = 0, +>aliasName : SymbolDisplayPartKind + + className = 1, +>className : SymbolDisplayPartKind + + enumName = 2, +>enumName : SymbolDisplayPartKind + + fieldName = 3, +>fieldName : SymbolDisplayPartKind + + interfaceName = 4, +>interfaceName : SymbolDisplayPartKind + + keyword = 5, +>keyword : SymbolDisplayPartKind + + lineBreak = 6, +>lineBreak : SymbolDisplayPartKind + + numericLiteral = 7, +>numericLiteral : SymbolDisplayPartKind + + stringLiteral = 8, +>stringLiteral : SymbolDisplayPartKind + + localName = 9, +>localName : SymbolDisplayPartKind + + methodName = 10, +>methodName : SymbolDisplayPartKind + + moduleName = 11, +>moduleName : SymbolDisplayPartKind + + operator = 12, +>operator : SymbolDisplayPartKind + + parameterName = 13, +>parameterName : SymbolDisplayPartKind + + propertyName = 14, +>propertyName : SymbolDisplayPartKind + + punctuation = 15, +>punctuation : SymbolDisplayPartKind + + space = 16, +>space : SymbolDisplayPartKind + + text = 17, +>text : SymbolDisplayPartKind + + typeParameterName = 18, +>typeParameterName : SymbolDisplayPartKind + + enumMemberName = 19, +>enumMemberName : SymbolDisplayPartKind + + functionName = 20, +>functionName : SymbolDisplayPartKind + + regularExpressionLiteral = 21, +>regularExpressionLiteral : SymbolDisplayPartKind + } + interface SymbolDisplayPart { +>SymbolDisplayPart : SymbolDisplayPart + + text: string; +>text : string + + kind: string; +>kind : string + } + interface QuickInfo { +>QuickInfo : QuickInfo + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface RenameInfo { +>RenameInfo : RenameInfo + + canRename: boolean; +>canRename : boolean + + localizedErrorMessage: string; +>localizedErrorMessage : string + + displayName: string; +>displayName : string + + fullDisplayName: string; +>fullDisplayName : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + triggerSpan: TextSpan; +>triggerSpan : TextSpan +>TextSpan : TextSpan + } + interface SignatureHelpParameter { +>SignatureHelpParameter : SignatureHelpParameter + + name: string; +>name : string + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + isOptional: boolean; +>isOptional : boolean + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { +>SignatureHelpItem : SignatureHelpItem + + isVariadic: boolean; +>isVariadic : boolean + + prefixDisplayParts: SymbolDisplayPart[]; +>prefixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + suffixDisplayParts: SymbolDisplayPart[]; +>suffixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + separatorDisplayParts: SymbolDisplayPart[]; +>separatorDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + parameters: SignatureHelpParameter[]; +>parameters : SignatureHelpParameter[] +>SignatureHelpParameter : SignatureHelpParameter + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { +>SignatureHelpItems : SignatureHelpItems + + items: SignatureHelpItem[]; +>items : SignatureHelpItem[] +>SignatureHelpItem : SignatureHelpItem + + applicableSpan: TextSpan; +>applicableSpan : TextSpan +>TextSpan : TextSpan + + selectedItemIndex: number; +>selectedItemIndex : number + + argumentIndex: number; +>argumentIndex : number + + argumentCount: number; +>argumentCount : number + } + interface CompletionInfo { +>CompletionInfo : CompletionInfo + + isMemberCompletion: boolean; +>isMemberCompletion : boolean + + isNewIdentifierLocation: boolean; +>isNewIdentifierLocation : boolean + + entries: CompletionEntry[]; +>entries : CompletionEntry[] +>CompletionEntry : CompletionEntry + } + interface CompletionEntry { +>CompletionEntry : CompletionEntry + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + } + interface CompletionEntryDetails { +>CompletionEntryDetails : CompletionEntryDetails + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface OutliningSpan { +>OutliningSpan : OutliningSpan + + /** The span of the document to actually collapse. */ + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; +>hintSpan : TextSpan +>TextSpan : TextSpan + + /** The text to display in the editor for the collapsed region. */ + bannerText: string; +>bannerText : string + + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; +>autoCollapse : boolean + } + interface EmitOutput { +>EmitOutput : EmitOutput + + outputFiles: OutputFile[]; +>outputFiles : OutputFile[] +>OutputFile : OutputFile + + emitSkipped: boolean; +>emitSkipped : boolean + } + const enum OutputFileType { +>OutputFileType : OutputFileType + + JavaScript = 0, +>JavaScript : OutputFileType + + SourceMap = 1, +>SourceMap : OutputFileType + + Declaration = 2, +>Declaration : OutputFileType + } + interface OutputFile { +>OutputFile : OutputFile + + name: string; +>name : string + + writeByteOrderMark: boolean; +>writeByteOrderMark : boolean + + text: string; +>text : string + } + const enum EndOfLineState { +>EndOfLineState : EndOfLineState + + Start = 0, +>Start : EndOfLineState + + InMultiLineCommentTrivia = 1, +>InMultiLineCommentTrivia : EndOfLineState + + InSingleQuoteStringLiteral = 2, +>InSingleQuoteStringLiteral : EndOfLineState + + InDoubleQuoteStringLiteral = 3, +>InDoubleQuoteStringLiteral : EndOfLineState + } + enum TokenClass { +>TokenClass : TokenClass + + Punctuation = 0, +>Punctuation : TokenClass + + Keyword = 1, +>Keyword : TokenClass + + Operator = 2, +>Operator : TokenClass + + Comment = 3, +>Comment : TokenClass + + Whitespace = 4, +>Whitespace : TokenClass + + Identifier = 5, +>Identifier : TokenClass + + NumberLiteral = 6, +>NumberLiteral : TokenClass + + StringLiteral = 7, +>StringLiteral : TokenClass + + RegExpLiteral = 8, +>RegExpLiteral : TokenClass + } + interface ClassificationResult { +>ClassificationResult : ClassificationResult + + finalLexState: EndOfLineState; +>finalLexState : EndOfLineState +>EndOfLineState : EndOfLineState + + entries: ClassificationInfo[]; +>entries : ClassificationInfo[] +>ClassificationInfo : ClassificationInfo + } + interface ClassificationInfo { +>ClassificationInfo : ClassificationInfo + + length: number; +>length : number + + classification: TokenClass; +>classification : TokenClass +>TokenClass : TokenClass + } + interface Classifier { +>Classifier : Classifier + + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult +>text : string +>lexState : EndOfLineState +>EndOfLineState : EndOfLineState +>classifyKeywordsInGenerics : boolean +>ClassificationResult : ClassificationResult + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { +>DocumentRegistry : DocumentRegistry + + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions + } + class ScriptElementKind { +>ScriptElementKind : ScriptElementKind + + static unknown: string; +>unknown : string + + static keyword: string; +>keyword : string + + static scriptElement: string; +>scriptElement : string + + static moduleElement: string; +>moduleElement : string + + static classElement: string; +>classElement : string + + static interfaceElement: string; +>interfaceElement : string + + static typeElement: string; +>typeElement : string + + static enumElement: string; +>enumElement : string + + static variableElement: string; +>variableElement : string + + static localVariableElement: string; +>localVariableElement : string + + static functionElement: string; +>functionElement : string + + static localFunctionElement: string; +>localFunctionElement : string + + static memberFunctionElement: string; +>memberFunctionElement : string + + static memberGetAccessorElement: string; +>memberGetAccessorElement : string + + static memberSetAccessorElement: string; +>memberSetAccessorElement : string + + static memberVariableElement: string; +>memberVariableElement : string + + static constructorImplementationElement: string; +>constructorImplementationElement : string + + static callSignatureElement: string; +>callSignatureElement : string + + static indexSignatureElement: string; +>indexSignatureElement : string + + static constructSignatureElement: string; +>constructSignatureElement : string + + static parameterElement: string; +>parameterElement : string + + static typeParameterElement: string; +>typeParameterElement : string + + static primitiveType: string; +>primitiveType : string + + static label: string; +>label : string + + static alias: string; +>alias : string + + static constElement: string; +>constElement : string + + static letElement: string; +>letElement : string + } + class ScriptElementKindModifier { +>ScriptElementKindModifier : ScriptElementKindModifier + + static none: string; +>none : string + + static publicMemberModifier: string; +>publicMemberModifier : string + + static privateMemberModifier: string; +>privateMemberModifier : string + + static protectedMemberModifier: string; +>protectedMemberModifier : string + + static exportedModifier: string; +>exportedModifier : string + + static ambientModifier: string; +>ambientModifier : string + + static staticModifier: string; +>staticModifier : string + } + class ClassificationTypeNames { +>ClassificationTypeNames : ClassificationTypeNames + + static comment: string; +>comment : string + + static identifier: string; +>identifier : string + + static keyword: string; +>keyword : string + + static numericLiteral: string; +>numericLiteral : string + + static operator: string; +>operator : string + + static stringLiteral: string; +>stringLiteral : string + + static whiteSpace: string; +>whiteSpace : string + + static text: string; +>text : string + + static punctuation: string; +>punctuation : string + + static className: string; +>className : string + + static enumName: string; +>enumName : string + + static interfaceName: string; +>interfaceName : string + + static moduleName: string; +>moduleName : string + + static typeParameterName: string; +>typeParameterName : string + + static typeAlias: string; +>typeAlias : string + } + interface DisplayPartsSymbolWriter extends SymbolWriter { +>DisplayPartsSymbolWriter : DisplayPartsSymbolWriter +>SymbolWriter : SymbolWriter + + displayParts(): SymbolDisplayPart[]; +>displayParts : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; +>displayPartsToString : (displayParts: SymbolDisplayPart[]) => string +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + function getDefaultCompilerOptions(): CompilerOptions; +>getDefaultCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + class OperationCanceledException { +>OperationCanceledException : OperationCanceledException + } + class CancellationTokenObject { +>CancellationTokenObject : CancellationTokenObject + + private cancellationToken; +>cancellationToken : any + + static None: CancellationTokenObject; +>None : CancellationTokenObject +>CancellationTokenObject : CancellationTokenObject + + constructor(cancellationToken: CancellationToken); +>cancellationToken : CancellationToken +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + + throwIfCancellationRequested(): void; +>throwIfCancellationRequested : () => void + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>scriptTarget : ScriptTarget +>ScriptTarget : ScriptTarget +>version : string +>setNodeParents : boolean +>SourceFile : SourceFile + + var disableIncrementalParsing: boolean; +>disableIncrementalParsing : boolean + + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function createDocumentRegistry(): DocumentRegistry; +>createDocumentRegistry : () => DocumentRegistry +>DocumentRegistry : DocumentRegistry + + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; +>preProcessFile : (sourceText: string, readImportFiles?: boolean) => PreProcessedFileInfo +>sourceText : string +>readImportFiles : boolean +>PreProcessedFileInfo : PreProcessedFileInfo + + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; +>createLanguageService : (host: LanguageServiceHost, documentRegistry?: DocumentRegistry) => LanguageService +>host : LanguageServiceHost +>LanguageServiceHost : LanguageServiceHost +>documentRegistry : DocumentRegistry +>DocumentRegistry : DocumentRegistry +>LanguageService : LanguageService + + function createClassifier(): Classifier; +>createClassifier : () => Classifier +>Classifier : Classifier + + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +>getDefaultLibFilePath : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions +} + diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js new file mode 100644 index 00000000000..2add8dfd45e --- /dev/null +++ b/tests/baselines/reference/APISample_watcher.js @@ -0,0 +1,2055 @@ +//// [tests/cases/compiler/APISample_watcher.ts] //// + +//// [APISample_watcher.ts] + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +declare var console: any; +declare var fs: any; +declare var path: any; + +import ts = require("typescript"); + +function watch(rootFileNames: string[], options: ts.CompilerOptions) { + var files: ts.Map<{ version: number }> = {}; + + // initialize the list of files + rootFileNames.forEach(fileName => { + files[fileName] = { version: 0 }; + }); + + // Create the language service host to allow the LS to communicate with the host + var servicesHost: ts.LanguageServiceHost = { + getScriptFileNames: () => rootFileNames, + getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), + getScriptSnapshot: (fileName) => { + if (!fs.existsSync(fileName)) { + return undefined; + } + + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); + }, + getCurrentDirectory: () => process.cwd(), + getCompilationSettings: () => options, + getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), + }; + + // Create the language service files + var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) + + // Now let's watch the files + rootFileNames.forEach(fileName => { + // First time around, emit all files + emitFile(fileName); + + // Add a watch on the file to handle next change + fs.watchFile(fileName, + { persistent: true, interval: 250 }, + (curr, prev) => { + // Check timestamp + if (+curr.mtime <= +prev.mtime) { + return; + } + + // Update the version to signal a change in the file + files[fileName].version++; + + // write the changes to disk + emitFile(fileName); + }); + }); + + function emitFile(fileName: string) { + var output = services.getEmitOutput(fileName); + + if (!output.emitSkipped) { + console.log(`Emitting ${fileName}`); + } + else { + console.log(`Emitting ${fileName} failed`); + logErrors(fileName); + } + + output.outputFiles.forEach(o => { + fs.writeFileSync(o.name, o.text, "utf8"); + }); + } + + function logErrors(fileName: string) { + var allDiagnostics = services.getCompilerOptionsDiagnostics() + .concat(services.getSyntacticDiagnostics(fileName)) + .concat(services.getSemanticDiagnostics(fileName)); + + allDiagnostics.forEach(diagnostic => { + if (diagnostic.file) { + var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + } + else { + console.log(` Error: ${diagnostic.messageText}`); + } + }); + } +} + +// Initialize files constituting the program as all .ts files in the current directory +var currentDirectoryFiles = fs.readdirSync(process.cwd()). + filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"); + +// Start the watcher +watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); +//// [typescript.d.ts] +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { + [index: string]: T; + } + interface TextRange { + pos: number; + end: number; + } + const enum SyntaxKind { + Unknown = 0, + EndOfFileToken = 1, + SingleLineCommentTrivia = 2, + MultiLineCommentTrivia = 3, + NewLineTrivia = 4, + WhitespaceTrivia = 5, + ConflictMarkerTrivia = 6, + NumericLiteral = 7, + StringLiteral = 8, + RegularExpressionLiteral = 9, + NoSubstitutionTemplateLiteral = 10, + TemplateHead = 11, + TemplateMiddle = 12, + TemplateTail = 13, + OpenBraceToken = 14, + CloseBraceToken = 15, + OpenParenToken = 16, + CloseParenToken = 17, + OpenBracketToken = 18, + CloseBracketToken = 19, + DotToken = 20, + DotDotDotToken = 21, + SemicolonToken = 22, + CommaToken = 23, + LessThanToken = 24, + GreaterThanToken = 25, + LessThanEqualsToken = 26, + GreaterThanEqualsToken = 27, + EqualsEqualsToken = 28, + ExclamationEqualsToken = 29, + EqualsEqualsEqualsToken = 30, + ExclamationEqualsEqualsToken = 31, + EqualsGreaterThanToken = 32, + PlusToken = 33, + MinusToken = 34, + AsteriskToken = 35, + SlashToken = 36, + PercentToken = 37, + PlusPlusToken = 38, + MinusMinusToken = 39, + LessThanLessThanToken = 40, + GreaterThanGreaterThanToken = 41, + GreaterThanGreaterThanGreaterThanToken = 42, + AmpersandToken = 43, + BarToken = 44, + CaretToken = 45, + ExclamationToken = 46, + TildeToken = 47, + AmpersandAmpersandToken = 48, + BarBarToken = 49, + QuestionToken = 50, + ColonToken = 51, + EqualsToken = 52, + PlusEqualsToken = 53, + MinusEqualsToken = 54, + AsteriskEqualsToken = 55, + SlashEqualsToken = 56, + PercentEqualsToken = 57, + LessThanLessThanEqualsToken = 58, + GreaterThanGreaterThanEqualsToken = 59, + GreaterThanGreaterThanGreaterThanEqualsToken = 60, + AmpersandEqualsToken = 61, + BarEqualsToken = 62, + CaretEqualsToken = 63, + Identifier = 64, + BreakKeyword = 65, + CaseKeyword = 66, + CatchKeyword = 67, + ClassKeyword = 68, + ConstKeyword = 69, + ContinueKeyword = 70, + DebuggerKeyword = 71, + DefaultKeyword = 72, + DeleteKeyword = 73, + DoKeyword = 74, + ElseKeyword = 75, + EnumKeyword = 76, + ExportKeyword = 77, + ExtendsKeyword = 78, + FalseKeyword = 79, + FinallyKeyword = 80, + ForKeyword = 81, + FunctionKeyword = 82, + IfKeyword = 83, + ImportKeyword = 84, + InKeyword = 85, + InstanceOfKeyword = 86, + NewKeyword = 87, + NullKeyword = 88, + ReturnKeyword = 89, + SuperKeyword = 90, + SwitchKeyword = 91, + ThisKeyword = 92, + ThrowKeyword = 93, + TrueKeyword = 94, + TryKeyword = 95, + TypeOfKeyword = 96, + VarKeyword = 97, + VoidKeyword = 98, + WhileKeyword = 99, + WithKeyword = 100, + ImplementsKeyword = 101, + InterfaceKeyword = 102, + LetKeyword = 103, + PackageKeyword = 104, + PrivateKeyword = 105, + ProtectedKeyword = 106, + PublicKeyword = 107, + StaticKeyword = 108, + YieldKeyword = 109, + AnyKeyword = 110, + BooleanKeyword = 111, + ConstructorKeyword = 112, + DeclareKeyword = 113, + GetKeyword = 114, + ModuleKeyword = 115, + RequireKeyword = 116, + NumberKeyword = 117, + SetKeyword = 118, + StringKeyword = 119, + TypeKeyword = 120, + QualifiedName = 121, + ComputedPropertyName = 122, + TypeParameter = 123, + Parameter = 124, + PropertySignature = 125, + PropertyDeclaration = 126, + MethodSignature = 127, + MethodDeclaration = 128, + Constructor = 129, + GetAccessor = 130, + SetAccessor = 131, + CallSignature = 132, + ConstructSignature = 133, + IndexSignature = 134, + TypeReference = 135, + FunctionType = 136, + ConstructorType = 137, + TypeQuery = 138, + TypeLiteral = 139, + ArrayType = 140, + TupleType = 141, + UnionType = 142, + ParenthesizedType = 143, + ObjectBindingPattern = 144, + ArrayBindingPattern = 145, + BindingElement = 146, + ArrayLiteralExpression = 147, + ObjectLiteralExpression = 148, + PropertyAccessExpression = 149, + ElementAccessExpression = 150, + CallExpression = 151, + NewExpression = 152, + TaggedTemplateExpression = 153, + TypeAssertionExpression = 154, + ParenthesizedExpression = 155, + FunctionExpression = 156, + ArrowFunction = 157, + DeleteExpression = 158, + TypeOfExpression = 159, + VoidExpression = 160, + PrefixUnaryExpression = 161, + PostfixUnaryExpression = 162, + BinaryExpression = 163, + ConditionalExpression = 164, + TemplateExpression = 165, + YieldExpression = 166, + SpreadElementExpression = 167, + OmittedExpression = 168, + TemplateSpan = 169, + Block = 170, + VariableStatement = 171, + EmptyStatement = 172, + ExpressionStatement = 173, + IfStatement = 174, + DoStatement = 175, + WhileStatement = 176, + ForStatement = 177, + ForInStatement = 178, + ContinueStatement = 179, + BreakStatement = 180, + ReturnStatement = 181, + WithStatement = 182, + SwitchStatement = 183, + LabeledStatement = 184, + ThrowStatement = 185, + TryStatement = 186, + DebuggerStatement = 187, + VariableDeclaration = 188, + VariableDeclarationList = 189, + FunctionDeclaration = 190, + ClassDeclaration = 191, + InterfaceDeclaration = 192, + TypeAliasDeclaration = 193, + EnumDeclaration = 194, + ModuleDeclaration = 195, + ModuleBlock = 196, + ImportDeclaration = 197, + ExportAssignment = 198, + ExternalModuleReference = 199, + CaseClause = 200, + DefaultClause = 201, + HeritageClause = 202, + CatchClause = 203, + PropertyAssignment = 204, + ShorthandPropertyAssignment = 205, + EnumMember = 206, + SourceFile = 207, + SyntaxList = 208, + Count = 209, + FirstAssignment = 52, + LastAssignment = 63, + FirstReservedWord = 65, + LastReservedWord = 100, + FirstKeyword = 65, + LastKeyword = 120, + FirstFutureReservedWord = 101, + LastFutureReservedWord = 109, + FirstTypeNode = 135, + LastTypeNode = 143, + FirstPunctuation = 14, + LastPunctuation = 63, + FirstToken = 0, + LastToken = 120, + FirstTriviaToken = 2, + LastTriviaToken = 6, + FirstLiteralToken = 7, + LastLiteralToken = 10, + FirstTemplateToken = 10, + LastTemplateToken = 13, + FirstBinaryOperator = 24, + LastBinaryOperator = 63, + FirstNode = 121, + } + const enum NodeFlags { + Export = 1, + Ambient = 2, + Public = 16, + Private = 32, + Protected = 64, + Static = 128, + MultiLine = 256, + Synthetic = 512, + DeclarationFile = 1024, + Let = 2048, + Const = 4096, + OctalLiteral = 8192, + Modifier = 243, + AccessibilityModifier = 112, + BlockScoped = 6144, + } + const enum ParserContextFlags { + StrictMode = 1, + DisallowIn = 2, + Yield = 4, + GeneratorParameter = 8, + ThisNodeHasError = 16, + ParserGeneratedFlags = 31, + ThisNodeOrAnySubNodesHasError = 32, + HasAggregatedChildData = 64, + } + const enum RelationComparisonResult { + Succeeded = 1, + Failed = 2, + FailedAndReported = 3, + } + interface Node extends TextRange { + kind: SyntaxKind; + flags: NodeFlags; + parserContextFlags?: ParserContextFlags; + id?: number; + parent?: Node; + symbol?: Symbol; + locals?: SymbolTable; + nextContainer?: Node; + localSymbol?: Symbol; + modifiers?: ModifiersArray; + } + interface NodeArray extends Array, TextRange { + hasTrailingComma?: boolean; + } + interface ModifiersArray extends NodeArray { + flags: number; + } + interface Identifier extends PrimaryExpression { + text: string; + } + interface QualifiedName extends Node { + left: EntityName; + right: Identifier; + } + type EntityName = Identifier | QualifiedName; + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; + interface Declaration extends Node { + _declarationBrand: any; + name?: DeclarationName; + } + interface ComputedPropertyName extends Node { + expression: Expression; + } + interface TypeParameterDeclaration extends Declaration { + name: Identifier; + constraint?: TypeNode; + expression?: Expression; + } + interface SignatureDeclaration extends Declaration { + typeParameters?: NodeArray; + parameters: NodeArray; + type?: TypeNode; + } + interface VariableDeclaration extends Declaration { + parent?: VariableDeclarationList; + name: Identifier | BindingPattern; + type?: TypeNode; + initializer?: Expression; + } + interface VariableDeclarationList extends Node { + declarations: NodeArray; + } + interface ParameterDeclaration extends Declaration { + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingElement extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: Identifier | BindingPattern; + initializer?: Expression; + } + interface PropertyDeclaration extends Declaration, ClassElement { + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface ObjectLiteralElement extends Declaration { + _objectLiteralBrandBrand: any; + } + interface PropertyAssignment extends ObjectLiteralElement { + _propertyAssignmentBrand: any; + name: DeclarationName; + questionToken?: Node; + initializer: Expression; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { + name: Identifier; + questionToken?: Node; + } + interface VariableLikeDeclaration extends Declaration { + propertyName?: Identifier; + dotDotDotToken?: Node; + name: DeclarationName; + questionToken?: Node; + type?: TypeNode; + initializer?: Expression; + } + interface BindingPattern extends Node { + elements: NodeArray; + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { + _functionLikeDeclarationBrand: any; + asteriskToken?: Node; + questionToken?: Node; + body?: Block | Expression; + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { + name: Identifier; + body?: Block; + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + body?: Block; + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { + body?: Block; + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { + _accessorDeclarationBrand: any; + body: Block; + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { + _indexSignatureDeclarationBrand: any; + } + interface TypeNode extends Node { + _typeNodeBrand: any; + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { + _functionOrConstructorTypeNodeBrand: any; + } + interface TypeReferenceNode extends TypeNode { + typeName: EntityName; + typeArguments?: NodeArray; + } + interface TypeQueryNode extends TypeNode { + exprName: EntityName; + } + interface TypeLiteralNode extends TypeNode, Declaration { + members: NodeArray; + } + interface ArrayTypeNode extends TypeNode { + elementType: TypeNode; + } + interface TupleTypeNode extends TypeNode { + elementTypes: NodeArray; + } + interface UnionTypeNode extends TypeNode { + types: NodeArray; + } + interface ParenthesizedTypeNode extends TypeNode { + type: TypeNode; + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { + } + interface Expression extends Node { + _expressionBrand: any; + contextualType?: Type; + } + interface UnaryExpression extends Expression { + _unaryExpressionBrand: any; + } + interface PrefixUnaryExpression extends UnaryExpression { + operator: SyntaxKind; + operand: UnaryExpression; + } + interface PostfixUnaryExpression extends PostfixExpression { + operand: LeftHandSideExpression; + operator: SyntaxKind; + } + interface PostfixExpression extends UnaryExpression { + _postfixExpressionBrand: any; + } + interface LeftHandSideExpression extends PostfixExpression { + _leftHandSideExpressionBrand: any; + } + interface MemberExpression extends LeftHandSideExpression { + _memberExpressionBrand: any; + } + interface PrimaryExpression extends MemberExpression { + _primaryExpressionBrand: any; + } + interface DeleteExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface TypeOfExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface VoidExpression extends UnaryExpression { + expression: UnaryExpression; + } + interface YieldExpression extends Expression { + asteriskToken?: Node; + expression: Expression; + } + interface BinaryExpression extends Expression { + left: Expression; + operator: SyntaxKind; + right: Expression; + } + interface ConditionalExpression extends Expression { + condition: Expression; + whenTrue: Expression; + whenFalse: Expression; + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { + name?: Identifier; + body: Block | Expression; + } + interface LiteralExpression extends PrimaryExpression { + text: string; + isUnterminated?: boolean; + } + interface StringLiteralExpression extends LiteralExpression { + _stringLiteralExpressionBrand: any; + } + interface TemplateExpression extends PrimaryExpression { + head: LiteralExpression; + templateSpans: NodeArray; + } + interface TemplateSpan extends Node { + expression: Expression; + literal: LiteralExpression; + } + interface ParenthesizedExpression extends PrimaryExpression { + expression: Expression; + } + interface ArrayLiteralExpression extends PrimaryExpression { + elements: NodeArray; + } + interface SpreadElementExpression extends Expression { + expression: Expression; + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { + properties: NodeArray; + } + interface PropertyAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + name: Identifier; + } + interface ElementAccessExpression extends MemberExpression { + expression: LeftHandSideExpression; + argumentExpression?: Expression; + } + interface CallExpression extends LeftHandSideExpression { + expression: LeftHandSideExpression; + typeArguments?: NodeArray; + arguments: NodeArray; + } + interface NewExpression extends CallExpression, PrimaryExpression { + } + interface TaggedTemplateExpression extends MemberExpression { + tag: LeftHandSideExpression; + template: LiteralExpression | TemplateExpression; + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; + interface TypeAssertion extends UnaryExpression { + type: TypeNode; + expression: UnaryExpression; + } + interface Statement extends Node, ModuleElement { + _statementBrand: any; + } + interface Block extends Statement { + statements: NodeArray; + } + interface VariableStatement extends Statement { + declarationList: VariableDeclarationList; + } + interface ExpressionStatement extends Statement { + expression: Expression; + } + interface IfStatement extends Statement { + expression: Expression; + thenStatement: Statement; + elseStatement?: Statement; + } + interface IterationStatement extends Statement { + statement: Statement; + } + interface DoStatement extends IterationStatement { + expression: Expression; + } + interface WhileStatement extends IterationStatement { + expression: Expression; + } + interface ForStatement extends IterationStatement { + initializer?: VariableDeclarationList | Expression; + condition?: Expression; + iterator?: Expression; + } + interface ForInStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + interface BreakOrContinueStatement extends Statement { + label?: Identifier; + } + interface ReturnStatement extends Statement { + expression?: Expression; + } + interface WithStatement extends Statement { + expression: Expression; + statement: Statement; + } + interface SwitchStatement extends Statement { + expression: Expression; + clauses: NodeArray; + } + interface CaseClause extends Node { + expression?: Expression; + statements: NodeArray; + } + interface DefaultClause extends Node { + statements: NodeArray; + } + type CaseOrDefaultClause = CaseClause | DefaultClause; + interface LabeledStatement extends Statement { + label: Identifier; + statement: Statement; + } + interface ThrowStatement extends Statement { + expression: Expression; + } + interface TryStatement extends Statement { + tryBlock: Block; + catchClause?: CatchClause; + finallyBlock?: Block; + } + interface CatchClause extends Declaration { + name: Identifier; + type?: TypeNode; + block: Block; + } + interface ModuleElement extends Node { + _moduleElementBrand: any; + } + interface ClassDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface ClassElement extends Declaration { + _classElementBrand: any; + } + interface InterfaceDeclaration extends Declaration, ModuleElement { + name: Identifier; + typeParameters?: NodeArray; + heritageClauses?: NodeArray; + members: NodeArray; + } + interface HeritageClause extends Node { + token: SyntaxKind; + types?: NodeArray; + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { + name: Identifier; + type: TypeNode; + } + interface EnumMember extends Declaration { + name: DeclarationName; + initializer?: Expression; + } + interface EnumDeclaration extends Declaration, ModuleElement { + name: Identifier; + members: NodeArray; + } + interface ModuleDeclaration extends Declaration, ModuleElement { + name: Identifier | LiteralExpression; + body: ModuleBlock | ModuleDeclaration; + } + interface ModuleBlock extends Node, ModuleElement { + statements: NodeArray; + } + interface ImportDeclaration extends Declaration, ModuleElement { + name: Identifier; + moduleReference: EntityName | ExternalModuleReference; + } + interface ExternalModuleReference extends Node { + expression?: Expression; + } + interface ExportAssignment extends Statement, ModuleElement { + exportName: Identifier; + } + interface FileReference extends TextRange { + fileName: string; + } + interface CommentRange extends TextRange { + hasTrailingNewLine?: boolean; + } + interface SourceFile extends Declaration { + statements: NodeArray; + endOfFileToken: Node; + fileName: string; + text: string; + amdDependencies: string[]; + amdModuleName: string; + referencedFiles: FileReference[]; + hasNoDefaultLib: boolean; + externalModuleIndicator: Node; + languageVersion: ScriptTarget; + identifiers: Map; + } + interface ScriptReferenceHost { + getCompilerOptions(): CompilerOptions; + getSourceFile(fileName: string): SourceFile; + getCurrentDirectory(): string; + } + interface WriteFileCallback { + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + } + interface Program extends ScriptReferenceHost { + getSourceFiles(): SourceFile[]; + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getGlobalDiagnostics(): Diagnostic[]; + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; + getTypeChecker(): TypeChecker; + getCommonSourceDirectory(): string; + } + interface SourceMapSpan { + emittedLine: number; + emittedColumn: number; + sourceLine: number; + sourceColumn: number; + nameIndex?: number; + sourceIndex: number; + } + interface SourceMapData { + sourceMapFilePath: string; + jsSourceMappingURL: string; + sourceMapFile: string; + sourceMapSourceRoot: string; + sourceMapSources: string[]; + inputSourceFileNames: string[]; + sourceMapNames?: string[]; + sourceMapMappings: string; + sourceMapDecodedMappings: SourceMapSpan[]; + } + enum ExitStatus { + Success = 0, + DiagnosticsPresent_OutputsSkipped = 1, + DiagnosticsPresent_OutputsGenerated = 2, + } + interface EmitResult { + emitSkipped: boolean; + diagnostics: Diagnostic[]; + sourceMaps: SourceMapData[]; + } + interface TypeCheckerHost { + getCompilerOptions(): CompilerOptions; + getSourceFiles(): SourceFile[]; + getSourceFile(fileName: string): SourceFile; + } + interface TypeChecker { + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; + getDeclaredTypeOfSymbol(symbol: Symbol): Type; + getPropertiesOfType(type: Type): Symbol[]; + getPropertyOfType(type: Type, propertyName: string): Symbol; + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; + getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getReturnTypeOfSignature(signature: Signature): Type; + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; + getSymbolAtLocation(node: Node): Symbol; + getShorthandAssignmentValueSymbol(location: Node): Symbol; + getTypeAtLocation(node: Node): Type; + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; + getSymbolDisplayBuilder(): SymbolDisplayBuilder; + getFullyQualifiedName(symbol: Symbol): string; + getAugmentedPropertiesOfType(type: Type): Symbol[]; + getRootSymbols(symbol: Symbol): Symbol[]; + getContextualType(node: Expression): Type; + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + isUndefinedSymbol(symbol: Symbol): boolean; + isArgumentsSymbol(symbol: Symbol): boolean; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; + getAliasedSymbol(symbol: Symbol): Symbol; + } + interface SymbolDisplayBuilder { + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; + } + interface SymbolWriter { + writeKeyword(text: string): void; + writeOperator(text: string): void; + writePunctuation(text: string): void; + writeSpace(text: string): void; + writeStringLiteral(text: string): void; + writeParameter(text: string): void; + writeSymbol(text: string, symbol: Symbol): void; + writeLine(): void; + increaseIndent(): void; + decreaseIndent(): void; + clear(): void; + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; + } + const enum TypeFormatFlags { + None = 0, + WriteArrayAsGenericType = 1, + UseTypeOfFunction = 2, + NoTruncation = 4, + WriteArrowStyleSignature = 8, + WriteOwnNameForAnyLike = 16, + WriteTypeArgumentsOfSignature = 32, + InElementType = 64, + UseFullyQualifiedType = 128, + } + const enum SymbolFormatFlags { + None = 0, + WriteTypeParametersOrArguments = 1, + UseOnlyExternalAliasing = 2, + } + const enum SymbolAccessibility { + Accessible = 0, + NotAccessible = 1, + CannotBeNamed = 2, + } + interface SymbolVisibilityResult { + accessibility: SymbolAccessibility; + aliasesToMakeVisible?: ImportDeclaration[]; + errorSymbolName?: string; + errorNode?: Node; + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { + errorModuleName?: string; + } + interface EmitResolver { + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; + getExpressionNamePrefix(node: Identifier): string; + getExportAssignmentName(node: SourceFile): string; + isReferencedImportDeclaration(node: ImportDeclaration): boolean; + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + getNodeCheckFlags(node: Node): NodeCheckFlags; + isDeclarationVisible(node: Declaration): boolean; + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; + isUnknownIdentifier(location: Node, name: string): boolean; + } + const enum SymbolFlags { + FunctionScopedVariable = 1, + BlockScopedVariable = 2, + Property = 4, + EnumMember = 8, + Function = 16, + Class = 32, + Interface = 64, + ConstEnum = 128, + RegularEnum = 256, + ValueModule = 512, + NamespaceModule = 1024, + TypeLiteral = 2048, + ObjectLiteral = 4096, + Method = 8192, + Constructor = 16384, + GetAccessor = 32768, + SetAccessor = 65536, + Signature = 131072, + TypeParameter = 262144, + TypeAlias = 524288, + ExportValue = 1048576, + ExportType = 2097152, + ExportNamespace = 4194304, + Import = 8388608, + Instantiated = 16777216, + Merged = 33554432, + Transient = 67108864, + Prototype = 134217728, + UnionProperty = 268435456, + Optional = 536870912, + Enum = 384, + Variable = 3, + Value = 107455, + Type = 793056, + Namespace = 1536, + Module = 1536, + Accessor = 98304, + FunctionScopedVariableExcludes = 107454, + BlockScopedVariableExcludes = 107455, + ParameterExcludes = 107455, + PropertyExcludes = 107455, + EnumMemberExcludes = 107455, + FunctionExcludes = 106927, + ClassExcludes = 899583, + InterfaceExcludes = 792992, + RegularEnumExcludes = 899327, + ConstEnumExcludes = 899967, + ValueModuleExcludes = 106639, + NamespaceModuleExcludes = 0, + MethodExcludes = 99263, + GetAccessorExcludes = 41919, + SetAccessorExcludes = 74687, + TypeParameterExcludes = 530912, + TypeAliasExcludes = 793056, + ImportExcludes = 8388608, + ModuleMember = 8914931, + ExportHasLocal = 944, + HasLocals = 255504, + HasExports = 1952, + HasMembers = 6240, + IsContainer = 262128, + PropertyOrAccessor = 98308, + Export = 7340032, + } + interface Symbol { + flags: SymbolFlags; + name: string; + id?: number; + mergeId?: number; + declarations?: Declaration[]; + parent?: Symbol; + members?: SymbolTable; + exports?: SymbolTable; + exportSymbol?: Symbol; + valueDeclaration?: Declaration; + constEnumOnlyModule?: boolean; + } + interface SymbolLinks { + target?: Symbol; + type?: Type; + declaredType?: Type; + mapper?: TypeMapper; + referenced?: boolean; + exportAssignSymbol?: Symbol; + unionType?: UnionType; + } + interface TransientSymbol extends Symbol, SymbolLinks { + } + interface SymbolTable { + [index: string]: Symbol; + } + const enum NodeCheckFlags { + TypeChecked = 1, + LexicalThis = 2, + CaptureThis = 4, + EmitExtends = 8, + SuperInstance = 16, + SuperStatic = 32, + ContextChecked = 64, + EnumValuesComputed = 128, + } + interface NodeLinks { + resolvedType?: Type; + resolvedSignature?: Signature; + resolvedSymbol?: Symbol; + flags?: NodeCheckFlags; + enumMemberValue?: number; + isIllegalTypeReferenceInConstraint?: boolean; + isVisible?: boolean; + localModuleName?: string; + assignmentChecks?: Map; + hasReportedStatementInAmbientContext?: boolean; + importOnRightSide?: Symbol; + } + const enum TypeFlags { + Any = 1, + String = 2, + Number = 4, + Boolean = 8, + Void = 16, + Undefined = 32, + Null = 64, + Enum = 128, + StringLiteral = 256, + TypeParameter = 512, + Class = 1024, + Interface = 2048, + Reference = 4096, + Tuple = 8192, + Union = 16384, + Anonymous = 32768, + FromSignature = 65536, + ObjectLiteral = 131072, + ContainsUndefinedOrNull = 262144, + ContainsObjectLiteral = 524288, + Intrinsic = 127, + Primitive = 510, + StringLike = 258, + NumberLike = 132, + ObjectType = 48128, + RequiresWidening = 786432, + } + interface Type { + flags: TypeFlags; + id: number; + symbol?: Symbol; + } + interface IntrinsicType extends Type { + intrinsicName: string; + } + interface StringLiteralType extends Type { + text: string; + } + interface ObjectType extends Type { + } + interface InterfaceType extends ObjectType { + typeParameters: TypeParameter[]; + baseTypes: ObjectType[]; + declaredProperties: Symbol[]; + declaredCallSignatures: Signature[]; + declaredConstructSignatures: Signature[]; + declaredStringIndexType: Type; + declaredNumberIndexType: Type; + } + interface TypeReference extends ObjectType { + target: GenericType; + typeArguments: Type[]; + } + interface GenericType extends InterfaceType, TypeReference { + instantiations: Map; + } + interface TupleType extends ObjectType { + elementTypes: Type[]; + baseArrayType: TypeReference; + } + interface UnionType extends Type { + types: Type[]; + resolvedProperties: SymbolTable; + } + interface ResolvedType extends ObjectType, UnionType { + members: SymbolTable; + properties: Symbol[]; + callSignatures: Signature[]; + constructSignatures: Signature[]; + stringIndexType: Type; + numberIndexType: Type; + } + interface TypeParameter extends Type { + constraint: Type; + target?: TypeParameter; + mapper?: TypeMapper; + } + const enum SignatureKind { + Call = 0, + Construct = 1, + } + interface Signature { + declaration: SignatureDeclaration; + typeParameters: TypeParameter[]; + parameters: Symbol[]; + resolvedReturnType: Type; + minArgumentCount: number; + hasRestParameter: boolean; + hasStringLiterals: boolean; + target?: Signature; + mapper?: TypeMapper; + unionSignatures?: Signature[]; + erasedSignatureCache?: Signature; + isolatedSignatureType?: ObjectType; + } + const enum IndexKind { + String = 0, + Number = 1, + } + interface TypeMapper { + (t: Type): Type; + } + interface TypeInferences { + primary: Type[]; + secondary: Type[]; + } + interface InferenceContext { + typeParameters: TypeParameter[]; + inferUnionTypes: boolean; + inferences: TypeInferences[]; + inferredTypes: Type[]; + failedTypeParameterIndex?: number; + } + interface DiagnosticMessage { + key: string; + category: DiagnosticCategory; + code: number; + } + interface DiagnosticMessageChain { + messageText: string; + category: DiagnosticCategory; + code: number; + next?: DiagnosticMessageChain; + } + interface Diagnostic { + file: SourceFile; + start: number; + length: number; + messageText: string | DiagnosticMessageChain; + category: DiagnosticCategory; + code: number; + } + enum DiagnosticCategory { + Warning = 0, + Error = 1, + Message = 2, + } + interface CompilerOptions { + allowNonTsExtensions?: boolean; + charset?: string; + codepage?: number; + declaration?: boolean; + diagnostics?: boolean; + emitBOM?: boolean; + help?: boolean; + listFiles?: boolean; + locale?: string; + mapRoot?: string; + module?: ModuleKind; + noEmit?: boolean; + noEmitOnError?: boolean; + noErrorTruncation?: boolean; + noImplicitAny?: boolean; + noLib?: boolean; + noLibCheck?: boolean; + noResolve?: boolean; + out?: string; + outDir?: string; + preserveConstEnums?: boolean; + project?: string; + removeComments?: boolean; + sourceMap?: boolean; + sourceRoot?: string; + suppressImplicitAnyIndexErrors?: boolean; + target?: ScriptTarget; + version?: boolean; + watch?: boolean; + stripInternal?: boolean; + [option: string]: string | number | boolean; + } + const enum ModuleKind { + None = 0, + CommonJS = 1, + AMD = 2, + } + interface LineAndCharacter { + line: number; + character: number; + } + const enum ScriptTarget { + ES3 = 0, + ES5 = 1, + ES6 = 2, + Latest = 2, + } + interface ParsedCommandLine { + options: CompilerOptions; + fileNames: string[]; + errors: Diagnostic[]; + } + interface CommandLineOption { + name: string; + type: string | Map; + isFilePath?: boolean; + shortName?: string; + description?: DiagnosticMessage; + paramType?: DiagnosticMessage; + error?: DiagnosticMessage; + experimental?: boolean; + } + const enum CharacterCodes { + nullCharacter = 0, + maxAsciiCharacter = 127, + lineFeed = 10, + carriageReturn = 13, + lineSeparator = 8232, + paragraphSeparator = 8233, + nextLine = 133, + space = 32, + nonBreakingSpace = 160, + enQuad = 8192, + emQuad = 8193, + enSpace = 8194, + emSpace = 8195, + threePerEmSpace = 8196, + fourPerEmSpace = 8197, + sixPerEmSpace = 8198, + figureSpace = 8199, + punctuationSpace = 8200, + thinSpace = 8201, + hairSpace = 8202, + zeroWidthSpace = 8203, + narrowNoBreakSpace = 8239, + ideographicSpace = 12288, + mathematicalSpace = 8287, + ogham = 5760, + _ = 95, + $ = 36, + _0 = 48, + _1 = 49, + _2 = 50, + _3 = 51, + _4 = 52, + _5 = 53, + _6 = 54, + _7 = 55, + _8 = 56, + _9 = 57, + a = 97, + b = 98, + c = 99, + d = 100, + e = 101, + f = 102, + g = 103, + h = 104, + i = 105, + j = 106, + k = 107, + l = 108, + m = 109, + n = 110, + o = 111, + p = 112, + q = 113, + r = 114, + s = 115, + t = 116, + u = 117, + v = 118, + w = 119, + x = 120, + y = 121, + z = 122, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + ampersand = 38, + asterisk = 42, + at = 64, + backslash = 92, + backtick = 96, + bar = 124, + caret = 94, + closeBrace = 125, + closeBracket = 93, + closeParen = 41, + colon = 58, + comma = 44, + dot = 46, + doubleQuote = 34, + equals = 61, + exclamation = 33, + greaterThan = 62, + lessThan = 60, + minus = 45, + openBrace = 123, + openBracket = 91, + openParen = 40, + percent = 37, + plus = 43, + question = 63, + semicolon = 59, + singleQuote = 39, + slash = 47, + tilde = 126, + backspace = 8, + formFeed = 12, + byteOrderMark = 65279, + tab = 9, + verticalTab = 11, + } + interface CancellationToken { + isCancellationRequested(): boolean; + } + interface CompilerHost { + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; + getCancellationToken?(): CancellationToken; + writeFile: WriteFileCallback; + getCurrentDirectory(): string; + getCanonicalFileName(fileName: string): string; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + } + interface TextSpan { + start: number; + length: number; + } + interface TextChangeRange { + span: TextSpan; + newLength: number; + } +} +declare module "typescript" { + interface ErrorCallback { + (message: DiagnosticMessage, length: number): void; + } + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scan(): SyntaxKind; + setText(text: string): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + tryScan(callback: () => T): T; + } + function tokenToString(t: SyntaxKind): string; + function computeLineStarts(text: string): number[]; + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getLineStarts(sourceFile: SourceFile): number[]; + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + line: number; + character: number; + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function isWhiteSpace(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function isOctalDigit(ch: number): boolean; + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; + function createNode(kind: SyntaxKind): Node; + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; + function modifierToFlag(token: SyntaxKind): NodeFlags; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; + function isEvalOrArgumentsIdentifier(node: Node): boolean; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function isLeftHandSideExpression(expr: Expression): boolean; + function isAssignmentOperator(token: SyntaxKind): boolean; +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; + function getPreEmitDiagnostics(program: Program): Diagnostic[]; + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +} +declare module "typescript" { + var servicesVersion: string; + interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + getStart(sourceFile?: SourceFile): number; + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFile): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node; + getLastToken(sourceFile?: SourceFile): Node; + } + interface Symbol { + getFlags(): SymbolFlags; + getName(): string; + getDeclarations(): Declaration[]; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface Type { + getFlags(): TypeFlags; + getSymbol(): Symbol; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol; + getApparentProperties(): Symbol[]; + getCallSignatures(): Signature[]; + getConstructSignatures(): Signature[]; + getStringIndexType(): Type; + getNumberIndexType(): Type; + } + interface Signature { + getDeclaration(): SignatureDeclaration; + getTypeParameters(): Type[]; + getParameters(): Symbol[]; + getReturnType(): Type; + getDocumentationComment(): SymbolDisplayPart[]; + } + interface SourceFile { + version: string; + scriptSnapshot: IScriptSnapshot; + nameTable: Map; + getNamedDeclarations(): Declaration[]; + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineStarts(): number[]; + getPositionFromLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; + /** Gets the length of this script snapshot. */ + getLength(): number; + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; + } + module ScriptSnapshot { + function fromString(text: string): IScriptSnapshot; + } + interface PreProcessedFileInfo { + referencedFiles: FileReference[]; + importedFiles: FileReference[]; + isLibFile: boolean; + } + interface LanguageServiceHost { + getCompilationSettings(): CompilerOptions; + getNewLine?(): string; + getScriptFileNames(): string[]; + getScriptVersion(fileName: string): string; + getScriptSnapshot(fileName: string): IScriptSnapshot; + getLocalizedDiagnosticMessages?(): any; + getCancellationToken?(): CancellationToken; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + log?(s: string): void; + trace?(s: string): void; + error?(s: string): void; + } + interface LanguageService { + cleanupSemanticCache(): void; + getSyntacticDiagnostics(fileName: string): Diagnostic[]; + getSemanticDiagnostics(fileName: string): Diagnostic[]; + getCompilerOptionsDiagnostics(): Diagnostic[]; + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; + getRenameInfo(fileName: string, position: number): RenameInfo; + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; + getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigationBarItems(fileName: string): NavigationBarItem[]; + getOutliningSpans(fileName: string): OutliningSpan[]; + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getEmitOutput(fileName: string): EmitOutput; + getProgram(): Program; + getSourceFile(fileName: string): SourceFile; + dispose(): void; + } + interface ClassifiedSpan { + textSpan: TextSpan; + classificationType: string; + } + interface NavigationBarItem { + text: string; + kind: string; + kindModifiers: string; + spans: TextSpan[]; + childItems: NavigationBarItem[]; + indent: number; + bolded: boolean; + grayed: boolean; + } + interface TodoCommentDescriptor { + text: string; + priority: number; + } + interface TodoComment { + descriptor: TodoCommentDescriptor; + message: string; + position: number; + } + class TextChange { + span: TextSpan; + newText: string; + } + interface RenameLocation { + textSpan: TextSpan; + fileName: string; + } + interface ReferenceEntry { + textSpan: TextSpan; + fileName: string; + isWriteAccess: boolean; + } + interface NavigateToItem { + name: string; + kind: string; + kindModifiers: string; + matchKind: string; + fileName: string; + textSpan: TextSpan; + containerName: string; + containerKind: string; + } + interface EditorOptions { + IndentSize: number; + TabSize: number; + NewLineCharacter: string; + ConvertTabsToSpaces: boolean; + } + interface FormatCodeOptions extends EditorOptions { + InsertSpaceAfterCommaDelimiter: boolean; + InsertSpaceAfterSemicolonInForStatements: boolean; + InsertSpaceBeforeAndAfterBinaryOperators: boolean; + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + PlaceOpenBraceOnNewLineForFunctions: boolean; + PlaceOpenBraceOnNewLineForControlBlocks: boolean; + } + interface DefinitionInfo { + fileName: string; + textSpan: TextSpan; + kind: string; + name: string; + containerKind: string; + containerName: string; + } + enum SymbolDisplayPartKind { + aliasName = 0, + className = 1, + enumName = 2, + fieldName = 3, + interfaceName = 4, + keyword = 5, + lineBreak = 6, + numericLiteral = 7, + stringLiteral = 8, + localName = 9, + methodName = 10, + moduleName = 11, + operator = 12, + parameterName = 13, + propertyName = 14, + punctuation = 15, + space = 16, + text = 17, + typeParameterName = 18, + enumMemberName = 19, + functionName = 20, + regularExpressionLiteral = 21, + } + interface SymbolDisplayPart { + text: string; + kind: string; + } + interface QuickInfo { + kind: string; + kindModifiers: string; + textSpan: TextSpan; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface RenameInfo { + canRename: boolean; + localizedErrorMessage: string; + displayName: string; + fullDisplayName: string; + kind: string; + kindModifiers: string; + triggerSpan: TextSpan; + } + interface SignatureHelpParameter { + name: string; + documentation: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; + isOptional: boolean; + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { + isVariadic: boolean; + prefixDisplayParts: SymbolDisplayPart[]; + suffixDisplayParts: SymbolDisplayPart[]; + separatorDisplayParts: SymbolDisplayPart[]; + parameters: SignatureHelpParameter[]; + documentation: SymbolDisplayPart[]; + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { + items: SignatureHelpItem[]; + applicableSpan: TextSpan; + selectedItemIndex: number; + argumentIndex: number; + argumentCount: number; + } + interface CompletionInfo { + isMemberCompletion: boolean; + isNewIdentifierLocation: boolean; + entries: CompletionEntry[]; + } + interface CompletionEntry { + name: string; + kind: string; + kindModifiers: string; + } + interface CompletionEntryDetails { + name: string; + kind: string; + kindModifiers: string; + displayParts: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; + } + interface OutliningSpan { + /** The span of the document to actually collapse. */ + textSpan: TextSpan; + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; + /** The text to display in the editor for the collapsed region. */ + bannerText: string; + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; + } + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + const enum OutputFileType { + JavaScript = 0, + SourceMap = 1, + Declaration = 2, + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } + const enum EndOfLineState { + Start = 0, + InMultiLineCommentTrivia = 1, + InSingleQuoteStringLiteral = 2, + InDoubleQuoteStringLiteral = 3, + } + enum TokenClass { + Punctuation = 0, + Keyword = 1, + Operator = 2, + Comment = 3, + Whitespace = 4, + Identifier = 5, + NumberLiteral = 6, + StringLiteral = 7, + RegExpLiteral = 8, + } + interface ClassificationResult { + finalLexState: EndOfLineState; + entries: ClassificationInfo[]; + } + interface ClassificationInfo { + length: number; + classification: TokenClass; + } + interface Classifier { + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + } + class ScriptElementKind { + static unknown: string; + static keyword: string; + static scriptElement: string; + static moduleElement: string; + static classElement: string; + static interfaceElement: string; + static typeElement: string; + static enumElement: string; + static variableElement: string; + static localVariableElement: string; + static functionElement: string; + static localFunctionElement: string; + static memberFunctionElement: string; + static memberGetAccessorElement: string; + static memberSetAccessorElement: string; + static memberVariableElement: string; + static constructorImplementationElement: string; + static callSignatureElement: string; + static indexSignatureElement: string; + static constructSignatureElement: string; + static parameterElement: string; + static typeParameterElement: string; + static primitiveType: string; + static label: string; + static alias: string; + static constElement: string; + static letElement: string; + } + class ScriptElementKindModifier { + static none: string; + static publicMemberModifier: string; + static privateMemberModifier: string; + static protectedMemberModifier: string; + static exportedModifier: string; + static ambientModifier: string; + static staticModifier: string; + } + class ClassificationTypeNames { + static comment: string; + static identifier: string; + static keyword: string; + static numericLiteral: string; + static operator: string; + static stringLiteral: string; + static whiteSpace: string; + static text: string; + static punctuation: string; + static className: string; + static enumName: string; + static interfaceName: string; + static moduleName: string; + static typeParameterName: string; + static typeAlias: string; + } + interface DisplayPartsSymbolWriter extends SymbolWriter { + displayParts(): SymbolDisplayPart[]; + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; + function getDefaultCompilerOptions(): CompilerOptions; + class OperationCanceledException { + } + class CancellationTokenObject { + private cancellationToken; + static None: CancellationTokenObject; + constructor(cancellationToken: CancellationToken); + isCancellationRequested(): boolean; + throwIfCancellationRequested(): void; + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + var disableIncrementalParsing: boolean; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + function createDocumentRegistry(): DocumentRegistry; + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; + function createClassifier(): Classifier; + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +} + + +//// [APISample_watcher.js] +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ +var ts = require("typescript"); +function watch(rootFileNames, options) { + var files = {}; + // initialize the list of files + rootFileNames.forEach(function (fileName) { + files[fileName] = { version: 0 }; + }); + // Create the language service host to allow the LS to communicate with the host + var servicesHost = { + getScriptFileNames: function () { return rootFileNames; }, + getScriptVersion: function (fileName) { return files[fileName] && files[fileName].version.toString(); }, + getScriptSnapshot: function (fileName) { + if (!fs.existsSync(fileName)) { + return undefined; + } + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); + }, + getCurrentDirectory: function () { return process.cwd(); }, + getCompilationSettings: function () { return options; }, + getDefaultLibFileName: function (options) { return ts.getDefaultLibFilePath(options); } + }; + // Create the language service files + var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); + // Now let's watch the files + rootFileNames.forEach(function (fileName) { + // First time around, emit all files + emitFile(fileName); + // Add a watch on the file to handle next change + fs.watchFile(fileName, { persistent: true, interval: 250 }, function (curr, prev) { + // Check timestamp + if (+curr.mtime <= +prev.mtime) { + return; + } + // Update the version to signal a change in the file + files[fileName].version++; + // write the changes to disk + emitFile(fileName); + }); + }); + function emitFile(fileName) { + var output = services.getEmitOutput(fileName); + if (!output.emitSkipped) { + console.log("Emitting " + fileName); + } + else { + console.log("Emitting " + fileName + " failed"); + logErrors(fileName); + } + output.outputFiles.forEach(function (o) { + fs.writeFileSync(o.name, o.text, "utf8"); + }); + } + function logErrors(fileName) { + var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName)); + allDiagnostics.forEach(function (diagnostic) { + if (diagnostic.file) { + var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); + } + else { + console.log(" Error: " + diagnostic.messageText); + } + }); + } +} +// Initialize files constituting the program as all .ts files in the current directory +var currentDirectoryFiles = fs.readdirSync(process.cwd()).filter(function (fileName) { return fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"; }); +// Start the watcher +watch(currentDirectoryFiles, { module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types new file mode 100644 index 00000000000..3af8537fdb7 --- /dev/null +++ b/tests/baselines/reference/APISample_watcher.types @@ -0,0 +1,6210 @@ +=== tests/cases/compiler/APISample_watcher.ts === + +/* + * Note: This test is a public API sample. The sample sources can be found + at: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services + * Please log a "breaking change" issue for any API breaking change affecting this issue + */ + +declare var process: any; +>process : any + +declare var console: any; +>console : any + +declare var fs: any; +>fs : any + +declare var path: any; +>path : any + +import ts = require("typescript"); +>ts : typeof ts + +function watch(rootFileNames: string[], options: ts.CompilerOptions) { +>watch : (rootFileNames: string[], options: ts.CompilerOptions) => void +>rootFileNames : string[] +>options : ts.CompilerOptions +>ts : unknown +>CompilerOptions : ts.CompilerOptions + + var files: ts.Map<{ version: number }> = {}; +>files : ts.Map<{ version: number; }> +>ts : unknown +>Map : ts.Map +>version : number +>{} : { [x: string]: undefined; } + + // initialize the list of files + rootFileNames.forEach(fileName => { +>rootFileNames.forEach(fileName => { files[fileName] = { version: 0 }; }) : void +>rootFileNames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>rootFileNames : string[] +>forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>fileName => { files[fileName] = { version: 0 }; } : (fileName: string) => void +>fileName : string + + files[fileName] = { version: 0 }; +>files[fileName] = { version: 0 } : { version: number; } +>files[fileName] : { version: number; } +>files : ts.Map<{ version: number; }> +>fileName : string +>{ version: 0 } : { version: number; } +>version : number + + }); + + // Create the language service host to allow the LS to communicate with the host + var servicesHost: ts.LanguageServiceHost = { +>servicesHost : ts.LanguageServiceHost +>ts : unknown +>LanguageServiceHost : ts.LanguageServiceHost +>{ getScriptFileNames: () => rootFileNames, getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), getScriptSnapshot: (fileName) => { if (!fs.existsSync(fileName)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => options, getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), } : { getScriptFileNames: () => string[]; getScriptVersion: (fileName: string) => string; getScriptSnapshot: (fileName: string) => ts.IScriptSnapshot; getCurrentDirectory: () => any; getCompilationSettings: () => ts.CompilerOptions; getDefaultLibFileName: (options: ts.CompilerOptions) => string; } + + getScriptFileNames: () => rootFileNames, +>getScriptFileNames : () => string[] +>() => rootFileNames : () => string[] +>rootFileNames : string[] + + getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), +>getScriptVersion : (fileName: string) => string +>(fileName) => files[fileName] && files[fileName].version.toString() : (fileName: string) => string +>fileName : string +>files[fileName] && files[fileName].version.toString() : string +>files[fileName] : { version: number; } +>files : ts.Map<{ version: number; }> +>fileName : string +>files[fileName].version.toString() : string +>files[fileName].version.toString : (radix?: number) => string +>files[fileName].version : number +>files[fileName] : { version: number; } +>files : ts.Map<{ version: number; }> +>fileName : string +>version : number +>toString : (radix?: number) => string + + getScriptSnapshot: (fileName) => { +>getScriptSnapshot : (fileName: string) => ts.IScriptSnapshot +>(fileName) => { if (!fs.existsSync(fileName)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); } : (fileName: string) => ts.IScriptSnapshot +>fileName : string + + if (!fs.existsSync(fileName)) { +>!fs.existsSync(fileName) : boolean +>fs.existsSync(fileName) : any +>fs.existsSync : any +>fs : any +>existsSync : any +>fileName : string + + return undefined; +>undefined : undefined + } + + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); +>ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()) : ts.IScriptSnapshot +>ts.ScriptSnapshot.fromString : (text: string) => ts.IScriptSnapshot +>ts.ScriptSnapshot : typeof ts.ScriptSnapshot +>ts : typeof ts +>ScriptSnapshot : typeof ts.ScriptSnapshot +>fromString : (text: string) => ts.IScriptSnapshot +>fs.readFileSync(fileName).toString() : any +>fs.readFileSync(fileName).toString : any +>fs.readFileSync(fileName) : any +>fs.readFileSync : any +>fs : any +>readFileSync : any +>fileName : string +>toString : any + + }, + getCurrentDirectory: () => process.cwd(), +>getCurrentDirectory : () => any +>() => process.cwd() : () => any +>process.cwd() : any +>process.cwd : any +>process : any +>cwd : any + + getCompilationSettings: () => options, +>getCompilationSettings : () => ts.CompilerOptions +>() => options : () => ts.CompilerOptions +>options : ts.CompilerOptions + + getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), +>getDefaultLibFileName : (options: ts.CompilerOptions) => string +>(options) => ts.getDefaultLibFilePath(options) : (options: ts.CompilerOptions) => string +>options : ts.CompilerOptions +>ts.getDefaultLibFilePath(options) : string +>ts.getDefaultLibFilePath : (options: ts.CompilerOptions) => string +>ts : typeof ts +>getDefaultLibFilePath : (options: ts.CompilerOptions) => string +>options : ts.CompilerOptions + + }; + + // Create the language service files + var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) +>services : ts.LanguageService +>ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) : ts.LanguageService +>ts.createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService +>ts : typeof ts +>createLanguageService : (host: ts.LanguageServiceHost, documentRegistry?: ts.DocumentRegistry) => ts.LanguageService +>servicesHost : ts.LanguageServiceHost +>ts.createDocumentRegistry() : ts.DocumentRegistry +>ts.createDocumentRegistry : () => ts.DocumentRegistry +>ts : typeof ts +>createDocumentRegistry : () => ts.DocumentRegistry + + // Now let's watch the files + rootFileNames.forEach(fileName => { +>rootFileNames.forEach(fileName => { // First time around, emit all files emitFile(fileName); // Add a watch on the file to handle next change fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }); }) : void +>rootFileNames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>rootFileNames : string[] +>forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>fileName => { // First time around, emit all files emitFile(fileName); // Add a watch on the file to handle next change fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }); } : (fileName: string) => void +>fileName : string + + // First time around, emit all files + emitFile(fileName); +>emitFile(fileName) : void +>emitFile : (fileName: string) => void +>fileName : string + + // Add a watch on the file to handle next change + fs.watchFile(fileName, +>fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }) : any +>fs.watchFile : any +>fs : any +>watchFile : any +>fileName : string + + { persistent: true, interval: 250 }, +>{ persistent: true, interval: 250 } : { persistent: boolean; interval: number; } +>persistent : boolean +>interval : number + + (curr, prev) => { +>(curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); } : (curr: any, prev: any) => void +>curr : any +>prev : any + + // Check timestamp + if (+curr.mtime <= +prev.mtime) { +>+curr.mtime <= +prev.mtime : boolean +>+curr.mtime : number +>curr.mtime : any +>curr : any +>mtime : any +>+prev.mtime : number +>prev.mtime : any +>prev : any +>mtime : any + + return; + } + + // Update the version to signal a change in the file + files[fileName].version++; +>files[fileName].version++ : number +>files[fileName].version : number +>files[fileName] : { version: number; } +>files : ts.Map<{ version: number; }> +>fileName : string +>version : number + + // write the changes to disk + emitFile(fileName); +>emitFile(fileName) : void +>emitFile : (fileName: string) => void +>fileName : string + + }); + }); + + function emitFile(fileName: string) { +>emitFile : (fileName: string) => void +>fileName : string + + var output = services.getEmitOutput(fileName); +>output : ts.EmitOutput +>services.getEmitOutput(fileName) : ts.EmitOutput +>services.getEmitOutput : (fileName: string) => ts.EmitOutput +>services : ts.LanguageService +>getEmitOutput : (fileName: string) => ts.EmitOutput +>fileName : string + + if (!output.emitSkipped) { +>!output.emitSkipped : boolean +>output.emitSkipped : boolean +>output : ts.EmitOutput +>emitSkipped : boolean + + console.log(`Emitting ${fileName}`); +>console.log(`Emitting ${fileName}`) : any +>console.log : any +>console : any +>log : any +>fileName : string + } + else { + console.log(`Emitting ${fileName} failed`); +>console.log(`Emitting ${fileName} failed`) : any +>console.log : any +>console : any +>log : any +>fileName : string + + logErrors(fileName); +>logErrors(fileName) : void +>logErrors : (fileName: string) => void +>fileName : string + } + + output.outputFiles.forEach(o => { +>output.outputFiles.forEach(o => { fs.writeFileSync(o.name, o.text, "utf8"); }) : void +>output.outputFiles.forEach : (callbackfn: (value: ts.OutputFile, index: number, array: ts.OutputFile[]) => void, thisArg?: any) => void +>output.outputFiles : ts.OutputFile[] +>output : ts.EmitOutput +>outputFiles : ts.OutputFile[] +>forEach : (callbackfn: (value: ts.OutputFile, index: number, array: ts.OutputFile[]) => void, thisArg?: any) => void +>o => { fs.writeFileSync(o.name, o.text, "utf8"); } : (o: ts.OutputFile) => void +>o : ts.OutputFile + + fs.writeFileSync(o.name, o.text, "utf8"); +>fs.writeFileSync(o.name, o.text, "utf8") : any +>fs.writeFileSync : any +>fs : any +>writeFileSync : any +>o.name : string +>o : ts.OutputFile +>name : string +>o.text : string +>o : ts.OutputFile +>text : string + + }); + } + + function logErrors(fileName: string) { +>logErrors : (fileName: string) => void +>fileName : string + + var allDiagnostics = services.getCompilerOptionsDiagnostics() +>allDiagnostics : ts.Diagnostic[] +>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat(services.getSemanticDiagnostics(fileName)) : ts.Diagnostic[] +>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) : ts.Diagnostic[] +>services.getCompilerOptionsDiagnostics() .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>services.getCompilerOptionsDiagnostics() : ts.Diagnostic[] +>services.getCompilerOptionsDiagnostics : () => ts.Diagnostic[] +>services : ts.LanguageService +>getCompilerOptionsDiagnostics : () => ts.Diagnostic[] + + .concat(services.getSyntacticDiagnostics(fileName)) +>concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>services.getSyntacticDiagnostics(fileName) : ts.Diagnostic[] +>services.getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[] +>services : ts.LanguageService +>getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[] +>fileName : string + + .concat(services.getSemanticDiagnostics(fileName)); +>concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>services.getSemanticDiagnostics(fileName) : ts.Diagnostic[] +>services.getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[] +>services : ts.LanguageService +>getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[] +>fileName : string + + allDiagnostics.forEach(diagnostic => { +>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void +>allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void +>allDiagnostics : ts.Diagnostic[] +>forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void +>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void +>diagnostic : ts.Diagnostic + + if (diagnostic.file) { +>diagnostic.file : ts.SourceFile +>diagnostic : ts.Diagnostic +>file : ts.SourceFile + + var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); +>lineChar : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file : ts.SourceFile +>diagnostic : ts.Diagnostic +>file : ts.SourceFile +>getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.start : number +>diagnostic : ts.Diagnostic +>start : number + + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); +>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any +>console.log : any +>console : any +>log : any +>diagnostic.file.fileName : string +>diagnostic.file : ts.SourceFile +>diagnostic : ts.Diagnostic +>file : ts.SourceFile +>fileName : string +>lineChar.line : number +>lineChar : ts.LineAndCharacter +>line : number +>lineChar.character : number +>lineChar : ts.LineAndCharacter +>character : number +>ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n") : string +>ts.flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string +>ts : typeof ts +>flattenDiagnosticMessageText : (messageText: string | ts.DiagnosticMessageChain, newLine: string) => string +>diagnostic.messageText : string | ts.DiagnosticMessageChain +>diagnostic : ts.Diagnostic +>messageText : string | ts.DiagnosticMessageChain + } + else { + console.log(` Error: ${diagnostic.messageText}`); +>console.log(` Error: ${diagnostic.messageText}`) : any +>console.log : any +>console : any +>log : any +>diagnostic.messageText : string | ts.DiagnosticMessageChain +>diagnostic : ts.Diagnostic +>messageText : string | ts.DiagnosticMessageChain + } + }); + } +} + +// Initialize files constituting the program as all .ts files in the current directory +var currentDirectoryFiles = fs.readdirSync(process.cwd()). +>currentDirectoryFiles : any +>fs.readdirSync(process.cwd()). filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts") : any +>fs.readdirSync(process.cwd()). filter : any +>fs.readdirSync(process.cwd()) : any +>fs.readdirSync : any +>fs : any +>readdirSync : any +>process.cwd() : any +>process.cwd : any +>process : any +>cwd : any + + filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"); +>filter : any +>fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts" : (fileName: any) => boolean +>fileName : any +>fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts" : boolean +>fileName.length >= 3 : boolean +>fileName.length : any +>fileName : any +>length : any +>fileName.substr(fileName.length - 3, 3) === ".ts" : boolean +>fileName.substr(fileName.length - 3, 3) : any +>fileName.substr : any +>fileName : any +>substr : any +>fileName.length - 3 : number +>fileName.length : any +>fileName : any +>length : any + +// Start the watcher +watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); +>watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }) : void +>watch : (rootFileNames: string[], options: ts.CompilerOptions) => void +>currentDirectoryFiles : any +>{ module: ts.ModuleKind.CommonJS } : { [x: string]: ts.ModuleKind; module: ts.ModuleKind; } +>module : ts.ModuleKind +>ts.ModuleKind.CommonJS : ts.ModuleKind +>ts.ModuleKind : typeof ts.ModuleKind +>ts : typeof ts +>ModuleKind : typeof ts.ModuleKind +>CommonJS : ts.ModuleKind + +=== typescript.d.ts === +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +declare module "typescript" { + interface Map { +>Map : Map +>T : T + + [index: string]: T; +>index : string +>T : T + } + interface TextRange { +>TextRange : TextRange + + pos: number; +>pos : number + + end: number; +>end : number + } + const enum SyntaxKind { +>SyntaxKind : SyntaxKind + + Unknown = 0, +>Unknown : SyntaxKind + + EndOfFileToken = 1, +>EndOfFileToken : SyntaxKind + + SingleLineCommentTrivia = 2, +>SingleLineCommentTrivia : SyntaxKind + + MultiLineCommentTrivia = 3, +>MultiLineCommentTrivia : SyntaxKind + + NewLineTrivia = 4, +>NewLineTrivia : SyntaxKind + + WhitespaceTrivia = 5, +>WhitespaceTrivia : SyntaxKind + + ConflictMarkerTrivia = 6, +>ConflictMarkerTrivia : SyntaxKind + + NumericLiteral = 7, +>NumericLiteral : SyntaxKind + + StringLiteral = 8, +>StringLiteral : SyntaxKind + + RegularExpressionLiteral = 9, +>RegularExpressionLiteral : SyntaxKind + + NoSubstitutionTemplateLiteral = 10, +>NoSubstitutionTemplateLiteral : SyntaxKind + + TemplateHead = 11, +>TemplateHead : SyntaxKind + + TemplateMiddle = 12, +>TemplateMiddle : SyntaxKind + + TemplateTail = 13, +>TemplateTail : SyntaxKind + + OpenBraceToken = 14, +>OpenBraceToken : SyntaxKind + + CloseBraceToken = 15, +>CloseBraceToken : SyntaxKind + + OpenParenToken = 16, +>OpenParenToken : SyntaxKind + + CloseParenToken = 17, +>CloseParenToken : SyntaxKind + + OpenBracketToken = 18, +>OpenBracketToken : SyntaxKind + + CloseBracketToken = 19, +>CloseBracketToken : SyntaxKind + + DotToken = 20, +>DotToken : SyntaxKind + + DotDotDotToken = 21, +>DotDotDotToken : SyntaxKind + + SemicolonToken = 22, +>SemicolonToken : SyntaxKind + + CommaToken = 23, +>CommaToken : SyntaxKind + + LessThanToken = 24, +>LessThanToken : SyntaxKind + + GreaterThanToken = 25, +>GreaterThanToken : SyntaxKind + + LessThanEqualsToken = 26, +>LessThanEqualsToken : SyntaxKind + + GreaterThanEqualsToken = 27, +>GreaterThanEqualsToken : SyntaxKind + + EqualsEqualsToken = 28, +>EqualsEqualsToken : SyntaxKind + + ExclamationEqualsToken = 29, +>ExclamationEqualsToken : SyntaxKind + + EqualsEqualsEqualsToken = 30, +>EqualsEqualsEqualsToken : SyntaxKind + + ExclamationEqualsEqualsToken = 31, +>ExclamationEqualsEqualsToken : SyntaxKind + + EqualsGreaterThanToken = 32, +>EqualsGreaterThanToken : SyntaxKind + + PlusToken = 33, +>PlusToken : SyntaxKind + + MinusToken = 34, +>MinusToken : SyntaxKind + + AsteriskToken = 35, +>AsteriskToken : SyntaxKind + + SlashToken = 36, +>SlashToken : SyntaxKind + + PercentToken = 37, +>PercentToken : SyntaxKind + + PlusPlusToken = 38, +>PlusPlusToken : SyntaxKind + + MinusMinusToken = 39, +>MinusMinusToken : SyntaxKind + + LessThanLessThanToken = 40, +>LessThanLessThanToken : SyntaxKind + + GreaterThanGreaterThanToken = 41, +>GreaterThanGreaterThanToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanToken = 42, +>GreaterThanGreaterThanGreaterThanToken : SyntaxKind + + AmpersandToken = 43, +>AmpersandToken : SyntaxKind + + BarToken = 44, +>BarToken : SyntaxKind + + CaretToken = 45, +>CaretToken : SyntaxKind + + ExclamationToken = 46, +>ExclamationToken : SyntaxKind + + TildeToken = 47, +>TildeToken : SyntaxKind + + AmpersandAmpersandToken = 48, +>AmpersandAmpersandToken : SyntaxKind + + BarBarToken = 49, +>BarBarToken : SyntaxKind + + QuestionToken = 50, +>QuestionToken : SyntaxKind + + ColonToken = 51, +>ColonToken : SyntaxKind + + EqualsToken = 52, +>EqualsToken : SyntaxKind + + PlusEqualsToken = 53, +>PlusEqualsToken : SyntaxKind + + MinusEqualsToken = 54, +>MinusEqualsToken : SyntaxKind + + AsteriskEqualsToken = 55, +>AsteriskEqualsToken : SyntaxKind + + SlashEqualsToken = 56, +>SlashEqualsToken : SyntaxKind + + PercentEqualsToken = 57, +>PercentEqualsToken : SyntaxKind + + LessThanLessThanEqualsToken = 58, +>LessThanLessThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanEqualsToken = 59, +>GreaterThanGreaterThanEqualsToken : SyntaxKind + + GreaterThanGreaterThanGreaterThanEqualsToken = 60, +>GreaterThanGreaterThanGreaterThanEqualsToken : SyntaxKind + + AmpersandEqualsToken = 61, +>AmpersandEqualsToken : SyntaxKind + + BarEqualsToken = 62, +>BarEqualsToken : SyntaxKind + + CaretEqualsToken = 63, +>CaretEqualsToken : SyntaxKind + + Identifier = 64, +>Identifier : SyntaxKind + + BreakKeyword = 65, +>BreakKeyword : SyntaxKind + + CaseKeyword = 66, +>CaseKeyword : SyntaxKind + + CatchKeyword = 67, +>CatchKeyword : SyntaxKind + + ClassKeyword = 68, +>ClassKeyword : SyntaxKind + + ConstKeyword = 69, +>ConstKeyword : SyntaxKind + + ContinueKeyword = 70, +>ContinueKeyword : SyntaxKind + + DebuggerKeyword = 71, +>DebuggerKeyword : SyntaxKind + + DefaultKeyword = 72, +>DefaultKeyword : SyntaxKind + + DeleteKeyword = 73, +>DeleteKeyword : SyntaxKind + + DoKeyword = 74, +>DoKeyword : SyntaxKind + + ElseKeyword = 75, +>ElseKeyword : SyntaxKind + + EnumKeyword = 76, +>EnumKeyword : SyntaxKind + + ExportKeyword = 77, +>ExportKeyword : SyntaxKind + + ExtendsKeyword = 78, +>ExtendsKeyword : SyntaxKind + + FalseKeyword = 79, +>FalseKeyword : SyntaxKind + + FinallyKeyword = 80, +>FinallyKeyword : SyntaxKind + + ForKeyword = 81, +>ForKeyword : SyntaxKind + + FunctionKeyword = 82, +>FunctionKeyword : SyntaxKind + + IfKeyword = 83, +>IfKeyword : SyntaxKind + + ImportKeyword = 84, +>ImportKeyword : SyntaxKind + + InKeyword = 85, +>InKeyword : SyntaxKind + + InstanceOfKeyword = 86, +>InstanceOfKeyword : SyntaxKind + + NewKeyword = 87, +>NewKeyword : SyntaxKind + + NullKeyword = 88, +>NullKeyword : SyntaxKind + + ReturnKeyword = 89, +>ReturnKeyword : SyntaxKind + + SuperKeyword = 90, +>SuperKeyword : SyntaxKind + + SwitchKeyword = 91, +>SwitchKeyword : SyntaxKind + + ThisKeyword = 92, +>ThisKeyword : SyntaxKind + + ThrowKeyword = 93, +>ThrowKeyword : SyntaxKind + + TrueKeyword = 94, +>TrueKeyword : SyntaxKind + + TryKeyword = 95, +>TryKeyword : SyntaxKind + + TypeOfKeyword = 96, +>TypeOfKeyword : SyntaxKind + + VarKeyword = 97, +>VarKeyword : SyntaxKind + + VoidKeyword = 98, +>VoidKeyword : SyntaxKind + + WhileKeyword = 99, +>WhileKeyword : SyntaxKind + + WithKeyword = 100, +>WithKeyword : SyntaxKind + + ImplementsKeyword = 101, +>ImplementsKeyword : SyntaxKind + + InterfaceKeyword = 102, +>InterfaceKeyword : SyntaxKind + + LetKeyword = 103, +>LetKeyword : SyntaxKind + + PackageKeyword = 104, +>PackageKeyword : SyntaxKind + + PrivateKeyword = 105, +>PrivateKeyword : SyntaxKind + + ProtectedKeyword = 106, +>ProtectedKeyword : SyntaxKind + + PublicKeyword = 107, +>PublicKeyword : SyntaxKind + + StaticKeyword = 108, +>StaticKeyword : SyntaxKind + + YieldKeyword = 109, +>YieldKeyword : SyntaxKind + + AnyKeyword = 110, +>AnyKeyword : SyntaxKind + + BooleanKeyword = 111, +>BooleanKeyword : SyntaxKind + + ConstructorKeyword = 112, +>ConstructorKeyword : SyntaxKind + + DeclareKeyword = 113, +>DeclareKeyword : SyntaxKind + + GetKeyword = 114, +>GetKeyword : SyntaxKind + + ModuleKeyword = 115, +>ModuleKeyword : SyntaxKind + + RequireKeyword = 116, +>RequireKeyword : SyntaxKind + + NumberKeyword = 117, +>NumberKeyword : SyntaxKind + + SetKeyword = 118, +>SetKeyword : SyntaxKind + + StringKeyword = 119, +>StringKeyword : SyntaxKind + + TypeKeyword = 120, +>TypeKeyword : SyntaxKind + + QualifiedName = 121, +>QualifiedName : SyntaxKind + + ComputedPropertyName = 122, +>ComputedPropertyName : SyntaxKind + + TypeParameter = 123, +>TypeParameter : SyntaxKind + + Parameter = 124, +>Parameter : SyntaxKind + + PropertySignature = 125, +>PropertySignature : SyntaxKind + + PropertyDeclaration = 126, +>PropertyDeclaration : SyntaxKind + + MethodSignature = 127, +>MethodSignature : SyntaxKind + + MethodDeclaration = 128, +>MethodDeclaration : SyntaxKind + + Constructor = 129, +>Constructor : SyntaxKind + + GetAccessor = 130, +>GetAccessor : SyntaxKind + + SetAccessor = 131, +>SetAccessor : SyntaxKind + + CallSignature = 132, +>CallSignature : SyntaxKind + + ConstructSignature = 133, +>ConstructSignature : SyntaxKind + + IndexSignature = 134, +>IndexSignature : SyntaxKind + + TypeReference = 135, +>TypeReference : SyntaxKind + + FunctionType = 136, +>FunctionType : SyntaxKind + + ConstructorType = 137, +>ConstructorType : SyntaxKind + + TypeQuery = 138, +>TypeQuery : SyntaxKind + + TypeLiteral = 139, +>TypeLiteral : SyntaxKind + + ArrayType = 140, +>ArrayType : SyntaxKind + + TupleType = 141, +>TupleType : SyntaxKind + + UnionType = 142, +>UnionType : SyntaxKind + + ParenthesizedType = 143, +>ParenthesizedType : SyntaxKind + + ObjectBindingPattern = 144, +>ObjectBindingPattern : SyntaxKind + + ArrayBindingPattern = 145, +>ArrayBindingPattern : SyntaxKind + + BindingElement = 146, +>BindingElement : SyntaxKind + + ArrayLiteralExpression = 147, +>ArrayLiteralExpression : SyntaxKind + + ObjectLiteralExpression = 148, +>ObjectLiteralExpression : SyntaxKind + + PropertyAccessExpression = 149, +>PropertyAccessExpression : SyntaxKind + + ElementAccessExpression = 150, +>ElementAccessExpression : SyntaxKind + + CallExpression = 151, +>CallExpression : SyntaxKind + + NewExpression = 152, +>NewExpression : SyntaxKind + + TaggedTemplateExpression = 153, +>TaggedTemplateExpression : SyntaxKind + + TypeAssertionExpression = 154, +>TypeAssertionExpression : SyntaxKind + + ParenthesizedExpression = 155, +>ParenthesizedExpression : SyntaxKind + + FunctionExpression = 156, +>FunctionExpression : SyntaxKind + + ArrowFunction = 157, +>ArrowFunction : SyntaxKind + + DeleteExpression = 158, +>DeleteExpression : SyntaxKind + + TypeOfExpression = 159, +>TypeOfExpression : SyntaxKind + + VoidExpression = 160, +>VoidExpression : SyntaxKind + + PrefixUnaryExpression = 161, +>PrefixUnaryExpression : SyntaxKind + + PostfixUnaryExpression = 162, +>PostfixUnaryExpression : SyntaxKind + + BinaryExpression = 163, +>BinaryExpression : SyntaxKind + + ConditionalExpression = 164, +>ConditionalExpression : SyntaxKind + + TemplateExpression = 165, +>TemplateExpression : SyntaxKind + + YieldExpression = 166, +>YieldExpression : SyntaxKind + + SpreadElementExpression = 167, +>SpreadElementExpression : SyntaxKind + + OmittedExpression = 168, +>OmittedExpression : SyntaxKind + + TemplateSpan = 169, +>TemplateSpan : SyntaxKind + + Block = 170, +>Block : SyntaxKind + + VariableStatement = 171, +>VariableStatement : SyntaxKind + + EmptyStatement = 172, +>EmptyStatement : SyntaxKind + + ExpressionStatement = 173, +>ExpressionStatement : SyntaxKind + + IfStatement = 174, +>IfStatement : SyntaxKind + + DoStatement = 175, +>DoStatement : SyntaxKind + + WhileStatement = 176, +>WhileStatement : SyntaxKind + + ForStatement = 177, +>ForStatement : SyntaxKind + + ForInStatement = 178, +>ForInStatement : SyntaxKind + + ContinueStatement = 179, +>ContinueStatement : SyntaxKind + + BreakStatement = 180, +>BreakStatement : SyntaxKind + + ReturnStatement = 181, +>ReturnStatement : SyntaxKind + + WithStatement = 182, +>WithStatement : SyntaxKind + + SwitchStatement = 183, +>SwitchStatement : SyntaxKind + + LabeledStatement = 184, +>LabeledStatement : SyntaxKind + + ThrowStatement = 185, +>ThrowStatement : SyntaxKind + + TryStatement = 186, +>TryStatement : SyntaxKind + + DebuggerStatement = 187, +>DebuggerStatement : SyntaxKind + + VariableDeclaration = 188, +>VariableDeclaration : SyntaxKind + + VariableDeclarationList = 189, +>VariableDeclarationList : SyntaxKind + + FunctionDeclaration = 190, +>FunctionDeclaration : SyntaxKind + + ClassDeclaration = 191, +>ClassDeclaration : SyntaxKind + + InterfaceDeclaration = 192, +>InterfaceDeclaration : SyntaxKind + + TypeAliasDeclaration = 193, +>TypeAliasDeclaration : SyntaxKind + + EnumDeclaration = 194, +>EnumDeclaration : SyntaxKind + + ModuleDeclaration = 195, +>ModuleDeclaration : SyntaxKind + + ModuleBlock = 196, +>ModuleBlock : SyntaxKind + + ImportDeclaration = 197, +>ImportDeclaration : SyntaxKind + + ExportAssignment = 198, +>ExportAssignment : SyntaxKind + + ExternalModuleReference = 199, +>ExternalModuleReference : SyntaxKind + + CaseClause = 200, +>CaseClause : SyntaxKind + + DefaultClause = 201, +>DefaultClause : SyntaxKind + + HeritageClause = 202, +>HeritageClause : SyntaxKind + + CatchClause = 203, +>CatchClause : SyntaxKind + + PropertyAssignment = 204, +>PropertyAssignment : SyntaxKind + + ShorthandPropertyAssignment = 205, +>ShorthandPropertyAssignment : SyntaxKind + + EnumMember = 206, +>EnumMember : SyntaxKind + + SourceFile = 207, +>SourceFile : SyntaxKind + + SyntaxList = 208, +>SyntaxList : SyntaxKind + + Count = 209, +>Count : SyntaxKind + + FirstAssignment = 52, +>FirstAssignment : SyntaxKind + + LastAssignment = 63, +>LastAssignment : SyntaxKind + + FirstReservedWord = 65, +>FirstReservedWord : SyntaxKind + + LastReservedWord = 100, +>LastReservedWord : SyntaxKind + + FirstKeyword = 65, +>FirstKeyword : SyntaxKind + + LastKeyword = 120, +>LastKeyword : SyntaxKind + + FirstFutureReservedWord = 101, +>FirstFutureReservedWord : SyntaxKind + + LastFutureReservedWord = 109, +>LastFutureReservedWord : SyntaxKind + + FirstTypeNode = 135, +>FirstTypeNode : SyntaxKind + + LastTypeNode = 143, +>LastTypeNode : SyntaxKind + + FirstPunctuation = 14, +>FirstPunctuation : SyntaxKind + + LastPunctuation = 63, +>LastPunctuation : SyntaxKind + + FirstToken = 0, +>FirstToken : SyntaxKind + + LastToken = 120, +>LastToken : SyntaxKind + + FirstTriviaToken = 2, +>FirstTriviaToken : SyntaxKind + + LastTriviaToken = 6, +>LastTriviaToken : SyntaxKind + + FirstLiteralToken = 7, +>FirstLiteralToken : SyntaxKind + + LastLiteralToken = 10, +>LastLiteralToken : SyntaxKind + + FirstTemplateToken = 10, +>FirstTemplateToken : SyntaxKind + + LastTemplateToken = 13, +>LastTemplateToken : SyntaxKind + + FirstBinaryOperator = 24, +>FirstBinaryOperator : SyntaxKind + + LastBinaryOperator = 63, +>LastBinaryOperator : SyntaxKind + + FirstNode = 121, +>FirstNode : SyntaxKind + } + const enum NodeFlags { +>NodeFlags : NodeFlags + + Export = 1, +>Export : NodeFlags + + Ambient = 2, +>Ambient : NodeFlags + + Public = 16, +>Public : NodeFlags + + Private = 32, +>Private : NodeFlags + + Protected = 64, +>Protected : NodeFlags + + Static = 128, +>Static : NodeFlags + + MultiLine = 256, +>MultiLine : NodeFlags + + Synthetic = 512, +>Synthetic : NodeFlags + + DeclarationFile = 1024, +>DeclarationFile : NodeFlags + + Let = 2048, +>Let : NodeFlags + + Const = 4096, +>Const : NodeFlags + + OctalLiteral = 8192, +>OctalLiteral : NodeFlags + + Modifier = 243, +>Modifier : NodeFlags + + AccessibilityModifier = 112, +>AccessibilityModifier : NodeFlags + + BlockScoped = 6144, +>BlockScoped : NodeFlags + } + const enum ParserContextFlags { +>ParserContextFlags : ParserContextFlags + + StrictMode = 1, +>StrictMode : ParserContextFlags + + DisallowIn = 2, +>DisallowIn : ParserContextFlags + + Yield = 4, +>Yield : ParserContextFlags + + GeneratorParameter = 8, +>GeneratorParameter : ParserContextFlags + + ThisNodeHasError = 16, +>ThisNodeHasError : ParserContextFlags + + ParserGeneratedFlags = 31, +>ParserGeneratedFlags : ParserContextFlags + + ThisNodeOrAnySubNodesHasError = 32, +>ThisNodeOrAnySubNodesHasError : ParserContextFlags + + HasAggregatedChildData = 64, +>HasAggregatedChildData : ParserContextFlags + } + const enum RelationComparisonResult { +>RelationComparisonResult : RelationComparisonResult + + Succeeded = 1, +>Succeeded : RelationComparisonResult + + Failed = 2, +>Failed : RelationComparisonResult + + FailedAndReported = 3, +>FailedAndReported : RelationComparisonResult + } + interface Node extends TextRange { +>Node : Node +>TextRange : TextRange + + kind: SyntaxKind; +>kind : SyntaxKind +>SyntaxKind : SyntaxKind + + flags: NodeFlags; +>flags : NodeFlags +>NodeFlags : NodeFlags + + parserContextFlags?: ParserContextFlags; +>parserContextFlags : ParserContextFlags +>ParserContextFlags : ParserContextFlags + + id?: number; +>id : number + + parent?: Node; +>parent : Node +>Node : Node + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + + locals?: SymbolTable; +>locals : SymbolTable +>SymbolTable : SymbolTable + + nextContainer?: Node; +>nextContainer : Node +>Node : Node + + localSymbol?: Symbol; +>localSymbol : Symbol +>Symbol : Symbol + + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + } + interface NodeArray extends Array, TextRange { +>NodeArray : NodeArray +>T : T +>Array : T[] +>T : T +>TextRange : TextRange + + hasTrailingComma?: boolean; +>hasTrailingComma : boolean + } + interface ModifiersArray extends NodeArray { +>ModifiersArray : ModifiersArray +>NodeArray : NodeArray +>Node : Node + + flags: number; +>flags : number + } + interface Identifier extends PrimaryExpression { +>Identifier : Identifier +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + } + interface QualifiedName extends Node { +>QualifiedName : QualifiedName +>Node : Node + + left: EntityName; +>left : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + right: Identifier; +>right : Identifier +>Identifier : Identifier + } + type EntityName = Identifier | QualifiedName; +>EntityName : Identifier | QualifiedName +>Identifier : Identifier +>QualifiedName : QualifiedName + + type DeclarationName = Identifier | LiteralExpression | ComputedPropertyName | BindingPattern; +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>Identifier : Identifier +>LiteralExpression : LiteralExpression +>ComputedPropertyName : ComputedPropertyName +>BindingPattern : BindingPattern + + interface Declaration extends Node { +>Declaration : Declaration +>Node : Node + + _declarationBrand: any; +>_declarationBrand : any + + name?: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + } + interface ComputedPropertyName extends Node { +>ComputedPropertyName : ComputedPropertyName +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TypeParameterDeclaration extends Declaration { +>TypeParameterDeclaration : TypeParameterDeclaration +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + constraint?: TypeNode; +>constraint : TypeNode +>TypeNode : TypeNode + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface SignatureDeclaration extends Declaration { +>SignatureDeclaration : SignatureDeclaration +>Declaration : Declaration + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + parameters: NodeArray; +>parameters : NodeArray +>NodeArray : NodeArray +>ParameterDeclaration : ParameterDeclaration + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface VariableDeclaration extends Declaration { +>VariableDeclaration : VariableDeclaration +>Declaration : Declaration + + parent?: VariableDeclarationList; +>parent : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface VariableDeclarationList extends Node { +>VariableDeclarationList : VariableDeclarationList +>Node : Node + + declarations: NodeArray; +>declarations : NodeArray +>NodeArray : NodeArray +>VariableDeclaration : VariableDeclaration + } + interface ParameterDeclaration extends Declaration { +>ParameterDeclaration : ParameterDeclaration +>Declaration : Declaration + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingElement extends Declaration { +>BindingElement : BindingElement +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: Identifier | BindingPattern; +>name : Identifier | BindingPattern +>Identifier : Identifier +>BindingPattern : BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface PropertyDeclaration extends Declaration, ClassElement { +>PropertyDeclaration : PropertyDeclaration +>Declaration : Declaration +>ClassElement : ClassElement + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface ObjectLiteralElement extends Declaration { +>ObjectLiteralElement : ObjectLiteralElement +>Declaration : Declaration + + _objectLiteralBrandBrand: any; +>_objectLiteralBrandBrand : any + } + interface PropertyAssignment extends ObjectLiteralElement { +>PropertyAssignment : PropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + _propertyAssignmentBrand: any; +>_propertyAssignmentBrand : any + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + initializer: Expression; +>initializer : Expression +>Expression : Expression + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement { +>ShorthandPropertyAssignment : ShorthandPropertyAssignment +>ObjectLiteralElement : ObjectLiteralElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + questionToken?: Node; +>questionToken : Node +>Node : Node + } + interface VariableLikeDeclaration extends Declaration { +>VariableLikeDeclaration : VariableLikeDeclaration +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + dotDotDotToken?: Node; +>dotDotDotToken : Node +>Node : Node + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + questionToken?: Node; +>questionToken : Node +>Node : Node + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface BindingPattern extends Node { +>BindingPattern : BindingPattern +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>BindingElement : BindingElement + } + /** + * Several node kinds share function-like features such as a signature, + * a name, and a body. These nodes should extend FunctionLikeDeclaration. + * Examples: + * FunctionDeclaration + * MethodDeclaration + * AccessorDeclaration + */ + interface FunctionLikeDeclaration extends SignatureDeclaration { +>FunctionLikeDeclaration : FunctionLikeDeclaration +>SignatureDeclaration : SignatureDeclaration + + _functionLikeDeclarationBrand: any; +>_functionLikeDeclarationBrand : any + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + questionToken?: Node; +>questionToken : Node +>Node : Node + + body?: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface FunctionDeclaration extends FunctionLikeDeclaration, Statement { +>FunctionDeclaration : FunctionDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>Statement : Statement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + body?: Block; +>body : Block +>Block : Block + } + interface MethodDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>MethodDeclaration : MethodDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + body?: Block; +>body : Block +>Block : Block + } + interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { +>ConstructorDeclaration : ConstructorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement + + body?: Block; +>body : Block +>Block : Block + } + interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { +>AccessorDeclaration : AccessorDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration +>ClassElement : ClassElement +>ObjectLiteralElement : ObjectLiteralElement + + _accessorDeclarationBrand: any; +>_accessorDeclarationBrand : any + + body: Block; +>body : Block +>Block : Block + } + interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement { +>IndexSignatureDeclaration : IndexSignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>ClassElement : ClassElement + + _indexSignatureDeclarationBrand: any; +>_indexSignatureDeclarationBrand : any + } + interface TypeNode extends Node { +>TypeNode : TypeNode +>Node : Node + + _typeNodeBrand: any; +>_typeNodeBrand : any + } + interface FunctionOrConstructorTypeNode extends TypeNode, SignatureDeclaration { +>FunctionOrConstructorTypeNode : FunctionOrConstructorTypeNode +>TypeNode : TypeNode +>SignatureDeclaration : SignatureDeclaration + + _functionOrConstructorTypeNodeBrand: any; +>_functionOrConstructorTypeNodeBrand : any + } + interface TypeReferenceNode extends TypeNode { +>TypeReferenceNode : TypeReferenceNode +>TypeNode : TypeNode + + typeName: EntityName; +>typeName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface TypeQueryNode extends TypeNode { +>TypeQueryNode : TypeQueryNode +>TypeNode : TypeNode + + exprName: EntityName; +>exprName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName + } + interface TypeLiteralNode extends TypeNode, Declaration { +>TypeLiteralNode : TypeLiteralNode +>TypeNode : TypeNode +>Declaration : Declaration + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Node : Node + } + interface ArrayTypeNode extends TypeNode { +>ArrayTypeNode : ArrayTypeNode +>TypeNode : TypeNode + + elementType: TypeNode; +>elementType : TypeNode +>TypeNode : TypeNode + } + interface TupleTypeNode extends TypeNode { +>TupleTypeNode : TupleTypeNode +>TypeNode : TypeNode + + elementTypes: NodeArray; +>elementTypes : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface UnionTypeNode extends TypeNode { +>UnionTypeNode : UnionTypeNode +>TypeNode : TypeNode + + types: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + } + interface ParenthesizedTypeNode extends TypeNode { +>ParenthesizedTypeNode : ParenthesizedTypeNode +>TypeNode : TypeNode + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface StringLiteralTypeNode extends LiteralExpression, TypeNode { +>StringLiteralTypeNode : StringLiteralTypeNode +>LiteralExpression : LiteralExpression +>TypeNode : TypeNode + } + interface Expression extends Node { +>Expression : Expression +>Node : Node + + _expressionBrand: any; +>_expressionBrand : any + + contextualType?: Type; +>contextualType : Type +>Type : Type + } + interface UnaryExpression extends Expression { +>UnaryExpression : UnaryExpression +>Expression : Expression + + _unaryExpressionBrand: any; +>_unaryExpressionBrand : any + } + interface PrefixUnaryExpression extends UnaryExpression { +>PrefixUnaryExpression : PrefixUnaryExpression +>UnaryExpression : UnaryExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + operand: UnaryExpression; +>operand : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface PostfixUnaryExpression extends PostfixExpression { +>PostfixUnaryExpression : PostfixUnaryExpression +>PostfixExpression : PostfixExpression + + operand: LeftHandSideExpression; +>operand : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + } + interface PostfixExpression extends UnaryExpression { +>PostfixExpression : PostfixExpression +>UnaryExpression : UnaryExpression + + _postfixExpressionBrand: any; +>_postfixExpressionBrand : any + } + interface LeftHandSideExpression extends PostfixExpression { +>LeftHandSideExpression : LeftHandSideExpression +>PostfixExpression : PostfixExpression + + _leftHandSideExpressionBrand: any; +>_leftHandSideExpressionBrand : any + } + interface MemberExpression extends LeftHandSideExpression { +>MemberExpression : MemberExpression +>LeftHandSideExpression : LeftHandSideExpression + + _memberExpressionBrand: any; +>_memberExpressionBrand : any + } + interface PrimaryExpression extends MemberExpression { +>PrimaryExpression : PrimaryExpression +>MemberExpression : MemberExpression + + _primaryExpressionBrand: any; +>_primaryExpressionBrand : any + } + interface DeleteExpression extends UnaryExpression { +>DeleteExpression : DeleteExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface TypeOfExpression extends UnaryExpression { +>TypeOfExpression : TypeOfExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface VoidExpression extends UnaryExpression { +>VoidExpression : VoidExpression +>UnaryExpression : UnaryExpression + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface YieldExpression extends Expression { +>YieldExpression : YieldExpression +>Expression : Expression + + asteriskToken?: Node; +>asteriskToken : Node +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BinaryExpression extends Expression { +>BinaryExpression : BinaryExpression +>Expression : Expression + + left: Expression; +>left : Expression +>Expression : Expression + + operator: SyntaxKind; +>operator : SyntaxKind +>SyntaxKind : SyntaxKind + + right: Expression; +>right : Expression +>Expression : Expression + } + interface ConditionalExpression extends Expression { +>ConditionalExpression : ConditionalExpression +>Expression : Expression + + condition: Expression; +>condition : Expression +>Expression : Expression + + whenTrue: Expression; +>whenTrue : Expression +>Expression : Expression + + whenFalse: Expression; +>whenFalse : Expression +>Expression : Expression + } + interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclaration { +>FunctionExpression : FunctionExpression +>PrimaryExpression : PrimaryExpression +>FunctionLikeDeclaration : FunctionLikeDeclaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + body: Block | Expression; +>body : Expression | Block +>Block : Block +>Expression : Expression + } + interface LiteralExpression extends PrimaryExpression { +>LiteralExpression : LiteralExpression +>PrimaryExpression : PrimaryExpression + + text: string; +>text : string + + isUnterminated?: boolean; +>isUnterminated : boolean + } + interface StringLiteralExpression extends LiteralExpression { +>StringLiteralExpression : StringLiteralExpression +>LiteralExpression : LiteralExpression + + _stringLiteralExpressionBrand: any; +>_stringLiteralExpressionBrand : any + } + interface TemplateExpression extends PrimaryExpression { +>TemplateExpression : TemplateExpression +>PrimaryExpression : PrimaryExpression + + head: LiteralExpression; +>head : LiteralExpression +>LiteralExpression : LiteralExpression + + templateSpans: NodeArray; +>templateSpans : NodeArray +>NodeArray : NodeArray +>TemplateSpan : TemplateSpan + } + interface TemplateSpan extends Node { +>TemplateSpan : TemplateSpan +>Node : Node + + expression: Expression; +>expression : Expression +>Expression : Expression + + literal: LiteralExpression; +>literal : LiteralExpression +>LiteralExpression : LiteralExpression + } + interface ParenthesizedExpression extends PrimaryExpression { +>ParenthesizedExpression : ParenthesizedExpression +>PrimaryExpression : PrimaryExpression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ArrayLiteralExpression extends PrimaryExpression { +>ArrayLiteralExpression : ArrayLiteralExpression +>PrimaryExpression : PrimaryExpression + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface SpreadElementExpression extends Expression { +>SpreadElementExpression : SpreadElementExpression +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ObjectLiteralExpression extends PrimaryExpression, Declaration { +>ObjectLiteralExpression : ObjectLiteralExpression +>PrimaryExpression : PrimaryExpression +>Declaration : Declaration + + properties: NodeArray; +>properties : NodeArray +>NodeArray : NodeArray +>ObjectLiteralElement : ObjectLiteralElement + } + interface PropertyAccessExpression extends MemberExpression { +>PropertyAccessExpression : PropertyAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ElementAccessExpression extends MemberExpression { +>ElementAccessExpression : ElementAccessExpression +>MemberExpression : MemberExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + argumentExpression?: Expression; +>argumentExpression : Expression +>Expression : Expression + } + interface CallExpression extends LeftHandSideExpression { +>CallExpression : CallExpression +>LeftHandSideExpression : LeftHandSideExpression + + expression: LeftHandSideExpression; +>expression : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + typeArguments?: NodeArray; +>typeArguments : NodeArray +>NodeArray : NodeArray +>TypeNode : TypeNode + + arguments: NodeArray; +>arguments : NodeArray +>NodeArray : NodeArray +>Expression : Expression + } + interface NewExpression extends CallExpression, PrimaryExpression { +>NewExpression : NewExpression +>CallExpression : CallExpression +>PrimaryExpression : PrimaryExpression + } + interface TaggedTemplateExpression extends MemberExpression { +>TaggedTemplateExpression : TaggedTemplateExpression +>MemberExpression : MemberExpression + + tag: LeftHandSideExpression; +>tag : LeftHandSideExpression +>LeftHandSideExpression : LeftHandSideExpression + + template: LiteralExpression | TemplateExpression; +>template : LiteralExpression | TemplateExpression +>LiteralExpression : LiteralExpression +>TemplateExpression : TemplateExpression + } + type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression; +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>CallExpression : CallExpression +>NewExpression : NewExpression +>TaggedTemplateExpression : TaggedTemplateExpression + + interface TypeAssertion extends UnaryExpression { +>TypeAssertion : TypeAssertion +>UnaryExpression : UnaryExpression + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + expression: UnaryExpression; +>expression : UnaryExpression +>UnaryExpression : UnaryExpression + } + interface Statement extends Node, ModuleElement { +>Statement : Statement +>Node : Node +>ModuleElement : ModuleElement + + _statementBrand: any; +>_statementBrand : any + } + interface Block extends Statement { +>Block : Block +>Statement : Statement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface VariableStatement extends Statement { +>VariableStatement : VariableStatement +>Statement : Statement + + declarationList: VariableDeclarationList; +>declarationList : VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList + } + interface ExpressionStatement extends Statement { +>ExpressionStatement : ExpressionStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface IfStatement extends Statement { +>IfStatement : IfStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + thenStatement: Statement; +>thenStatement : Statement +>Statement : Statement + + elseStatement?: Statement; +>elseStatement : Statement +>Statement : Statement + } + interface IterationStatement extends Statement { +>IterationStatement : IterationStatement +>Statement : Statement + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface DoStatement extends IterationStatement { +>DoStatement : DoStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface WhileStatement extends IterationStatement { +>WhileStatement : WhileStatement +>IterationStatement : IterationStatement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface ForStatement extends IterationStatement { +>ForStatement : ForStatement +>IterationStatement : IterationStatement + + initializer?: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + condition?: Expression; +>condition : Expression +>Expression : Expression + + iterator?: Expression; +>iterator : Expression +>Expression : Expression + } + interface ForInStatement extends IterationStatement { +>ForInStatement : ForInStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface BreakOrContinueStatement extends Statement { +>BreakOrContinueStatement : BreakOrContinueStatement +>Statement : Statement + + label?: Identifier; +>label : Identifier +>Identifier : Identifier + } + interface ReturnStatement extends Statement { +>ReturnStatement : ReturnStatement +>Statement : Statement + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface WithStatement extends Statement { +>WithStatement : WithStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface SwitchStatement extends Statement { +>SwitchStatement : SwitchStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + + clauses: NodeArray; +>clauses : NodeArray +>NodeArray : NodeArray +>CaseOrDefaultClause : CaseClause | DefaultClause + } + interface CaseClause extends Node { +>CaseClause : CaseClause +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + interface DefaultClause extends Node { +>DefaultClause : DefaultClause +>Node : Node + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>Statement : Statement + } + type CaseOrDefaultClause = CaseClause | DefaultClause; +>CaseOrDefaultClause : CaseClause | DefaultClause +>CaseClause : CaseClause +>DefaultClause : DefaultClause + + interface LabeledStatement extends Statement { +>LabeledStatement : LabeledStatement +>Statement : Statement + + label: Identifier; +>label : Identifier +>Identifier : Identifier + + statement: Statement; +>statement : Statement +>Statement : Statement + } + interface ThrowStatement extends Statement { +>ThrowStatement : ThrowStatement +>Statement : Statement + + expression: Expression; +>expression : Expression +>Expression : Expression + } + interface TryStatement extends Statement { +>TryStatement : TryStatement +>Statement : Statement + + tryBlock: Block; +>tryBlock : Block +>Block : Block + + catchClause?: CatchClause; +>catchClause : CatchClause +>CatchClause : CatchClause + + finallyBlock?: Block; +>finallyBlock : Block +>Block : Block + } + interface CatchClause extends Declaration { +>CatchClause : CatchClause +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type?: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + + block: Block; +>block : Block +>Block : Block + } + interface ModuleElement extends Node { +>ModuleElement : ModuleElement +>Node : Node + + _moduleElementBrand: any; +>_moduleElementBrand : any + } + interface ClassDeclaration extends Declaration, ModuleElement { +>ClassDeclaration : ClassDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>ClassElement : ClassElement + } + interface ClassElement extends Declaration { +>ClassElement : ClassElement +>Declaration : Declaration + + _classElementBrand: any; +>_classElementBrand : any + } + interface InterfaceDeclaration extends Declaration, ModuleElement { +>InterfaceDeclaration : InterfaceDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + typeParameters?: NodeArray; +>typeParameters : NodeArray +>NodeArray : NodeArray +>TypeParameterDeclaration : TypeParameterDeclaration + + heritageClauses?: NodeArray; +>heritageClauses : NodeArray +>NodeArray : NodeArray +>HeritageClause : HeritageClause + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>Declaration : Declaration + } + interface HeritageClause extends Node { +>HeritageClause : HeritageClause +>Node : Node + + token: SyntaxKind; +>token : SyntaxKind +>SyntaxKind : SyntaxKind + + types?: NodeArray; +>types : NodeArray +>NodeArray : NodeArray +>TypeReferenceNode : TypeReferenceNode + } + interface TypeAliasDeclaration extends Declaration, ModuleElement { +>TypeAliasDeclaration : TypeAliasDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + type: TypeNode; +>type : TypeNode +>TypeNode : TypeNode + } + interface EnumMember extends Declaration { +>EnumMember : EnumMember +>Declaration : Declaration + + name: DeclarationName; +>name : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern +>DeclarationName : Identifier | LiteralExpression | ComputedPropertyName | BindingPattern + + initializer?: Expression; +>initializer : Expression +>Expression : Expression + } + interface EnumDeclaration extends Declaration, ModuleElement { +>EnumDeclaration : EnumDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + members: NodeArray; +>members : NodeArray +>NodeArray : NodeArray +>EnumMember : EnumMember + } + interface ModuleDeclaration extends Declaration, ModuleElement { +>ModuleDeclaration : ModuleDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier | LiteralExpression; +>name : Identifier | LiteralExpression +>Identifier : Identifier +>LiteralExpression : LiteralExpression + + body: ModuleBlock | ModuleDeclaration; +>body : ModuleDeclaration | ModuleBlock +>ModuleBlock : ModuleBlock +>ModuleDeclaration : ModuleDeclaration + } + interface ModuleBlock extends Node, ModuleElement { +>ModuleBlock : ModuleBlock +>Node : Node +>ModuleElement : ModuleElement + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + } + interface ImportDeclaration extends Declaration, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Declaration : Declaration +>ModuleElement : ModuleElement + + name: Identifier; +>name : Identifier +>Identifier : Identifier + + moduleReference: EntityName | ExternalModuleReference; +>moduleReference : Identifier | QualifiedName | ExternalModuleReference +>EntityName : Identifier | QualifiedName +>ExternalModuleReference : ExternalModuleReference + } + interface ExternalModuleReference extends Node { +>ExternalModuleReference : ExternalModuleReference +>Node : Node + + expression?: Expression; +>expression : Expression +>Expression : Expression + } + interface ExportAssignment extends Statement, ModuleElement { +>ExportAssignment : ExportAssignment +>Statement : Statement +>ModuleElement : ModuleElement + + exportName: Identifier; +>exportName : Identifier +>Identifier : Identifier + } + interface FileReference extends TextRange { +>FileReference : FileReference +>TextRange : TextRange + + fileName: string; +>fileName : string + } + interface CommentRange extends TextRange { +>CommentRange : CommentRange +>TextRange : TextRange + + hasTrailingNewLine?: boolean; +>hasTrailingNewLine : boolean + } + interface SourceFile extends Declaration { +>SourceFile : SourceFile +>Declaration : Declaration + + statements: NodeArray; +>statements : NodeArray +>NodeArray : NodeArray +>ModuleElement : ModuleElement + + endOfFileToken: Node; +>endOfFileToken : Node +>Node : Node + + fileName: string; +>fileName : string + + text: string; +>text : string + + amdDependencies: string[]; +>amdDependencies : string[] + + amdModuleName: string; +>amdModuleName : string + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + hasNoDefaultLib: boolean; +>hasNoDefaultLib : boolean + + externalModuleIndicator: Node; +>externalModuleIndicator : Node +>Node : Node + + languageVersion: ScriptTarget; +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + identifiers: Map; +>identifiers : Map +>Map : Map + } + interface ScriptReferenceHost { +>ScriptReferenceHost : ScriptReferenceHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + } + interface WriteFileCallback { +>WriteFileCallback : WriteFileCallback + + (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>fileName : string +>data : string +>writeByteOrderMark : boolean +>onError : (message: string) => void +>message : string + } + interface Program extends ScriptReferenceHost { +>Program : Program +>ScriptReferenceHost : ScriptReferenceHost + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + /** + * Emits the javascript and declaration files. If targetSourceFile is not specified, then + * the javascript and declaration files will be produced for all the files in this program. + * If targetSourceFile is specified, then only the javascript and declaration for that + * specific file will be generated. + * + * If writeFile is not specified then the writeFile callback from the compiler host will be + * used for writing the javascript and declaration files. Otherwise, the writeFile parameter + * will be invoked when writing the javascript and declaration files. + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; +>emit : (targetSourceFile?: SourceFile, writeFile?: WriteFileCallback) => EmitResult +>targetSourceFile : SourceFile +>SourceFile : SourceFile +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback +>EmitResult : EmitResult + + getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSyntacticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getGlobalDiagnostics(): Diagnostic[]; +>getGlobalDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSemanticDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getSemanticDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getDeclarationDiagnostics(sourceFile?: SourceFile): Diagnostic[]; +>getDeclarationDiagnostics : (sourceFile?: SourceFile) => Diagnostic[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Diagnostic : Diagnostic + + getTypeChecker(): TypeChecker; +>getTypeChecker : () => TypeChecker +>TypeChecker : TypeChecker + + getCommonSourceDirectory(): string; +>getCommonSourceDirectory : () => string + } + interface SourceMapSpan { +>SourceMapSpan : SourceMapSpan + + emittedLine: number; +>emittedLine : number + + emittedColumn: number; +>emittedColumn : number + + sourceLine: number; +>sourceLine : number + + sourceColumn: number; +>sourceColumn : number + + nameIndex?: number; +>nameIndex : number + + sourceIndex: number; +>sourceIndex : number + } + interface SourceMapData { +>SourceMapData : SourceMapData + + sourceMapFilePath: string; +>sourceMapFilePath : string + + jsSourceMappingURL: string; +>jsSourceMappingURL : string + + sourceMapFile: string; +>sourceMapFile : string + + sourceMapSourceRoot: string; +>sourceMapSourceRoot : string + + sourceMapSources: string[]; +>sourceMapSources : string[] + + inputSourceFileNames: string[]; +>inputSourceFileNames : string[] + + sourceMapNames?: string[]; +>sourceMapNames : string[] + + sourceMapMappings: string; +>sourceMapMappings : string + + sourceMapDecodedMappings: SourceMapSpan[]; +>sourceMapDecodedMappings : SourceMapSpan[] +>SourceMapSpan : SourceMapSpan + } + enum ExitStatus { +>ExitStatus : ExitStatus + + Success = 0, +>Success : ExitStatus + + DiagnosticsPresent_OutputsSkipped = 1, +>DiagnosticsPresent_OutputsSkipped : ExitStatus + + DiagnosticsPresent_OutputsGenerated = 2, +>DiagnosticsPresent_OutputsGenerated : ExitStatus + } + interface EmitResult { +>EmitResult : EmitResult + + emitSkipped: boolean; +>emitSkipped : boolean + + diagnostics: Diagnostic[]; +>diagnostics : Diagnostic[] +>Diagnostic : Diagnostic + + sourceMaps: SourceMapData[]; +>sourceMaps : SourceMapData[] +>SourceMapData : SourceMapData + } + interface TypeCheckerHost { +>TypeCheckerHost : TypeCheckerHost + + getCompilerOptions(): CompilerOptions; +>getCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getSourceFiles(): SourceFile[]; +>getSourceFiles : () => SourceFile[] +>SourceFile : SourceFile + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + } + interface TypeChecker { +>TypeChecker : TypeChecker + + getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; +>getTypeOfSymbolAtLocation : (symbol: Symbol, node: Node) => Type +>symbol : Symbol +>Symbol : Symbol +>node : Node +>Node : Node +>Type : Type + + getDeclaredTypeOfSymbol(symbol: Symbol): Type; +>getDeclaredTypeOfSymbol : (symbol: Symbol) => Type +>symbol : Symbol +>Symbol : Symbol +>Type : Type + + getPropertiesOfType(type: Type): Symbol[]; +>getPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getPropertyOfType(type: Type, propertyName: string): Symbol; +>getPropertyOfType : (type: Type, propertyName: string) => Symbol +>type : Type +>Type : Type +>propertyName : string +>Symbol : Symbol + + getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; +>getSignaturesOfType : (type: Type, kind: SignatureKind) => Signature[] +>type : Type +>Type : Type +>kind : SignatureKind +>SignatureKind : SignatureKind +>Signature : Signature + + getIndexTypeOfType(type: Type, kind: IndexKind): Type; +>getIndexTypeOfType : (type: Type, kind: IndexKind) => Type +>type : Type +>Type : Type +>kind : IndexKind +>IndexKind : IndexKind +>Type : Type + + getReturnTypeOfSignature(signature: Signature): Type; +>getReturnTypeOfSignature : (signature: Signature) => Type +>signature : Signature +>Signature : Signature +>Type : Type + + getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; +>getSymbolsInScope : (location: Node, meaning: SymbolFlags) => Symbol[] +>location : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>Symbol : Symbol + + getSymbolAtLocation(node: Node): Symbol; +>getSymbolAtLocation : (node: Node) => Symbol +>node : Node +>Node : Node +>Symbol : Symbol + + getShorthandAssignmentValueSymbol(location: Node): Symbol; +>getShorthandAssignmentValueSymbol : (location: Node) => Symbol +>location : Node +>Node : Node +>Symbol : Symbol + + getTypeAtLocation(node: Node): Type; +>getTypeAtLocation : (node: Node) => Type +>node : Node +>Node : Node +>Type : Type + + typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; +>typeToString : (type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => string +>type : Type +>Type : Type +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; +>symbolToString : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => string +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + + getSymbolDisplayBuilder(): SymbolDisplayBuilder; +>getSymbolDisplayBuilder : () => SymbolDisplayBuilder +>SymbolDisplayBuilder : SymbolDisplayBuilder + + getFullyQualifiedName(symbol: Symbol): string; +>getFullyQualifiedName : (symbol: Symbol) => string +>symbol : Symbol +>Symbol : Symbol + + getAugmentedPropertiesOfType(type: Type): Symbol[]; +>getAugmentedPropertiesOfType : (type: Type) => Symbol[] +>type : Type +>Type : Type +>Symbol : Symbol + + getRootSymbols(symbol: Symbol): Symbol[]; +>getRootSymbols : (symbol: Symbol) => Symbol[] +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + + getContextualType(node: Expression): Type; +>getContextualType : (node: Expression) => Type +>node : Expression +>Expression : Expression +>Type : Type + + getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[]): Signature; +>getResolvedSignature : (node: CallExpression | NewExpression | TaggedTemplateExpression, candidatesOutArray?: Signature[]) => Signature +>node : CallExpression | NewExpression | TaggedTemplateExpression +>CallLikeExpression : CallExpression | NewExpression | TaggedTemplateExpression +>candidatesOutArray : Signature[] +>Signature : Signature +>Signature : Signature + + getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature; +>getSignatureFromDeclaration : (declaration: SignatureDeclaration) => Signature +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>Signature : Signature + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + isUndefinedSymbol(symbol: Symbol): boolean; +>isUndefinedSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + isArgumentsSymbol(symbol: Symbol): boolean; +>isArgumentsSymbol : (symbol: Symbol) => boolean +>symbol : Symbol +>Symbol : Symbol + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; +>isValidPropertyAccess : (node: QualifiedName | PropertyAccessExpression, propertyName: string) => boolean +>node : QualifiedName | PropertyAccessExpression +>PropertyAccessExpression : PropertyAccessExpression +>QualifiedName : QualifiedName +>propertyName : string + + getAliasedSymbol(symbol: Symbol): Symbol; +>getAliasedSymbol : (symbol: Symbol) => Symbol +>symbol : Symbol +>Symbol : Symbol +>Symbol : Symbol + } + interface SymbolDisplayBuilder { +>SymbolDisplayBuilder : SymbolDisplayBuilder + + buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeDisplay : (type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>type : Type +>Type : Type +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildSymbolDisplay(symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags): void; +>buildSymbolDisplay : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, meaning?: SymbolFlags, flags?: SymbolFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>flags : SymbolFormatFlags +>SymbolFormatFlags : SymbolFormatFlags + + buildSignatureDisplay(signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildSignatureDisplay : (signatures: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signatures : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildParameterDisplay(parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildParameterDisplay : (parameter: Symbol, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameter : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplay(tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplay : (tp: TypeParameter, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>tp : TypeParameter +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildTypeParameterDisplayFromSymbol(symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags): void; +>buildTypeParameterDisplayFromSymbol : (symbol: Symbol, writer: SymbolWriter, enclosingDeclaraiton?: Node, flags?: TypeFormatFlags) => void +>symbol : Symbol +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaraiton : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForParametersAndDelimiters(parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForParametersAndDelimiters : (parameters: Symbol[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>parameters : Symbol[] +>Symbol : Symbol +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildDisplayForTypeParametersAndDelimiters(typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildDisplayForTypeParametersAndDelimiters : (typeParameters: TypeParameter[], writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + + buildReturnTypeDisplay(signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; +>buildReturnTypeDisplay : (signature: Signature, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags) => void +>signature : Signature +>Signature : Signature +>writer : SymbolWriter +>SymbolWriter : SymbolWriter +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags + } + interface SymbolWriter { +>SymbolWriter : SymbolWriter + + writeKeyword(text: string): void; +>writeKeyword : (text: string) => void +>text : string + + writeOperator(text: string): void; +>writeOperator : (text: string) => void +>text : string + + writePunctuation(text: string): void; +>writePunctuation : (text: string) => void +>text : string + + writeSpace(text: string): void; +>writeSpace : (text: string) => void +>text : string + + writeStringLiteral(text: string): void; +>writeStringLiteral : (text: string) => void +>text : string + + writeParameter(text: string): void; +>writeParameter : (text: string) => void +>text : string + + writeSymbol(text: string, symbol: Symbol): void; +>writeSymbol : (text: string, symbol: Symbol) => void +>text : string +>symbol : Symbol +>Symbol : Symbol + + writeLine(): void; +>writeLine : () => void + + increaseIndent(): void; +>increaseIndent : () => void + + decreaseIndent(): void; +>decreaseIndent : () => void + + clear(): void; +>clear : () => void + + trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): void; +>trackSymbol : (symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) => void +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags + } + const enum TypeFormatFlags { +>TypeFormatFlags : TypeFormatFlags + + None = 0, +>None : TypeFormatFlags + + WriteArrayAsGenericType = 1, +>WriteArrayAsGenericType : TypeFormatFlags + + UseTypeOfFunction = 2, +>UseTypeOfFunction : TypeFormatFlags + + NoTruncation = 4, +>NoTruncation : TypeFormatFlags + + WriteArrowStyleSignature = 8, +>WriteArrowStyleSignature : TypeFormatFlags + + WriteOwnNameForAnyLike = 16, +>WriteOwnNameForAnyLike : TypeFormatFlags + + WriteTypeArgumentsOfSignature = 32, +>WriteTypeArgumentsOfSignature : TypeFormatFlags + + InElementType = 64, +>InElementType : TypeFormatFlags + + UseFullyQualifiedType = 128, +>UseFullyQualifiedType : TypeFormatFlags + } + const enum SymbolFormatFlags { +>SymbolFormatFlags : SymbolFormatFlags + + None = 0, +>None : SymbolFormatFlags + + WriteTypeParametersOrArguments = 1, +>WriteTypeParametersOrArguments : SymbolFormatFlags + + UseOnlyExternalAliasing = 2, +>UseOnlyExternalAliasing : SymbolFormatFlags + } + const enum SymbolAccessibility { +>SymbolAccessibility : SymbolAccessibility + + Accessible = 0, +>Accessible : SymbolAccessibility + + NotAccessible = 1, +>NotAccessible : SymbolAccessibility + + CannotBeNamed = 2, +>CannotBeNamed : SymbolAccessibility + } + interface SymbolVisibilityResult { +>SymbolVisibilityResult : SymbolVisibilityResult + + accessibility: SymbolAccessibility; +>accessibility : SymbolAccessibility +>SymbolAccessibility : SymbolAccessibility + + aliasesToMakeVisible?: ImportDeclaration[]; +>aliasesToMakeVisible : ImportDeclaration[] +>ImportDeclaration : ImportDeclaration + + errorSymbolName?: string; +>errorSymbolName : string + + errorNode?: Node; +>errorNode : Node +>Node : Node + } + interface SymbolAccessiblityResult extends SymbolVisibilityResult { +>SymbolAccessiblityResult : SymbolAccessiblityResult +>SymbolVisibilityResult : SymbolVisibilityResult + + errorModuleName?: string; +>errorModuleName : string + } + interface EmitResolver { +>EmitResolver : EmitResolver + + getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; +>getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string +>container : EnumDeclaration | ModuleDeclaration +>ModuleDeclaration : ModuleDeclaration +>EnumDeclaration : EnumDeclaration + + getExpressionNamePrefix(node: Identifier): string; +>getExpressionNamePrefix : (node: Identifier) => string +>node : Identifier +>Identifier : Identifier + + getExportAssignmentName(node: SourceFile): string; +>getExportAssignmentName : (node: SourceFile) => string +>node : SourceFile +>SourceFile : SourceFile + + isReferencedImportDeclaration(node: ImportDeclaration): boolean; +>isReferencedImportDeclaration : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; +>isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean +>node : ImportDeclaration +>ImportDeclaration : ImportDeclaration + + getNodeCheckFlags(node: Node): NodeCheckFlags; +>getNodeCheckFlags : (node: Node) => NodeCheckFlags +>node : Node +>Node : Node +>NodeCheckFlags : NodeCheckFlags + + isDeclarationVisible(node: Declaration): boolean; +>isDeclarationVisible : (node: Declaration) => boolean +>node : Declaration +>Declaration : Declaration + + isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; +>isImplementationOfOverload : (node: FunctionLikeDeclaration) => boolean +>node : FunctionLikeDeclaration +>FunctionLikeDeclaration : FunctionLikeDeclaration + + writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeTypeOfDeclaration : (declaration: VariableLikeDeclaration | AccessorDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>declaration : VariableLikeDeclaration | AccessorDeclaration +>AccessorDeclaration : AccessorDeclaration +>VariableLikeDeclaration : VariableLikeDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void; +>writeReturnTypeOfSignatureDeclaration : (signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) => void +>signatureDeclaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration +>enclosingDeclaration : Node +>Node : Node +>flags : TypeFormatFlags +>TypeFormatFlags : TypeFormatFlags +>writer : SymbolWriter +>SymbolWriter : SymbolWriter + + isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult; +>isSymbolAccessible : (symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) => SymbolAccessiblityResult +>symbol : Symbol +>Symbol : Symbol +>enclosingDeclaration : Node +>Node : Node +>meaning : SymbolFlags +>SymbolFlags : SymbolFlags +>SymbolAccessiblityResult : SymbolAccessiblityResult + + isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; +>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult +>entityName : Identifier | QualifiedName +>EntityName : Identifier | QualifiedName +>enclosingDeclaration : Node +>Node : Node +>SymbolVisibilityResult : SymbolVisibilityResult + + getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number; +>getConstantValue : (node: PropertyAccessExpression | ElementAccessExpression | EnumMember) => number +>node : PropertyAccessExpression | ElementAccessExpression | EnumMember +>EnumMember : EnumMember +>PropertyAccessExpression : PropertyAccessExpression +>ElementAccessExpression : ElementAccessExpression + + isUnknownIdentifier(location: Node, name: string): boolean; +>isUnknownIdentifier : (location: Node, name: string) => boolean +>location : Node +>Node : Node +>name : string + } + const enum SymbolFlags { +>SymbolFlags : SymbolFlags + + FunctionScopedVariable = 1, +>FunctionScopedVariable : SymbolFlags + + BlockScopedVariable = 2, +>BlockScopedVariable : SymbolFlags + + Property = 4, +>Property : SymbolFlags + + EnumMember = 8, +>EnumMember : SymbolFlags + + Function = 16, +>Function : SymbolFlags + + Class = 32, +>Class : SymbolFlags + + Interface = 64, +>Interface : SymbolFlags + + ConstEnum = 128, +>ConstEnum : SymbolFlags + + RegularEnum = 256, +>RegularEnum : SymbolFlags + + ValueModule = 512, +>ValueModule : SymbolFlags + + NamespaceModule = 1024, +>NamespaceModule : SymbolFlags + + TypeLiteral = 2048, +>TypeLiteral : SymbolFlags + + ObjectLiteral = 4096, +>ObjectLiteral : SymbolFlags + + Method = 8192, +>Method : SymbolFlags + + Constructor = 16384, +>Constructor : SymbolFlags + + GetAccessor = 32768, +>GetAccessor : SymbolFlags + + SetAccessor = 65536, +>SetAccessor : SymbolFlags + + Signature = 131072, +>Signature : SymbolFlags + + TypeParameter = 262144, +>TypeParameter : SymbolFlags + + TypeAlias = 524288, +>TypeAlias : SymbolFlags + + ExportValue = 1048576, +>ExportValue : SymbolFlags + + ExportType = 2097152, +>ExportType : SymbolFlags + + ExportNamespace = 4194304, +>ExportNamespace : SymbolFlags + + Import = 8388608, +>Import : SymbolFlags + + Instantiated = 16777216, +>Instantiated : SymbolFlags + + Merged = 33554432, +>Merged : SymbolFlags + + Transient = 67108864, +>Transient : SymbolFlags + + Prototype = 134217728, +>Prototype : SymbolFlags + + UnionProperty = 268435456, +>UnionProperty : SymbolFlags + + Optional = 536870912, +>Optional : SymbolFlags + + Enum = 384, +>Enum : SymbolFlags + + Variable = 3, +>Variable : SymbolFlags + + Value = 107455, +>Value : SymbolFlags + + Type = 793056, +>Type : SymbolFlags + + Namespace = 1536, +>Namespace : SymbolFlags + + Module = 1536, +>Module : SymbolFlags + + Accessor = 98304, +>Accessor : SymbolFlags + + FunctionScopedVariableExcludes = 107454, +>FunctionScopedVariableExcludes : SymbolFlags + + BlockScopedVariableExcludes = 107455, +>BlockScopedVariableExcludes : SymbolFlags + + ParameterExcludes = 107455, +>ParameterExcludes : SymbolFlags + + PropertyExcludes = 107455, +>PropertyExcludes : SymbolFlags + + EnumMemberExcludes = 107455, +>EnumMemberExcludes : SymbolFlags + + FunctionExcludes = 106927, +>FunctionExcludes : SymbolFlags + + ClassExcludes = 899583, +>ClassExcludes : SymbolFlags + + InterfaceExcludes = 792992, +>InterfaceExcludes : SymbolFlags + + RegularEnumExcludes = 899327, +>RegularEnumExcludes : SymbolFlags + + ConstEnumExcludes = 899967, +>ConstEnumExcludes : SymbolFlags + + ValueModuleExcludes = 106639, +>ValueModuleExcludes : SymbolFlags + + NamespaceModuleExcludes = 0, +>NamespaceModuleExcludes : SymbolFlags + + MethodExcludes = 99263, +>MethodExcludes : SymbolFlags + + GetAccessorExcludes = 41919, +>GetAccessorExcludes : SymbolFlags + + SetAccessorExcludes = 74687, +>SetAccessorExcludes : SymbolFlags + + TypeParameterExcludes = 530912, +>TypeParameterExcludes : SymbolFlags + + TypeAliasExcludes = 793056, +>TypeAliasExcludes : SymbolFlags + + ImportExcludes = 8388608, +>ImportExcludes : SymbolFlags + + ModuleMember = 8914931, +>ModuleMember : SymbolFlags + + ExportHasLocal = 944, +>ExportHasLocal : SymbolFlags + + HasLocals = 255504, +>HasLocals : SymbolFlags + + HasExports = 1952, +>HasExports : SymbolFlags + + HasMembers = 6240, +>HasMembers : SymbolFlags + + IsContainer = 262128, +>IsContainer : SymbolFlags + + PropertyOrAccessor = 98308, +>PropertyOrAccessor : SymbolFlags + + Export = 7340032, +>Export : SymbolFlags + } + interface Symbol { +>Symbol : Symbol + + flags: SymbolFlags; +>flags : SymbolFlags +>SymbolFlags : SymbolFlags + + name: string; +>name : string + + id?: number; +>id : number + + mergeId?: number; +>mergeId : number + + declarations?: Declaration[]; +>declarations : Declaration[] +>Declaration : Declaration + + parent?: Symbol; +>parent : Symbol +>Symbol : Symbol + + members?: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + exports?: SymbolTable; +>exports : SymbolTable +>SymbolTable : SymbolTable + + exportSymbol?: Symbol; +>exportSymbol : Symbol +>Symbol : Symbol + + valueDeclaration?: Declaration; +>valueDeclaration : Declaration +>Declaration : Declaration + + constEnumOnlyModule?: boolean; +>constEnumOnlyModule : boolean + } + interface SymbolLinks { +>SymbolLinks : SymbolLinks + + target?: Symbol; +>target : Symbol +>Symbol : Symbol + + type?: Type; +>type : Type +>Type : Type + + declaredType?: Type; +>declaredType : Type +>Type : Type + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + referenced?: boolean; +>referenced : boolean + + exportAssignSymbol?: Symbol; +>exportAssignSymbol : Symbol +>Symbol : Symbol + + unionType?: UnionType; +>unionType : UnionType +>UnionType : UnionType + } + interface TransientSymbol extends Symbol, SymbolLinks { +>TransientSymbol : TransientSymbol +>Symbol : Symbol +>SymbolLinks : SymbolLinks + } + interface SymbolTable { +>SymbolTable : SymbolTable + + [index: string]: Symbol; +>index : string +>Symbol : Symbol + } + const enum NodeCheckFlags { +>NodeCheckFlags : NodeCheckFlags + + TypeChecked = 1, +>TypeChecked : NodeCheckFlags + + LexicalThis = 2, +>LexicalThis : NodeCheckFlags + + CaptureThis = 4, +>CaptureThis : NodeCheckFlags + + EmitExtends = 8, +>EmitExtends : NodeCheckFlags + + SuperInstance = 16, +>SuperInstance : NodeCheckFlags + + SuperStatic = 32, +>SuperStatic : NodeCheckFlags + + ContextChecked = 64, +>ContextChecked : NodeCheckFlags + + EnumValuesComputed = 128, +>EnumValuesComputed : NodeCheckFlags + } + interface NodeLinks { +>NodeLinks : NodeLinks + + resolvedType?: Type; +>resolvedType : Type +>Type : Type + + resolvedSignature?: Signature; +>resolvedSignature : Signature +>Signature : Signature + + resolvedSymbol?: Symbol; +>resolvedSymbol : Symbol +>Symbol : Symbol + + flags?: NodeCheckFlags; +>flags : NodeCheckFlags +>NodeCheckFlags : NodeCheckFlags + + enumMemberValue?: number; +>enumMemberValue : number + + isIllegalTypeReferenceInConstraint?: boolean; +>isIllegalTypeReferenceInConstraint : boolean + + isVisible?: boolean; +>isVisible : boolean + + localModuleName?: string; +>localModuleName : string + + assignmentChecks?: Map; +>assignmentChecks : Map +>Map : Map + + hasReportedStatementInAmbientContext?: boolean; +>hasReportedStatementInAmbientContext : boolean + + importOnRightSide?: Symbol; +>importOnRightSide : Symbol +>Symbol : Symbol + } + const enum TypeFlags { +>TypeFlags : TypeFlags + + Any = 1, +>Any : TypeFlags + + String = 2, +>String : TypeFlags + + Number = 4, +>Number : TypeFlags + + Boolean = 8, +>Boolean : TypeFlags + + Void = 16, +>Void : TypeFlags + + Undefined = 32, +>Undefined : TypeFlags + + Null = 64, +>Null : TypeFlags + + Enum = 128, +>Enum : TypeFlags + + StringLiteral = 256, +>StringLiteral : TypeFlags + + TypeParameter = 512, +>TypeParameter : TypeFlags + + Class = 1024, +>Class : TypeFlags + + Interface = 2048, +>Interface : TypeFlags + + Reference = 4096, +>Reference : TypeFlags + + Tuple = 8192, +>Tuple : TypeFlags + + Union = 16384, +>Union : TypeFlags + + Anonymous = 32768, +>Anonymous : TypeFlags + + FromSignature = 65536, +>FromSignature : TypeFlags + + ObjectLiteral = 131072, +>ObjectLiteral : TypeFlags + + ContainsUndefinedOrNull = 262144, +>ContainsUndefinedOrNull : TypeFlags + + ContainsObjectLiteral = 524288, +>ContainsObjectLiteral : TypeFlags + + Intrinsic = 127, +>Intrinsic : TypeFlags + + Primitive = 510, +>Primitive : TypeFlags + + StringLike = 258, +>StringLike : TypeFlags + + NumberLike = 132, +>NumberLike : TypeFlags + + ObjectType = 48128, +>ObjectType : TypeFlags + + RequiresWidening = 786432, +>RequiresWidening : TypeFlags + } + interface Type { +>Type : Type + + flags: TypeFlags; +>flags : TypeFlags +>TypeFlags : TypeFlags + + id: number; +>id : number + + symbol?: Symbol; +>symbol : Symbol +>Symbol : Symbol + } + interface IntrinsicType extends Type { +>IntrinsicType : IntrinsicType +>Type : Type + + intrinsicName: string; +>intrinsicName : string + } + interface StringLiteralType extends Type { +>StringLiteralType : StringLiteralType +>Type : Type + + text: string; +>text : string + } + interface ObjectType extends Type { +>ObjectType : ObjectType +>Type : Type + } + interface InterfaceType extends ObjectType { +>InterfaceType : InterfaceType +>ObjectType : ObjectType + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + baseTypes: ObjectType[]; +>baseTypes : ObjectType[] +>ObjectType : ObjectType + + declaredProperties: Symbol[]; +>declaredProperties : Symbol[] +>Symbol : Symbol + + declaredCallSignatures: Signature[]; +>declaredCallSignatures : Signature[] +>Signature : Signature + + declaredConstructSignatures: Signature[]; +>declaredConstructSignatures : Signature[] +>Signature : Signature + + declaredStringIndexType: Type; +>declaredStringIndexType : Type +>Type : Type + + declaredNumberIndexType: Type; +>declaredNumberIndexType : Type +>Type : Type + } + interface TypeReference extends ObjectType { +>TypeReference : TypeReference +>ObjectType : ObjectType + + target: GenericType; +>target : GenericType +>GenericType : GenericType + + typeArguments: Type[]; +>typeArguments : Type[] +>Type : Type + } + interface GenericType extends InterfaceType, TypeReference { +>GenericType : GenericType +>InterfaceType : InterfaceType +>TypeReference : TypeReference + + instantiations: Map; +>instantiations : Map +>Map : Map +>TypeReference : TypeReference + } + interface TupleType extends ObjectType { +>TupleType : TupleType +>ObjectType : ObjectType + + elementTypes: Type[]; +>elementTypes : Type[] +>Type : Type + + baseArrayType: TypeReference; +>baseArrayType : TypeReference +>TypeReference : TypeReference + } + interface UnionType extends Type { +>UnionType : UnionType +>Type : Type + + types: Type[]; +>types : Type[] +>Type : Type + + resolvedProperties: SymbolTable; +>resolvedProperties : SymbolTable +>SymbolTable : SymbolTable + } + interface ResolvedType extends ObjectType, UnionType { +>ResolvedType : ResolvedType +>ObjectType : ObjectType +>UnionType : UnionType + + members: SymbolTable; +>members : SymbolTable +>SymbolTable : SymbolTable + + properties: Symbol[]; +>properties : Symbol[] +>Symbol : Symbol + + callSignatures: Signature[]; +>callSignatures : Signature[] +>Signature : Signature + + constructSignatures: Signature[]; +>constructSignatures : Signature[] +>Signature : Signature + + stringIndexType: Type; +>stringIndexType : Type +>Type : Type + + numberIndexType: Type; +>numberIndexType : Type +>Type : Type + } + interface TypeParameter extends Type { +>TypeParameter : TypeParameter +>Type : Type + + constraint: Type; +>constraint : Type +>Type : Type + + target?: TypeParameter; +>target : TypeParameter +>TypeParameter : TypeParameter + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + } + const enum SignatureKind { +>SignatureKind : SignatureKind + + Call = 0, +>Call : SignatureKind + + Construct = 1, +>Construct : SignatureKind + } + interface Signature { +>Signature : Signature + + declaration: SignatureDeclaration; +>declaration : SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + parameters: Symbol[]; +>parameters : Symbol[] +>Symbol : Symbol + + resolvedReturnType: Type; +>resolvedReturnType : Type +>Type : Type + + minArgumentCount: number; +>minArgumentCount : number + + hasRestParameter: boolean; +>hasRestParameter : boolean + + hasStringLiterals: boolean; +>hasStringLiterals : boolean + + target?: Signature; +>target : Signature +>Signature : Signature + + mapper?: TypeMapper; +>mapper : TypeMapper +>TypeMapper : TypeMapper + + unionSignatures?: Signature[]; +>unionSignatures : Signature[] +>Signature : Signature + + erasedSignatureCache?: Signature; +>erasedSignatureCache : Signature +>Signature : Signature + + isolatedSignatureType?: ObjectType; +>isolatedSignatureType : ObjectType +>ObjectType : ObjectType + } + const enum IndexKind { +>IndexKind : IndexKind + + String = 0, +>String : IndexKind + + Number = 1, +>Number : IndexKind + } + interface TypeMapper { +>TypeMapper : TypeMapper + + (t: Type): Type; +>t : Type +>Type : Type +>Type : Type + } + interface TypeInferences { +>TypeInferences : TypeInferences + + primary: Type[]; +>primary : Type[] +>Type : Type + + secondary: Type[]; +>secondary : Type[] +>Type : Type + } + interface InferenceContext { +>InferenceContext : InferenceContext + + typeParameters: TypeParameter[]; +>typeParameters : TypeParameter[] +>TypeParameter : TypeParameter + + inferUnionTypes: boolean; +>inferUnionTypes : boolean + + inferences: TypeInferences[]; +>inferences : TypeInferences[] +>TypeInferences : TypeInferences + + inferredTypes: Type[]; +>inferredTypes : Type[] +>Type : Type + + failedTypeParameterIndex?: number; +>failedTypeParameterIndex : number + } + interface DiagnosticMessage { +>DiagnosticMessage : DiagnosticMessage + + key: string; +>key : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + interface DiagnosticMessageChain { +>DiagnosticMessageChain : DiagnosticMessageChain + + messageText: string; +>messageText : string + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + + next?: DiagnosticMessageChain; +>next : DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + } + interface Diagnostic { +>Diagnostic : Diagnostic + + file: SourceFile; +>file : SourceFile +>SourceFile : SourceFile + + start: number; +>start : number + + length: number; +>length : number + + messageText: string | DiagnosticMessageChain; +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain + + category: DiagnosticCategory; +>category : DiagnosticCategory +>DiagnosticCategory : DiagnosticCategory + + code: number; +>code : number + } + enum DiagnosticCategory { +>DiagnosticCategory : DiagnosticCategory + + Warning = 0, +>Warning : DiagnosticCategory + + Error = 1, +>Error : DiagnosticCategory + + Message = 2, +>Message : DiagnosticCategory + } + interface CompilerOptions { +>CompilerOptions : CompilerOptions + + allowNonTsExtensions?: boolean; +>allowNonTsExtensions : boolean + + charset?: string; +>charset : string + + codepage?: number; +>codepage : number + + declaration?: boolean; +>declaration : boolean + + diagnostics?: boolean; +>diagnostics : boolean + + emitBOM?: boolean; +>emitBOM : boolean + + help?: boolean; +>help : boolean + + listFiles?: boolean; +>listFiles : boolean + + locale?: string; +>locale : string + + mapRoot?: string; +>mapRoot : string + + module?: ModuleKind; +>module : ModuleKind +>ModuleKind : ModuleKind + + noEmit?: boolean; +>noEmit : boolean + + noEmitOnError?: boolean; +>noEmitOnError : boolean + + noErrorTruncation?: boolean; +>noErrorTruncation : boolean + + noImplicitAny?: boolean; +>noImplicitAny : boolean + + noLib?: boolean; +>noLib : boolean + + noLibCheck?: boolean; +>noLibCheck : boolean + + noResolve?: boolean; +>noResolve : boolean + + out?: string; +>out : string + + outDir?: string; +>outDir : string + + preserveConstEnums?: boolean; +>preserveConstEnums : boolean + + project?: string; +>project : string + + removeComments?: boolean; +>removeComments : boolean + + sourceMap?: boolean; +>sourceMap : boolean + + sourceRoot?: string; +>sourceRoot : string + + suppressImplicitAnyIndexErrors?: boolean; +>suppressImplicitAnyIndexErrors : boolean + + target?: ScriptTarget; +>target : ScriptTarget +>ScriptTarget : ScriptTarget + + version?: boolean; +>version : boolean + + watch?: boolean; +>watch : boolean + + stripInternal?: boolean; +>stripInternal : boolean + + [option: string]: string | number | boolean; +>option : string + } + const enum ModuleKind { +>ModuleKind : ModuleKind + + None = 0, +>None : ModuleKind + + CommonJS = 1, +>CommonJS : ModuleKind + + AMD = 2, +>AMD : ModuleKind + } + interface LineAndCharacter { +>LineAndCharacter : LineAndCharacter + + line: number; +>line : number + + character: number; +>character : number + } + const enum ScriptTarget { +>ScriptTarget : ScriptTarget + + ES3 = 0, +>ES3 : ScriptTarget + + ES5 = 1, +>ES5 : ScriptTarget + + ES6 = 2, +>ES6 : ScriptTarget + + Latest = 2, +>Latest : ScriptTarget + } + interface ParsedCommandLine { +>ParsedCommandLine : ParsedCommandLine + + options: CompilerOptions; +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + fileNames: string[]; +>fileNames : string[] + + errors: Diagnostic[]; +>errors : Diagnostic[] +>Diagnostic : Diagnostic + } + interface CommandLineOption { +>CommandLineOption : CommandLineOption + + name: string; +>name : string + + type: string | Map; +>type : string | Map +>Map : Map + + isFilePath?: boolean; +>isFilePath : boolean + + shortName?: string; +>shortName : string + + description?: DiagnosticMessage; +>description : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + paramType?: DiagnosticMessage; +>paramType : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + error?: DiagnosticMessage; +>error : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage + + experimental?: boolean; +>experimental : boolean + } + const enum CharacterCodes { +>CharacterCodes : CharacterCodes + + nullCharacter = 0, +>nullCharacter : CharacterCodes + + maxAsciiCharacter = 127, +>maxAsciiCharacter : CharacterCodes + + lineFeed = 10, +>lineFeed : CharacterCodes + + carriageReturn = 13, +>carriageReturn : CharacterCodes + + lineSeparator = 8232, +>lineSeparator : CharacterCodes + + paragraphSeparator = 8233, +>paragraphSeparator : CharacterCodes + + nextLine = 133, +>nextLine : CharacterCodes + + space = 32, +>space : CharacterCodes + + nonBreakingSpace = 160, +>nonBreakingSpace : CharacterCodes + + enQuad = 8192, +>enQuad : CharacterCodes + + emQuad = 8193, +>emQuad : CharacterCodes + + enSpace = 8194, +>enSpace : CharacterCodes + + emSpace = 8195, +>emSpace : CharacterCodes + + threePerEmSpace = 8196, +>threePerEmSpace : CharacterCodes + + fourPerEmSpace = 8197, +>fourPerEmSpace : CharacterCodes + + sixPerEmSpace = 8198, +>sixPerEmSpace : CharacterCodes + + figureSpace = 8199, +>figureSpace : CharacterCodes + + punctuationSpace = 8200, +>punctuationSpace : CharacterCodes + + thinSpace = 8201, +>thinSpace : CharacterCodes + + hairSpace = 8202, +>hairSpace : CharacterCodes + + zeroWidthSpace = 8203, +>zeroWidthSpace : CharacterCodes + + narrowNoBreakSpace = 8239, +>narrowNoBreakSpace : CharacterCodes + + ideographicSpace = 12288, +>ideographicSpace : CharacterCodes + + mathematicalSpace = 8287, +>mathematicalSpace : CharacterCodes + + ogham = 5760, +>ogham : CharacterCodes + + _ = 95, +>_ : CharacterCodes + + $ = 36, +>$ : CharacterCodes + + _0 = 48, +>_0 : CharacterCodes + + _1 = 49, +>_1 : CharacterCodes + + _2 = 50, +>_2 : CharacterCodes + + _3 = 51, +>_3 : CharacterCodes + + _4 = 52, +>_4 : CharacterCodes + + _5 = 53, +>_5 : CharacterCodes + + _6 = 54, +>_6 : CharacterCodes + + _7 = 55, +>_7 : CharacterCodes + + _8 = 56, +>_8 : CharacterCodes + + _9 = 57, +>_9 : CharacterCodes + + a = 97, +>a : CharacterCodes + + b = 98, +>b : CharacterCodes + + c = 99, +>c : CharacterCodes + + d = 100, +>d : CharacterCodes + + e = 101, +>e : CharacterCodes + + f = 102, +>f : CharacterCodes + + g = 103, +>g : CharacterCodes + + h = 104, +>h : CharacterCodes + + i = 105, +>i : CharacterCodes + + j = 106, +>j : CharacterCodes + + k = 107, +>k : CharacterCodes + + l = 108, +>l : CharacterCodes + + m = 109, +>m : CharacterCodes + + n = 110, +>n : CharacterCodes + + o = 111, +>o : CharacterCodes + + p = 112, +>p : CharacterCodes + + q = 113, +>q : CharacterCodes + + r = 114, +>r : CharacterCodes + + s = 115, +>s : CharacterCodes + + t = 116, +>t : CharacterCodes + + u = 117, +>u : CharacterCodes + + v = 118, +>v : CharacterCodes + + w = 119, +>w : CharacterCodes + + x = 120, +>x : CharacterCodes + + y = 121, +>y : CharacterCodes + + z = 122, +>z : CharacterCodes + + A = 65, +>A : CharacterCodes + + B = 66, +>B : CharacterCodes + + C = 67, +>C : CharacterCodes + + D = 68, +>D : CharacterCodes + + E = 69, +>E : CharacterCodes + + F = 70, +>F : CharacterCodes + + G = 71, +>G : CharacterCodes + + H = 72, +>H : CharacterCodes + + I = 73, +>I : CharacterCodes + + J = 74, +>J : CharacterCodes + + K = 75, +>K : CharacterCodes + + L = 76, +>L : CharacterCodes + + M = 77, +>M : CharacterCodes + + N = 78, +>N : CharacterCodes + + O = 79, +>O : CharacterCodes + + P = 80, +>P : CharacterCodes + + Q = 81, +>Q : CharacterCodes + + R = 82, +>R : CharacterCodes + + S = 83, +>S : CharacterCodes + + T = 84, +>T : CharacterCodes + + U = 85, +>U : CharacterCodes + + V = 86, +>V : CharacterCodes + + W = 87, +>W : CharacterCodes + + X = 88, +>X : CharacterCodes + + Y = 89, +>Y : CharacterCodes + + Z = 90, +>Z : CharacterCodes + + ampersand = 38, +>ampersand : CharacterCodes + + asterisk = 42, +>asterisk : CharacterCodes + + at = 64, +>at : CharacterCodes + + backslash = 92, +>backslash : CharacterCodes + + backtick = 96, +>backtick : CharacterCodes + + bar = 124, +>bar : CharacterCodes + + caret = 94, +>caret : CharacterCodes + + closeBrace = 125, +>closeBrace : CharacterCodes + + closeBracket = 93, +>closeBracket : CharacterCodes + + closeParen = 41, +>closeParen : CharacterCodes + + colon = 58, +>colon : CharacterCodes + + comma = 44, +>comma : CharacterCodes + + dot = 46, +>dot : CharacterCodes + + doubleQuote = 34, +>doubleQuote : CharacterCodes + + equals = 61, +>equals : CharacterCodes + + exclamation = 33, +>exclamation : CharacterCodes + + greaterThan = 62, +>greaterThan : CharacterCodes + + lessThan = 60, +>lessThan : CharacterCodes + + minus = 45, +>minus : CharacterCodes + + openBrace = 123, +>openBrace : CharacterCodes + + openBracket = 91, +>openBracket : CharacterCodes + + openParen = 40, +>openParen : CharacterCodes + + percent = 37, +>percent : CharacterCodes + + plus = 43, +>plus : CharacterCodes + + question = 63, +>question : CharacterCodes + + semicolon = 59, +>semicolon : CharacterCodes + + singleQuote = 39, +>singleQuote : CharacterCodes + + slash = 47, +>slash : CharacterCodes + + tilde = 126, +>tilde : CharacterCodes + + backspace = 8, +>backspace : CharacterCodes + + formFeed = 12, +>formFeed : CharacterCodes + + byteOrderMark = 65279, +>byteOrderMark : CharacterCodes + + tab = 9, +>tab : CharacterCodes + + verticalTab = 11, +>verticalTab : CharacterCodes + } + interface CancellationToken { +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + } + interface CompilerHost { +>CompilerHost : CompilerHost + + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>onError : (message: string) => void +>message : string +>SourceFile : SourceFile + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + writeFile: WriteFileCallback; +>writeFile : WriteFileCallback +>WriteFileCallback : WriteFileCallback + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getCanonicalFileName(fileName: string): string; +>getCanonicalFileName : (fileName: string) => string +>fileName : string + + useCaseSensitiveFileNames(): boolean; +>useCaseSensitiveFileNames : () => boolean + + getNewLine(): string; +>getNewLine : () => string + } + interface TextSpan { +>TextSpan : TextSpan + + start: number; +>start : number + + length: number; +>length : number + } + interface TextChangeRange { +>TextChangeRange : TextChangeRange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newLength: number; +>newLength : number + } +} +declare module "typescript" { + interface ErrorCallback { +>ErrorCallback : ErrorCallback + + (message: DiagnosticMessage, length: number): void; +>message : DiagnosticMessage +>DiagnosticMessage : DiagnosticMessage +>length : number + } + interface Scanner { +>Scanner : Scanner + + getStartPos(): number; +>getStartPos : () => number + + getToken(): SyntaxKind; +>getToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + getTextPos(): number; +>getTextPos : () => number + + getTokenPos(): number; +>getTokenPos : () => number + + getTokenText(): string; +>getTokenText : () => string + + getTokenValue(): string; +>getTokenValue : () => string + + hasPrecedingLineBreak(): boolean; +>hasPrecedingLineBreak : () => boolean + + isIdentifier(): boolean; +>isIdentifier : () => boolean + + isReservedWord(): boolean; +>isReservedWord : () => boolean + + isUnterminated(): boolean; +>isUnterminated : () => boolean + + reScanGreaterToken(): SyntaxKind; +>reScanGreaterToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanSlashToken(): SyntaxKind; +>reScanSlashToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + reScanTemplateToken(): SyntaxKind; +>reScanTemplateToken : () => SyntaxKind +>SyntaxKind : SyntaxKind + + scan(): SyntaxKind; +>scan : () => SyntaxKind +>SyntaxKind : SyntaxKind + + setText(text: string): void; +>setText : (text: string) => void +>text : string + + setTextPos(textPos: number): void; +>setTextPos : (textPos: number) => void +>textPos : number + + lookAhead(callback: () => T): T; +>lookAhead : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + + tryScan(callback: () => T): T; +>tryScan : (callback: () => T) => T +>T : T +>callback : () => T +>T : T +>T : T + } + function tokenToString(t: SyntaxKind): string; +>tokenToString : (t: SyntaxKind) => string +>t : SyntaxKind +>SyntaxKind : SyntaxKind + + function computeLineStarts(text: string): number[]; +>computeLineStarts : (text: string) => number[] +>text : string + + function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number +>sourceFile : SourceFile +>SourceFile : SourceFile +>line : number +>character : number + + function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number +>lineStarts : number[] +>line : number +>character : number + + function getLineStarts(sourceFile: SourceFile): number[]; +>getLineStarts : (sourceFile: SourceFile) => number[] +>sourceFile : SourceFile +>SourceFile : SourceFile + + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } +>lineStarts : number[] +>position : number + + line: number; +>line : number + + character: number; +>character : number + + }; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter +>sourceFile : SourceFile +>SourceFile : SourceFile +>position : number +>LineAndCharacter : LineAndCharacter + + function isWhiteSpace(ch: number): boolean; +>isWhiteSpace : (ch: number) => boolean +>ch : number + + function isLineBreak(ch: number): boolean; +>isLineBreak : (ch: number) => boolean +>ch : number + + function isOctalDigit(ch: number): boolean; +>isOctalDigit : (ch: number) => boolean +>ch : number + + function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number; +>skipTrivia : (text: string, pos: number, stopAfterLineBreak?: boolean) => number +>text : string +>pos : number +>stopAfterLineBreak : boolean + + function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; +>getLeadingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; +>getTrailingCommentRanges : (text: string, pos: number) => CommentRange[] +>text : string +>pos : number +>CommentRange : CommentRange + + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierStart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; +>isIdentifierPart : (ch: number, languageVersion: ScriptTarget) => boolean +>ch : number +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget + + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback): Scanner; +>createScanner : (languageVersion: ScriptTarget, skipTrivia: boolean, text?: string, onError?: ErrorCallback) => Scanner +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>skipTrivia : boolean +>text : string +>onError : ErrorCallback +>ErrorCallback : ErrorCallback +>Scanner : Scanner +} +declare module "typescript" { + function getNodeConstructor(kind: SyntaxKind): new () => Node; +>getNodeConstructor : (kind: SyntaxKind) => new () => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function createNode(kind: SyntaxKind): Node; +>createNode : (kind: SyntaxKind) => Node +>kind : SyntaxKind +>SyntaxKind : SyntaxKind +>Node : Node + + function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; +>forEachChild : (node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T) => T +>T : T +>node : Node +>Node : Node +>cbNode : (node: Node) => T +>node : Node +>Node : Node +>T : T +>cbNodeArray : (nodes: Node[]) => T +>nodes : Node[] +>Node : Node +>T : T +>T : T + + function modifierToFlag(token: SyntaxKind): NodeFlags; +>modifierToFlag : (token: SyntaxKind) => NodeFlags +>token : SyntaxKind +>SyntaxKind : SyntaxKind +>NodeFlags : NodeFlags + + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; +>updateSourceFile : (sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function isEvalOrArgumentsIdentifier(node: Node): boolean; +>isEvalOrArgumentsIdentifier : (node: Node) => boolean +>node : Node +>Node : Node + + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string +>sourceText : string +>languageVersion : ScriptTarget +>ScriptTarget : ScriptTarget +>setParentNodes : boolean +>SourceFile : SourceFile + + function isLeftHandSideExpression(expr: Expression): boolean; +>isLeftHandSideExpression : (expr: Expression) => boolean +>expr : Expression +>Expression : Expression + + function isAssignmentOperator(token: SyntaxKind): boolean; +>isAssignmentOperator : (token: SyntaxKind) => boolean +>token : SyntaxKind +>SyntaxKind : SyntaxKind +} +declare module "typescript" { + function createTypeChecker(host: TypeCheckerHost, produceDiagnostics: boolean): TypeChecker; +>createTypeChecker : (host: TypeCheckerHost, produceDiagnostics: boolean) => TypeChecker +>host : TypeCheckerHost +>TypeCheckerHost : TypeCheckerHost +>produceDiagnostics : boolean +>TypeChecker : TypeChecker +} +declare module "typescript" { + function createCompilerHost(options: CompilerOptions): CompilerHost; +>createCompilerHost : (options: CompilerOptions) => CompilerHost +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>CompilerHost : CompilerHost + + function getPreEmitDiagnostics(program: Program): Diagnostic[]; +>getPreEmitDiagnostics : (program: Program) => Diagnostic[] +>program : Program +>Program : Program +>Diagnostic : Diagnostic + + function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; +>flattenDiagnosticMessageText : (messageText: string | DiagnosticMessageChain, newLine: string) => string +>messageText : string | DiagnosticMessageChain +>DiagnosticMessageChain : DiagnosticMessageChain +>newLine : string + + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; +>createProgram : (rootNames: string[], options: CompilerOptions, host?: CompilerHost) => Program +>rootNames : string[] +>options : CompilerOptions +>CompilerOptions : CompilerOptions +>host : CompilerHost +>CompilerHost : CompilerHost +>Program : Program +} +declare module "typescript" { + var servicesVersion: string; +>servicesVersion : string + + interface Node { +>Node : Node + + getSourceFile(): SourceFile; +>getSourceFile : () => SourceFile +>SourceFile : SourceFile + + getChildCount(sourceFile?: SourceFile): number; +>getChildCount : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getChildAt(index: number, sourceFile?: SourceFile): Node; +>getChildAt : (index: number, sourceFile?: SourceFile) => Node +>index : number +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getChildren(sourceFile?: SourceFile): Node[]; +>getChildren : (sourceFile?: SourceFile) => Node[] +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getStart(sourceFile?: SourceFile): number; +>getStart : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullStart(): number; +>getFullStart : () => number + + getEnd(): number; +>getEnd : () => number + + getWidth(sourceFile?: SourceFile): number; +>getWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullWidth(): number; +>getFullWidth : () => number + + getLeadingTriviaWidth(sourceFile?: SourceFile): number; +>getLeadingTriviaWidth : (sourceFile?: SourceFile) => number +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFullText(sourceFile?: SourceFile): string; +>getFullText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getText(sourceFile?: SourceFile): string; +>getText : (sourceFile?: SourceFile) => string +>sourceFile : SourceFile +>SourceFile : SourceFile + + getFirstToken(sourceFile?: SourceFile): Node; +>getFirstToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + + getLastToken(sourceFile?: SourceFile): Node; +>getLastToken : (sourceFile?: SourceFile) => Node +>sourceFile : SourceFile +>SourceFile : SourceFile +>Node : Node + } + interface Symbol { +>Symbol : Symbol + + getFlags(): SymbolFlags; +>getFlags : () => SymbolFlags +>SymbolFlags : SymbolFlags + + getName(): string; +>getName : () => string + + getDeclarations(): Declaration[]; +>getDeclarations : () => Declaration[] +>Declaration : Declaration + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface Type { +>Type : Type + + getFlags(): TypeFlags; +>getFlags : () => TypeFlags +>TypeFlags : TypeFlags + + getSymbol(): Symbol; +>getSymbol : () => Symbol +>Symbol : Symbol + + getProperties(): Symbol[]; +>getProperties : () => Symbol[] +>Symbol : Symbol + + getProperty(propertyName: string): Symbol; +>getProperty : (propertyName: string) => Symbol +>propertyName : string +>Symbol : Symbol + + getApparentProperties(): Symbol[]; +>getApparentProperties : () => Symbol[] +>Symbol : Symbol + + getCallSignatures(): Signature[]; +>getCallSignatures : () => Signature[] +>Signature : Signature + + getConstructSignatures(): Signature[]; +>getConstructSignatures : () => Signature[] +>Signature : Signature + + getStringIndexType(): Type; +>getStringIndexType : () => Type +>Type : Type + + getNumberIndexType(): Type; +>getNumberIndexType : () => Type +>Type : Type + } + interface Signature { +>Signature : Signature + + getDeclaration(): SignatureDeclaration; +>getDeclaration : () => SignatureDeclaration +>SignatureDeclaration : SignatureDeclaration + + getTypeParameters(): Type[]; +>getTypeParameters : () => Type[] +>Type : Type + + getParameters(): Symbol[]; +>getParameters : () => Symbol[] +>Symbol : Symbol + + getReturnType(): Type; +>getReturnType : () => Type +>Type : Type + + getDocumentationComment(): SymbolDisplayPart[]; +>getDocumentationComment : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface SourceFile { +>SourceFile : SourceFile + + version: string; +>version : string + + scriptSnapshot: IScriptSnapshot; +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot + + nameTable: Map; +>nameTable : Map +>Map : Map + + getNamedDeclarations(): Declaration[]; +>getNamedDeclarations : () => Declaration[] +>Declaration : Declaration + + getLineAndCharacterFromPosition(pos: number): LineAndCharacter; +>getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter +>pos : number +>LineAndCharacter : LineAndCharacter + + getLineStarts(): number[]; +>getLineStarts : () => number[] + + getPositionFromLineAndCharacter(line: number, character: number): number; +>getPositionFromLineAndCharacter : (line: number, character: number) => number +>line : number +>character : number + + update(newText: string, textChangeRange: TextChangeRange): SourceFile; +>update : (newText: string, textChangeRange: TextChangeRange) => SourceFile +>newText : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { +>IScriptSnapshot : IScriptSnapshot + + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; +>getText : (start: number, end: number) => string +>start : number +>end : number + + /** Gets the length of this script snapshot. */ + getLength(): number; +>getLength : () => number + + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange; +>getChangeRange : (oldSnapshot: IScriptSnapshot) => TextChangeRange +>oldSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>TextChangeRange : TextChangeRange + } + module ScriptSnapshot { +>ScriptSnapshot : typeof ScriptSnapshot + + function fromString(text: string): IScriptSnapshot; +>fromString : (text: string) => IScriptSnapshot +>text : string +>IScriptSnapshot : IScriptSnapshot + } + interface PreProcessedFileInfo { +>PreProcessedFileInfo : PreProcessedFileInfo + + referencedFiles: FileReference[]; +>referencedFiles : FileReference[] +>FileReference : FileReference + + importedFiles: FileReference[]; +>importedFiles : FileReference[] +>FileReference : FileReference + + isLibFile: boolean; +>isLibFile : boolean + } + interface LanguageServiceHost { +>LanguageServiceHost : LanguageServiceHost + + getCompilationSettings(): CompilerOptions; +>getCompilationSettings : () => CompilerOptions +>CompilerOptions : CompilerOptions + + getNewLine?(): string; +>getNewLine : () => string + + getScriptFileNames(): string[]; +>getScriptFileNames : () => string[] + + getScriptVersion(fileName: string): string; +>getScriptVersion : (fileName: string) => string +>fileName : string + + getScriptSnapshot(fileName: string): IScriptSnapshot; +>getScriptSnapshot : (fileName: string) => IScriptSnapshot +>fileName : string +>IScriptSnapshot : IScriptSnapshot + + getLocalizedDiagnosticMessages?(): any; +>getLocalizedDiagnosticMessages : () => any + + getCancellationToken?(): CancellationToken; +>getCancellationToken : () => CancellationToken +>CancellationToken : CancellationToken + + getCurrentDirectory(): string; +>getCurrentDirectory : () => string + + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions + + log?(s: string): void; +>log : (s: string) => void +>s : string + + trace?(s: string): void; +>trace : (s: string) => void +>s : string + + error?(s: string): void; +>error : (s: string) => void +>s : string + } + interface LanguageService { +>LanguageService : LanguageService + + cleanupSemanticCache(): void; +>cleanupSemanticCache : () => void + + getSyntacticDiagnostics(fileName: string): Diagnostic[]; +>getSyntacticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getSemanticDiagnostics(fileName: string): Diagnostic[]; +>getSemanticDiagnostics : (fileName: string) => Diagnostic[] +>fileName : string +>Diagnostic : Diagnostic + + getCompilerOptionsDiagnostics(): Diagnostic[]; +>getCompilerOptionsDiagnostics : () => Diagnostic[] +>Diagnostic : Diagnostic + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSyntacticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; +>getSemanticClassifications : (fileName: string, span: TextSpan) => ClassifiedSpan[] +>fileName : string +>span : TextSpan +>TextSpan : TextSpan +>ClassifiedSpan : ClassifiedSpan + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; +>getCompletionsAtPosition : (fileName: string, position: number) => CompletionInfo +>fileName : string +>position : number +>CompletionInfo : CompletionInfo + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; +>getCompletionEntryDetails : (fileName: string, position: number, entryName: string) => CompletionEntryDetails +>fileName : string +>position : number +>entryName : string +>CompletionEntryDetails : CompletionEntryDetails + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; +>getQuickInfoAtPosition : (fileName: string, position: number) => QuickInfo +>fileName : string +>position : number +>QuickInfo : QuickInfo + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan; +>getNameOrDottedNameSpan : (fileName: string, startPos: number, endPos: number) => TextSpan +>fileName : string +>startPos : number +>endPos : number +>TextSpan : TextSpan + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan; +>getBreakpointStatementAtPosition : (fileName: string, position: number) => TextSpan +>fileName : string +>position : number +>TextSpan : TextSpan + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems; +>getSignatureHelpItems : (fileName: string, position: number) => SignatureHelpItems +>fileName : string +>position : number +>SignatureHelpItems : SignatureHelpItems + + getRenameInfo(fileName: string, position: number): RenameInfo; +>getRenameInfo : (fileName: string, position: number) => RenameInfo +>fileName : string +>position : number +>RenameInfo : RenameInfo + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[]; +>findRenameLocations : (fileName: string, position: number, findInStrings: boolean, findInComments: boolean) => RenameLocation[] +>fileName : string +>position : number +>findInStrings : boolean +>findInComments : boolean +>RenameLocation : RenameLocation + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; +>getDefinitionAtPosition : (fileName: string, position: number) => DefinitionInfo[] +>fileName : string +>position : number +>DefinitionInfo : DefinitionInfo + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getReferencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; +>getOccurrencesAtPosition : (fileName: string, position: number) => ReferenceEntry[] +>fileName : string +>position : number +>ReferenceEntry : ReferenceEntry + + getNavigateToItems(searchValue: string): NavigateToItem[]; +>getNavigateToItems : (searchValue: string) => NavigateToItem[] +>searchValue : string +>NavigateToItem : NavigateToItem + + getNavigationBarItems(fileName: string): NavigationBarItem[]; +>getNavigationBarItems : (fileName: string) => NavigationBarItem[] +>fileName : string +>NavigationBarItem : NavigationBarItem + + getOutliningSpans(fileName: string): OutliningSpan[]; +>getOutliningSpans : (fileName: string) => OutliningSpan[] +>fileName : string +>OutliningSpan : OutliningSpan + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; +>getTodoComments : (fileName: string, descriptors: TodoCommentDescriptor[]) => TodoComment[] +>fileName : string +>descriptors : TodoCommentDescriptor[] +>TodoCommentDescriptor : TodoCommentDescriptor +>TodoComment : TodoComment + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[]; +>getBraceMatchingAtPosition : (fileName: string, position: number) => TextSpan[] +>fileName : string +>position : number +>TextSpan : TextSpan + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number; +>getIndentationAtPosition : (fileName: string, position: number, options: EditorOptions) => number +>fileName : string +>position : number +>options : EditorOptions +>EditorOptions : EditorOptions + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForRange : (fileName: string, start: number, end: number, options: FormatCodeOptions) => TextChange[] +>fileName : string +>start : number +>end : number +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsForDocument : (fileName: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; +>getFormattingEditsAfterKeystroke : (fileName: string, position: number, key: string, options: FormatCodeOptions) => TextChange[] +>fileName : string +>position : number +>key : string +>options : FormatCodeOptions +>FormatCodeOptions : FormatCodeOptions +>TextChange : TextChange + + getEmitOutput(fileName: string): EmitOutput; +>getEmitOutput : (fileName: string) => EmitOutput +>fileName : string +>EmitOutput : EmitOutput + + getProgram(): Program; +>getProgram : () => Program +>Program : Program + + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string +>SourceFile : SourceFile + + dispose(): void; +>dispose : () => void + } + interface ClassifiedSpan { +>ClassifiedSpan : ClassifiedSpan + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + classificationType: string; +>classificationType : string + } + interface NavigationBarItem { +>NavigationBarItem : NavigationBarItem + + text: string; +>text : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + spans: TextSpan[]; +>spans : TextSpan[] +>TextSpan : TextSpan + + childItems: NavigationBarItem[]; +>childItems : NavigationBarItem[] +>NavigationBarItem : NavigationBarItem + + indent: number; +>indent : number + + bolded: boolean; +>bolded : boolean + + grayed: boolean; +>grayed : boolean + } + interface TodoCommentDescriptor { +>TodoCommentDescriptor : TodoCommentDescriptor + + text: string; +>text : string + + priority: number; +>priority : number + } + interface TodoComment { +>TodoComment : TodoComment + + descriptor: TodoCommentDescriptor; +>descriptor : TodoCommentDescriptor +>TodoCommentDescriptor : TodoCommentDescriptor + + message: string; +>message : string + + position: number; +>position : number + } + class TextChange { +>TextChange : TextChange + + span: TextSpan; +>span : TextSpan +>TextSpan : TextSpan + + newText: string; +>newText : string + } + interface RenameLocation { +>RenameLocation : RenameLocation + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + } + interface ReferenceEntry { +>ReferenceEntry : ReferenceEntry + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + fileName: string; +>fileName : string + + isWriteAccess: boolean; +>isWriteAccess : boolean + } + interface NavigateToItem { +>NavigateToItem : NavigateToItem + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + matchKind: string; +>matchKind : string + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + containerName: string; +>containerName : string + + containerKind: string; +>containerKind : string + } + interface EditorOptions { +>EditorOptions : EditorOptions + + IndentSize: number; +>IndentSize : number + + TabSize: number; +>TabSize : number + + NewLineCharacter: string; +>NewLineCharacter : string + + ConvertTabsToSpaces: boolean; +>ConvertTabsToSpaces : boolean + } + interface FormatCodeOptions extends EditorOptions { +>FormatCodeOptions : FormatCodeOptions +>EditorOptions : EditorOptions + + InsertSpaceAfterCommaDelimiter: boolean; +>InsertSpaceAfterCommaDelimiter : boolean + + InsertSpaceAfterSemicolonInForStatements: boolean; +>InsertSpaceAfterSemicolonInForStatements : boolean + + InsertSpaceBeforeAndAfterBinaryOperators: boolean; +>InsertSpaceBeforeAndAfterBinaryOperators : boolean + + InsertSpaceAfterKeywordsInControlFlowStatements: boolean; +>InsertSpaceAfterKeywordsInControlFlowStatements : boolean + + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; +>InsertSpaceAfterFunctionKeywordForAnonymousFunctions : boolean + + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; +>InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis : boolean + + PlaceOpenBraceOnNewLineForFunctions: boolean; +>PlaceOpenBraceOnNewLineForFunctions : boolean + + PlaceOpenBraceOnNewLineForControlBlocks: boolean; +>PlaceOpenBraceOnNewLineForControlBlocks : boolean + } + interface DefinitionInfo { +>DefinitionInfo : DefinitionInfo + + fileName: string; +>fileName : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + kind: string; +>kind : string + + name: string; +>name : string + + containerKind: string; +>containerKind : string + + containerName: string; +>containerName : string + } + enum SymbolDisplayPartKind { +>SymbolDisplayPartKind : SymbolDisplayPartKind + + aliasName = 0, +>aliasName : SymbolDisplayPartKind + + className = 1, +>className : SymbolDisplayPartKind + + enumName = 2, +>enumName : SymbolDisplayPartKind + + fieldName = 3, +>fieldName : SymbolDisplayPartKind + + interfaceName = 4, +>interfaceName : SymbolDisplayPartKind + + keyword = 5, +>keyword : SymbolDisplayPartKind + + lineBreak = 6, +>lineBreak : SymbolDisplayPartKind + + numericLiteral = 7, +>numericLiteral : SymbolDisplayPartKind + + stringLiteral = 8, +>stringLiteral : SymbolDisplayPartKind + + localName = 9, +>localName : SymbolDisplayPartKind + + methodName = 10, +>methodName : SymbolDisplayPartKind + + moduleName = 11, +>moduleName : SymbolDisplayPartKind + + operator = 12, +>operator : SymbolDisplayPartKind + + parameterName = 13, +>parameterName : SymbolDisplayPartKind + + propertyName = 14, +>propertyName : SymbolDisplayPartKind + + punctuation = 15, +>punctuation : SymbolDisplayPartKind + + space = 16, +>space : SymbolDisplayPartKind + + text = 17, +>text : SymbolDisplayPartKind + + typeParameterName = 18, +>typeParameterName : SymbolDisplayPartKind + + enumMemberName = 19, +>enumMemberName : SymbolDisplayPartKind + + functionName = 20, +>functionName : SymbolDisplayPartKind + + regularExpressionLiteral = 21, +>regularExpressionLiteral : SymbolDisplayPartKind + } + interface SymbolDisplayPart { +>SymbolDisplayPart : SymbolDisplayPart + + text: string; +>text : string + + kind: string; +>kind : string + } + interface QuickInfo { +>QuickInfo : QuickInfo + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface RenameInfo { +>RenameInfo : RenameInfo + + canRename: boolean; +>canRename : boolean + + localizedErrorMessage: string; +>localizedErrorMessage : string + + displayName: string; +>displayName : string + + fullDisplayName: string; +>fullDisplayName : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + triggerSpan: TextSpan; +>triggerSpan : TextSpan +>TextSpan : TextSpan + } + interface SignatureHelpParameter { +>SignatureHelpParameter : SignatureHelpParameter + + name: string; +>name : string + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + isOptional: boolean; +>isOptional : boolean + } + /** + * Represents a single signature to show in signature help. + * The id is used for subsequent calls into the language service to ask questions about the + * signature help item in the context of any documents that have been updated. i.e. after + * an edit has happened, while signature help is still active, the host can ask important + * questions like 'what parameter is the user currently contained within?'. + */ + interface SignatureHelpItem { +>SignatureHelpItem : SignatureHelpItem + + isVariadic: boolean; +>isVariadic : boolean + + prefixDisplayParts: SymbolDisplayPart[]; +>prefixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + suffixDisplayParts: SymbolDisplayPart[]; +>suffixDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + separatorDisplayParts: SymbolDisplayPart[]; +>separatorDisplayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + parameters: SignatureHelpParameter[]; +>parameters : SignatureHelpParameter[] +>SignatureHelpParameter : SignatureHelpParameter + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + /** + * Represents a set of signature help items, and the preferred item that should be selected. + */ + interface SignatureHelpItems { +>SignatureHelpItems : SignatureHelpItems + + items: SignatureHelpItem[]; +>items : SignatureHelpItem[] +>SignatureHelpItem : SignatureHelpItem + + applicableSpan: TextSpan; +>applicableSpan : TextSpan +>TextSpan : TextSpan + + selectedItemIndex: number; +>selectedItemIndex : number + + argumentIndex: number; +>argumentIndex : number + + argumentCount: number; +>argumentCount : number + } + interface CompletionInfo { +>CompletionInfo : CompletionInfo + + isMemberCompletion: boolean; +>isMemberCompletion : boolean + + isNewIdentifierLocation: boolean; +>isNewIdentifierLocation : boolean + + entries: CompletionEntry[]; +>entries : CompletionEntry[] +>CompletionEntry : CompletionEntry + } + interface CompletionEntry { +>CompletionEntry : CompletionEntry + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + } + interface CompletionEntryDetails { +>CompletionEntryDetails : CompletionEntryDetails + + name: string; +>name : string + + kind: string; +>kind : string + + kindModifiers: string; +>kindModifiers : string + + displayParts: SymbolDisplayPart[]; +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + documentation: SymbolDisplayPart[]; +>documentation : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + interface OutliningSpan { +>OutliningSpan : OutliningSpan + + /** The span of the document to actually collapse. */ + textSpan: TextSpan; +>textSpan : TextSpan +>TextSpan : TextSpan + + /** The span of the document to display when the user hovers over the collapsed span. */ + hintSpan: TextSpan; +>hintSpan : TextSpan +>TextSpan : TextSpan + + /** The text to display in the editor for the collapsed region. */ + bannerText: string; +>bannerText : string + + /** + * Whether or not this region should be automatically collapsed when + * the 'Collapse to Definitions' command is invoked. + */ + autoCollapse: boolean; +>autoCollapse : boolean + } + interface EmitOutput { +>EmitOutput : EmitOutput + + outputFiles: OutputFile[]; +>outputFiles : OutputFile[] +>OutputFile : OutputFile + + emitSkipped: boolean; +>emitSkipped : boolean + } + const enum OutputFileType { +>OutputFileType : OutputFileType + + JavaScript = 0, +>JavaScript : OutputFileType + + SourceMap = 1, +>SourceMap : OutputFileType + + Declaration = 2, +>Declaration : OutputFileType + } + interface OutputFile { +>OutputFile : OutputFile + + name: string; +>name : string + + writeByteOrderMark: boolean; +>writeByteOrderMark : boolean + + text: string; +>text : string + } + const enum EndOfLineState { +>EndOfLineState : EndOfLineState + + Start = 0, +>Start : EndOfLineState + + InMultiLineCommentTrivia = 1, +>InMultiLineCommentTrivia : EndOfLineState + + InSingleQuoteStringLiteral = 2, +>InSingleQuoteStringLiteral : EndOfLineState + + InDoubleQuoteStringLiteral = 3, +>InDoubleQuoteStringLiteral : EndOfLineState + } + enum TokenClass { +>TokenClass : TokenClass + + Punctuation = 0, +>Punctuation : TokenClass + + Keyword = 1, +>Keyword : TokenClass + + Operator = 2, +>Operator : TokenClass + + Comment = 3, +>Comment : TokenClass + + Whitespace = 4, +>Whitespace : TokenClass + + Identifier = 5, +>Identifier : TokenClass + + NumberLiteral = 6, +>NumberLiteral : TokenClass + + StringLiteral = 7, +>StringLiteral : TokenClass + + RegExpLiteral = 8, +>RegExpLiteral : TokenClass + } + interface ClassificationResult { +>ClassificationResult : ClassificationResult + + finalLexState: EndOfLineState; +>finalLexState : EndOfLineState +>EndOfLineState : EndOfLineState + + entries: ClassificationInfo[]; +>entries : ClassificationInfo[] +>ClassificationInfo : ClassificationInfo + } + interface ClassificationInfo { +>ClassificationInfo : ClassificationInfo + + length: number; +>length : number + + classification: TokenClass; +>classification : TokenClass +>TokenClass : TokenClass + } + interface Classifier { +>Classifier : Classifier + + getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult +>text : string +>lexState : EndOfLineState +>EndOfLineState : EndOfLineState +>classifyKeywordsInGenerics : boolean +>ClassificationResult : ClassificationResult + } + /** + * The document registry represents a store of SourceFile objects that can be shared between + * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library + * file (lib.d.ts). + * + * A more advanced use of the document registry is to serialize sourceFile objects to disk + * and re-hydrate them when needed. + * + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * to all subsequent createLanguageService calls. + */ + interface DocumentRegistry { +>DocumentRegistry : DocumentRegistry + + /** + * Request a stored SourceFile with a given fileName and compilationSettings. + * The first call to acquire will call createLanguageServiceSourceFile to generate + * the SourceFile if was not found in the registry. + * + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + */ + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>SourceFile : SourceFile + + /** + * Request an updated version of an already existing SourceFile with a given fileName + * and compilationSettings. The update will intern call updateLanguageServiceSourceFile + * to get an updated SourceFile. + * + * Note: It is not allowed to call update on a SourceFile that was not acquired from this + * registry originally. + * + * @param sourceFile The original sourceFile object to update + * @param fileName The name of the file requested + * @param compilationSettings Some compilation settings like target affects the + * shape of a the resulting SourceFile. This allows the DocumentRegistry to store + * multiple copies of the same file for different compilation settings. + * @parm scriptSnapshot Text of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm version Current version of the file. Only used if the file was not found + * in the registry and a new one was created. + * @parm textChangeRange Change ranges since the last snapshot. Only used if the file + * was not found in the registry and a new one was created. + */ + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + /** + * Informs the DocumentRegistry that a file is not needed any longer. + * + * Note: It is not allowed to call release on a SourceFile that was not acquired from + * this registry originally. + * + * @param fileName The name of the file to be released + * @param compilationSettings The compilation settings used to acquire the file + */ + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string +>compilationSettings : CompilerOptions +>CompilerOptions : CompilerOptions + } + class ScriptElementKind { +>ScriptElementKind : ScriptElementKind + + static unknown: string; +>unknown : string + + static keyword: string; +>keyword : string + + static scriptElement: string; +>scriptElement : string + + static moduleElement: string; +>moduleElement : string + + static classElement: string; +>classElement : string + + static interfaceElement: string; +>interfaceElement : string + + static typeElement: string; +>typeElement : string + + static enumElement: string; +>enumElement : string + + static variableElement: string; +>variableElement : string + + static localVariableElement: string; +>localVariableElement : string + + static functionElement: string; +>functionElement : string + + static localFunctionElement: string; +>localFunctionElement : string + + static memberFunctionElement: string; +>memberFunctionElement : string + + static memberGetAccessorElement: string; +>memberGetAccessorElement : string + + static memberSetAccessorElement: string; +>memberSetAccessorElement : string + + static memberVariableElement: string; +>memberVariableElement : string + + static constructorImplementationElement: string; +>constructorImplementationElement : string + + static callSignatureElement: string; +>callSignatureElement : string + + static indexSignatureElement: string; +>indexSignatureElement : string + + static constructSignatureElement: string; +>constructSignatureElement : string + + static parameterElement: string; +>parameterElement : string + + static typeParameterElement: string; +>typeParameterElement : string + + static primitiveType: string; +>primitiveType : string + + static label: string; +>label : string + + static alias: string; +>alias : string + + static constElement: string; +>constElement : string + + static letElement: string; +>letElement : string + } + class ScriptElementKindModifier { +>ScriptElementKindModifier : ScriptElementKindModifier + + static none: string; +>none : string + + static publicMemberModifier: string; +>publicMemberModifier : string + + static privateMemberModifier: string; +>privateMemberModifier : string + + static protectedMemberModifier: string; +>protectedMemberModifier : string + + static exportedModifier: string; +>exportedModifier : string + + static ambientModifier: string; +>ambientModifier : string + + static staticModifier: string; +>staticModifier : string + } + class ClassificationTypeNames { +>ClassificationTypeNames : ClassificationTypeNames + + static comment: string; +>comment : string + + static identifier: string; +>identifier : string + + static keyword: string; +>keyword : string + + static numericLiteral: string; +>numericLiteral : string + + static operator: string; +>operator : string + + static stringLiteral: string; +>stringLiteral : string + + static whiteSpace: string; +>whiteSpace : string + + static text: string; +>text : string + + static punctuation: string; +>punctuation : string + + static className: string; +>className : string + + static enumName: string; +>enumName : string + + static interfaceName: string; +>interfaceName : string + + static moduleName: string; +>moduleName : string + + static typeParameterName: string; +>typeParameterName : string + + static typeAlias: string; +>typeAlias : string + } + interface DisplayPartsSymbolWriter extends SymbolWriter { +>DisplayPartsSymbolWriter : DisplayPartsSymbolWriter +>SymbolWriter : SymbolWriter + + displayParts(): SymbolDisplayPart[]; +>displayParts : () => SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + } + function displayPartsToString(displayParts: SymbolDisplayPart[]): string; +>displayPartsToString : (displayParts: SymbolDisplayPart[]) => string +>displayParts : SymbolDisplayPart[] +>SymbolDisplayPart : SymbolDisplayPart + + function getDefaultCompilerOptions(): CompilerOptions; +>getDefaultCompilerOptions : () => CompilerOptions +>CompilerOptions : CompilerOptions + + class OperationCanceledException { +>OperationCanceledException : OperationCanceledException + } + class CancellationTokenObject { +>CancellationTokenObject : CancellationTokenObject + + private cancellationToken; +>cancellationToken : any + + static None: CancellationTokenObject; +>None : CancellationTokenObject +>CancellationTokenObject : CancellationTokenObject + + constructor(cancellationToken: CancellationToken); +>cancellationToken : CancellationToken +>CancellationToken : CancellationToken + + isCancellationRequested(): boolean; +>isCancellationRequested : () => boolean + + throwIfCancellationRequested(): void; +>throwIfCancellationRequested : () => void + } + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>scriptTarget : ScriptTarget +>ScriptTarget : ScriptTarget +>version : string +>setNodeParents : boolean +>SourceFile : SourceFile + + var disableIncrementalParsing: boolean; +>disableIncrementalParsing : boolean + + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateLanguageServiceSourceFile : (sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile +>sourceFile : SourceFile +>SourceFile : SourceFile +>scriptSnapshot : IScriptSnapshot +>IScriptSnapshot : IScriptSnapshot +>version : string +>textChangeRange : TextChangeRange +>TextChangeRange : TextChangeRange +>SourceFile : SourceFile + + function createDocumentRegistry(): DocumentRegistry; +>createDocumentRegistry : () => DocumentRegistry +>DocumentRegistry : DocumentRegistry + + function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; +>preProcessFile : (sourceText: string, readImportFiles?: boolean) => PreProcessedFileInfo +>sourceText : string +>readImportFiles : boolean +>PreProcessedFileInfo : PreProcessedFileInfo + + function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; +>createLanguageService : (host: LanguageServiceHost, documentRegistry?: DocumentRegistry) => LanguageService +>host : LanguageServiceHost +>LanguageServiceHost : LanguageServiceHost +>documentRegistry : DocumentRegistry +>DocumentRegistry : DocumentRegistry +>LanguageService : LanguageService + + function createClassifier(): Classifier; +>createClassifier : () => Classifier +>Classifier : Classifier + + /** + * Get the path of the default library file (lib.d.ts) as distributed with the typescript + * node package. + * The functionality is not supported if the ts module is consumed outside of a node module. + */ + function getDefaultLibFilePath(options: CompilerOptions): string; +>getDefaultLibFilePath : (options: CompilerOptions) => string +>options : CompilerOptions +>CompilerOptions : CompilerOptions +} + diff --git a/tests/baselines/reference/ArrowFunction1.js b/tests/baselines/reference/ArrowFunction1.js new file mode 100644 index 00000000000..1923c3a1d8e --- /dev/null +++ b/tests/baselines/reference/ArrowFunction1.js @@ -0,0 +1,8 @@ +//// [ArrowFunction1.ts] +var v = (a: ) => { + +}; + +//// [ArrowFunction1.js] +var v = function (a) { +}; diff --git a/tests/baselines/reference/ArrowFunction2.js b/tests/baselines/reference/ArrowFunction2.js new file mode 100644 index 00000000000..fa6b8bf3b9e --- /dev/null +++ b/tests/baselines/reference/ArrowFunction2.js @@ -0,0 +1,8 @@ +//// [ArrowFunction2.ts] +var v = (a: b,) => { + +}; + +//// [ArrowFunction2.js] +var v = function (a) { +}; diff --git a/tests/baselines/reference/ArrowFunction3.js b/tests/baselines/reference/ArrowFunction3.js new file mode 100644 index 00000000000..8ce76f7da3b --- /dev/null +++ b/tests/baselines/reference/ArrowFunction3.js @@ -0,0 +1,8 @@ +//// [ArrowFunction3.ts] +var v = (a): => { + +}; + +//// [ArrowFunction3.js] +var v = function (a) { +}; diff --git a/tests/baselines/reference/ExportAssignment7.js b/tests/baselines/reference/ExportAssignment7.js new file mode 100644 index 00000000000..ce4f5d7bf09 --- /dev/null +++ b/tests/baselines/reference/ExportAssignment7.js @@ -0,0 +1,13 @@ +//// [ExportAssignment7.ts] +export class C { +} + +export = B; + +//// [ExportAssignment7.js] +var C = (function () { + function C() { + } + return C; +})(); +exports.C = C; diff --git a/tests/baselines/reference/ExportAssignment8.js b/tests/baselines/reference/ExportAssignment8.js new file mode 100644 index 00000000000..2f7ac9ee69f --- /dev/null +++ b/tests/baselines/reference/ExportAssignment8.js @@ -0,0 +1,13 @@ +//// [ExportAssignment8.ts] +export = B; + +export class C { +} + +//// [ExportAssignment8.js] +var C = (function () { + function C() { + } + return C; +})(); +exports.C = C; diff --git a/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js new file mode 100644 index 00000000000..44c19685743 --- /dev/null +++ b/tests/baselines/reference/ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js @@ -0,0 +1,25 @@ +//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.ts] +module A { + + class Point { + constructor(public x: number, public y: number) { } + } + + export var UnitSquare : { + top: { left: Point, right: Point }, + bottom: { left: Point, right: Point } + } = null; +} + +//// [ExportObjectLiteralAndObjectTypeLiteralWithAccessibleTypesInNestedMemberTypeAnnotations.js] +var A; +(function (A) { + var Point = (function () { + function Point(x, y) { + this.x = x; + this.y = y; + } + return Point; + })(); + A.UnitSquare = null; +})(A || (A = {})); diff --git a/tests/baselines/reference/FunctionDeclaration10_es6.js b/tests/baselines/reference/FunctionDeclaration10_es6.js new file mode 100644 index 00000000000..51694533964 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration10_es6.js @@ -0,0 +1,8 @@ +//// [FunctionDeclaration10_es6.ts] +function * foo(a = yield => yield) { +} + +//// [FunctionDeclaration10_es6.js] +function foo(a) { + if (a === void 0) { a = function (yield) { return yield; }; } +} diff --git a/tests/baselines/reference/FunctionDeclaration11_es6.js b/tests/baselines/reference/FunctionDeclaration11_es6.js new file mode 100644 index 00000000000..ba497b3e529 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration11_es6.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration11_es6.ts] +function * yield() { +} + +//// [FunctionDeclaration11_es6.js] +function yield() { +} diff --git a/tests/baselines/reference/FunctionDeclaration12_es6.js b/tests/baselines/reference/FunctionDeclaration12_es6.js new file mode 100644 index 00000000000..da9cea3f9c6 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration12_es6.js @@ -0,0 +1,6 @@ +//// [FunctionDeclaration12_es6.ts] +var v = function * yield() { } + +//// [FunctionDeclaration12_es6.js] +var v = , yield = function () { +}; diff --git a/tests/baselines/reference/FunctionDeclaration13_es6.js b/tests/baselines/reference/FunctionDeclaration13_es6.js new file mode 100644 index 00000000000..4c82b037569 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration13_es6.js @@ -0,0 +1,12 @@ +//// [FunctionDeclaration13_es6.ts] +function * foo() { + // Legal to use 'yield' in a type context. + var v: yield; +} + + +//// [FunctionDeclaration13_es6.js] +function foo() { + // Legal to use 'yield' in a type context. + var v; +} diff --git a/tests/baselines/reference/FunctionDeclaration1_es6.js b/tests/baselines/reference/FunctionDeclaration1_es6.js new file mode 100644 index 00000000000..262c7ea02fb --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration1_es6.js @@ -0,0 +1,7 @@ +//// [FunctionDeclaration1_es6.ts] +function * foo() { +} + +//// [FunctionDeclaration1_es6.js] +function foo() { +} diff --git a/tests/baselines/reference/FunctionDeclaration5_es6.js b/tests/baselines/reference/FunctionDeclaration5_es6.js new file mode 100644 index 00000000000..2530baa220c --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration5_es6.js @@ -0,0 +1,8 @@ +//// [FunctionDeclaration5_es6.ts] +function*foo(yield) { +} + +//// [FunctionDeclaration5_es6.js] +yield; +{ +} diff --git a/tests/baselines/reference/FunctionDeclaration6_es6.js b/tests/baselines/reference/FunctionDeclaration6_es6.js new file mode 100644 index 00000000000..07b3ff52212 --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration6_es6.js @@ -0,0 +1,8 @@ +//// [FunctionDeclaration6_es6.ts] +function*foo(a = yield) { +} + +//// [FunctionDeclaration6_es6.js] +function foo(a) { + if (a === void 0) { a = yield; } +} diff --git a/tests/baselines/reference/FunctionDeclaration7_es6.js b/tests/baselines/reference/FunctionDeclaration7_es6.js new file mode 100644 index 00000000000..661e1668e0f --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration7_es6.js @@ -0,0 +1,14 @@ +//// [FunctionDeclaration7_es6.ts] +function*bar() { + // 'yield' here is an identifier, and not a yield expression. + function*foo(a = yield) { + } +} + +//// [FunctionDeclaration7_es6.js] +function bar() { + // 'yield' here is an identifier, and not a yield expression. + function foo(a) { + if (a === void 0) { a = yield; } + } +} diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index 08d151203c9..2c8d034649e 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,7 +1,13 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (1 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ==== var v = { [yield]: foo } ~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2304: Cannot find name 'yield'. + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js new file mode 100644 index 00000000000..5f9f0a2a49e --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -0,0 +1,5 @@ +//// [FunctionDeclaration8_es6.ts] +var v = { [yield]: foo } + +//// [FunctionDeclaration8_es6.js] +var v = { [yield]: foo }; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index 8333eceb267..ef744681fa1 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,12 +1,15 @@ 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,13): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +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 (2 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ==== function * foo() { ~ !!! error TS9001: Generators are not currently supported. var v = { [yield]: foo } ~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS9000: 'yield' expressions are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js new file mode 100644 index 00000000000..388275ed4fa --- /dev/null +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -0,0 +1,9 @@ +//// [FunctionDeclaration9_es6.ts] +function * foo() { + var v = { [yield]: foo } +} + +//// [FunctionDeclaration9_es6.js] +function foo() { + var v = { []: foo }; +} diff --git a/tests/baselines/reference/FunctionExpression1_es6.js b/tests/baselines/reference/FunctionExpression1_es6.js new file mode 100644 index 00000000000..7c8d82f4ca8 --- /dev/null +++ b/tests/baselines/reference/FunctionExpression1_es6.js @@ -0,0 +1,6 @@ +//// [FunctionExpression1_es6.ts] +var v = function * () { } + +//// [FunctionExpression1_es6.js] +var v = function () { +}; diff --git a/tests/baselines/reference/FunctionExpression2_es6.js b/tests/baselines/reference/FunctionExpression2_es6.js new file mode 100644 index 00000000000..0a2468bcb8c --- /dev/null +++ b/tests/baselines/reference/FunctionExpression2_es6.js @@ -0,0 +1,6 @@ +//// [FunctionExpression2_es6.ts] +var v = function * foo() { } + +//// [FunctionExpression2_es6.js] +var v = function foo() { +}; diff --git a/tests/baselines/reference/FunctionPropertyAssignments1_es6.js b/tests/baselines/reference/FunctionPropertyAssignments1_es6.js new file mode 100644 index 00000000000..a451dcfb363 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments1_es6.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments1_es6.ts] +var v = { *foo() { } } + +//// [FunctionPropertyAssignments1_es6.js] +var v = { foo: function () { +} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments2_es6.js b/tests/baselines/reference/FunctionPropertyAssignments2_es6.js new file mode 100644 index 00000000000..5338afeef39 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments2_es6.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments2_es6.ts] +var v = { *() { } } + +//// [FunctionPropertyAssignments2_es6.js] +var v = { : function () { +} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments3_es6.js b/tests/baselines/reference/FunctionPropertyAssignments3_es6.js new file mode 100644 index 00000000000..7b3adb771f3 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments3_es6.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments3_es6.ts] +var v = { *{ } } + +//// [FunctionPropertyAssignments3_es6.js] +var v = { : function () { +} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js new file mode 100644 index 00000000000..595f7fc9124 --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments4_es6.ts] +var v = { * } + +//// [FunctionPropertyAssignments4_es6.js] +var v = { : function () { +} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index eff0c79d827..c8c356a57ad 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,7 +1,13 @@ -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS9002: Computed property names are not currently supported. +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,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and 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 (1 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ==== var v = { *[foo()]() { } } + ~ +!!! error TS9001: Generators are not currently supported. ~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js new file mode 100644 index 00000000000..2bfc675acff --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments5_es6.ts] +var v = { *[foo()]() { } } + +//// [FunctionPropertyAssignments5_es6.js] +var v = { [foo()]: function () { +} }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments6_es6.js b/tests/baselines/reference/FunctionPropertyAssignments6_es6.js new file mode 100644 index 00000000000..6bd636be73a --- /dev/null +++ b/tests/baselines/reference/FunctionPropertyAssignments6_es6.js @@ -0,0 +1,6 @@ +//// [FunctionPropertyAssignments6_es6.ts] +var v = { *() { } } + +//// [FunctionPropertyAssignments6_es6.js] +var v = { : function () { +} }; diff --git a/tests/baselines/reference/MemberAccessorDeclaration15.js b/tests/baselines/reference/MemberAccessorDeclaration15.js new file mode 100644 index 00000000000..41ed265a878 --- /dev/null +++ b/tests/baselines/reference/MemberAccessorDeclaration15.js @@ -0,0 +1,17 @@ +//// [MemberAccessorDeclaration15.ts] +class C { + set Foo(public a: number) { } +} + +//// [MemberAccessorDeclaration15.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration1_es6.js b/tests/baselines/reference/MemberFunctionDeclaration1_es6.js new file mode 100644 index 00000000000..86e7c9d418a --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration1_es6.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration1_es6.ts] +class C { + *foo() { } +} + +//// [MemberFunctionDeclaration1_es6.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration2_es6.js b/tests/baselines/reference/MemberFunctionDeclaration2_es6.js new file mode 100644 index 00000000000..efd60844dc7 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration2_es6.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration2_es6.ts] +class C { + public * foo() { } +} + +//// [MemberFunctionDeclaration2_es6.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt index b43e266e2a5..826c1d7fd75 100644 --- a/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt +++ b/tests/baselines/reference/MemberFunctionDeclaration3_es6.errors.txt @@ -1,9 +1,12 @@ 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,6): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (1 errors) ==== +==== tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts (2 errors) ==== class C { *[foo]() { } ~ !!! error TS9001: Generators are not currently supported. + ~~~ +!!! error TS2304: Cannot find name 'foo'. } \ No newline at end of file diff --git a/tests/baselines/reference/MemberFunctionDeclaration3_es6.js b/tests/baselines/reference/MemberFunctionDeclaration3_es6.js new file mode 100644 index 00000000000..357f9175b42 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration3_es6.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration3_es6.ts] +class C { + *[foo]() { } +} + +//// [MemberFunctionDeclaration3_es6.js] +var C = (function () { + function C() { + } + C.prototype[foo] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration4_es6.js b/tests/baselines/reference/MemberFunctionDeclaration4_es6.js new file mode 100644 index 00000000000..9c6d76bfca5 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration4_es6.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration4_es6.ts] +class C { + *() { } +} + +//// [MemberFunctionDeclaration4_es6.js] +var C = (function () { + function C() { + } + C.prototype. = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration5_es6.js b/tests/baselines/reference/MemberFunctionDeclaration5_es6.js new file mode 100644 index 00000000000..6b43b18fe39 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration5_es6.js @@ -0,0 +1,11 @@ +//// [MemberFunctionDeclaration5_es6.ts] +class C { + * +} + +//// [MemberFunctionDeclaration5_es6.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration6_es6.js b/tests/baselines/reference/MemberFunctionDeclaration6_es6.js new file mode 100644 index 00000000000..ef9c9248763 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration6_es6.js @@ -0,0 +1,11 @@ +//// [MemberFunctionDeclaration6_es6.ts] +class C { + *foo +} + +//// [MemberFunctionDeclaration6_es6.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration7_es6.js b/tests/baselines/reference/MemberFunctionDeclaration7_es6.js new file mode 100644 index 00000000000..211713c6e14 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration7_es6.js @@ -0,0 +1,13 @@ +//// [MemberFunctionDeclaration7_es6.ts] +class C { + *foo() { } +} + +//// [MemberFunctionDeclaration7_es6.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/MemberFunctionDeclaration8_es6.js b/tests/baselines/reference/MemberFunctionDeclaration8_es6.js new file mode 100644 index 00000000000..8e23a5ec995 --- /dev/null +++ b/tests/baselines/reference/MemberFunctionDeclaration8_es6.js @@ -0,0 +1,22 @@ +//// [MemberFunctionDeclaration8_es6.ts] +class C { + foo() { + // Make sure we don't think of *bar as the start of a generator method. + if (a) # * bar; + return bar; + } +} + +//// [MemberFunctionDeclaration8_es6.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + // Make sure we don't think of *bar as the start of a generator method. + if (a) + ; + * bar; + return bar; + }; + return C; +})(); diff --git a/tests/baselines/reference/Protected1.js b/tests/baselines/reference/Protected1.js new file mode 100644 index 00000000000..eebce2f4ecc --- /dev/null +++ b/tests/baselines/reference/Protected1.js @@ -0,0 +1,10 @@ +//// [Protected1.ts] +protected class C { +} + +//// [Protected1.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/Protected2.js b/tests/baselines/reference/Protected2.js new file mode 100644 index 00000000000..6675d9d50fb --- /dev/null +++ b/tests/baselines/reference/Protected2.js @@ -0,0 +1,5 @@ +//// [Protected2.ts] +protected module M { +} + +//// [Protected2.js] diff --git a/tests/baselines/reference/Protected3.js b/tests/baselines/reference/Protected3.js new file mode 100644 index 00000000000..4c4d5e2a12c --- /dev/null +++ b/tests/baselines/reference/Protected3.js @@ -0,0 +1,11 @@ +//// [Protected3.ts] +class C { + protected constructor() { } +} + +//// [Protected3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/Protected4.js b/tests/baselines/reference/Protected4.js new file mode 100644 index 00000000000..665a182ef33 --- /dev/null +++ b/tests/baselines/reference/Protected4.js @@ -0,0 +1,13 @@ +//// [Protected4.ts] +class C { + protected public m() { } +} + +//// [Protected4.js] +var C = (function () { + function C() { + } + C.prototype.m = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/Protected6.js b/tests/baselines/reference/Protected6.js new file mode 100644 index 00000000000..004f30b27f8 --- /dev/null +++ b/tests/baselines/reference/Protected6.js @@ -0,0 +1,13 @@ +//// [Protected6.ts] +class C { + static protected m() { } +} + +//// [Protected6.js] +var C = (function () { + function C() { + } + C.m = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/Protected7.js b/tests/baselines/reference/Protected7.js new file mode 100644 index 00000000000..466f6909d67 --- /dev/null +++ b/tests/baselines/reference/Protected7.js @@ -0,0 +1,13 @@ +//// [Protected7.ts] +class C { + protected private m() { } +} + +//// [Protected7.js] +var C = (function () { + function C() { + } + C.prototype.m = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/TemplateExpression1.js b/tests/baselines/reference/TemplateExpression1.js new file mode 100644 index 00000000000..c4437260084 --- /dev/null +++ b/tests/baselines/reference/TemplateExpression1.js @@ -0,0 +1,5 @@ +//// [TemplateExpression1.ts] +var v = `foo ${ a + +//// [TemplateExpression1.js] +var v = "foo " + a; diff --git a/tests/baselines/reference/TupleType3.js b/tests/baselines/reference/TupleType3.js new file mode 100644 index 00000000000..8d357a77be7 --- /dev/null +++ b/tests/baselines/reference/TupleType3.js @@ -0,0 +1,5 @@ +//// [TupleType3.ts] +var v: [] + +//// [TupleType3.js] +var v; diff --git a/tests/baselines/reference/TupleType4.js b/tests/baselines/reference/TupleType4.js new file mode 100644 index 00000000000..aaa660f95d9 --- /dev/null +++ b/tests/baselines/reference/TupleType4.js @@ -0,0 +1,5 @@ +//// [TupleType4.ts] +var v: [ + +//// [TupleType4.js] +var v; diff --git a/tests/baselines/reference/TupleType5.js b/tests/baselines/reference/TupleType5.js new file mode 100644 index 00000000000..5e9a0a580be --- /dev/null +++ b/tests/baselines/reference/TupleType5.js @@ -0,0 +1,5 @@ +//// [TupleType5.ts] +var v: [number,] + +//// [TupleType5.js] +var v; diff --git a/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js new file mode 100644 index 00000000000..c7f55d0a2df --- /dev/null +++ b/tests/baselines/reference/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.js @@ -0,0 +1,60 @@ +//// [tests/cases/conformance/internalModules/DeclarationMerging/TwoInternalModulesThatMergeEachWithExportedLocalVarsOfTheSameName.ts] //// + +//// [part1.ts] +export module A { + export interface Point { + x: number; + y: number; + } + + export module Utils { + export function mirror(p: T) { + return { x: p.y, y: p.x }; + } + } + + export var Origin: Point = { x: 0, y: 0 }; +} + +//// [part2.ts] +export module A { + // collision with 'Origin' var in other part of merged module + export var Origin: Point = { x: 0, y: 0 }; + + export module Utils { + export class Plane { + constructor(public tl: Point, public br: Point) { } + } + } +} + + +//// [part1.js] +var A; +(function (A) { + var Utils; + (function (Utils) { + function mirror(p) { + return { x: p.y, y: p.x }; + } + Utils.mirror = mirror; + })(Utils = A.Utils || (A.Utils = {})); + A.Origin = { x: 0, y: 0 }; +})(A = exports.A || (exports.A = {})); +//// [part2.js] +var A; +(function (A) { + // collision with 'Origin' var in other part of merged module + A.Origin = { x: 0, y: 0 }; + var Utils; + (function (Utils) { + var Plane = (function () { + function Plane(tl, br) { + this.tl = tl; + this.br = br; + } + return Plane; + })(); + Utils.Plane = Plane; + })(Utils = A.Utils || (A.Utils = {})); +})(A = exports.A || (exports.A = {})); diff --git a/tests/baselines/reference/TypeArgumentList1.js b/tests/baselines/reference/TypeArgumentList1.js new file mode 100644 index 00000000000..b87b310a9af --- /dev/null +++ b/tests/baselines/reference/TypeArgumentList1.js @@ -0,0 +1,5 @@ +//// [TypeArgumentList1.ts] +Foo(4, 5, 6); + +//// [TypeArgumentList1.js] +Foo(4, 5, 6); diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.js b/tests/baselines/reference/TypeGuardWithEnumUnion.js new file mode 100644 index 00000000000..f582c70857a --- /dev/null +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.js @@ -0,0 +1,77 @@ +//// [TypeGuardWithEnumUnion.ts] +enum Color { R, G, B } + +function f1(x: Color | string) { + if (typeof x === "number") { + var y = x; + var y: Color; + } + else { + var z = x; + var z: string; + } +} + +function f2(x: Color | string | string[]) { + if (typeof x === "object") { + var y = x; + var y: string[]; + } + if (typeof x === "number") { + var z = x; + var z: Color; + } + else { + var w = x; + var w: string | string[]; + } + if (typeof x === "string") { + var a = x; + var a: string; + } + else { + var b = x; + var b: Color | string[]; + } +} + + +//// [TypeGuardWithEnumUnion.js] +var Color; +(function (Color) { + Color[Color["R"] = 0] = "R"; + Color[Color["G"] = 1] = "G"; + Color[Color["B"] = 2] = "B"; +})(Color || (Color = {})); +function f1(x) { + if (typeof x === "number") { + var y = x; + var y; + } + else { + var z = x; + var z; + } +} +function f2(x) { + if (typeof x === "object") { + var y = x; + var y; + } + if (typeof x === "number") { + var z = x; + var z; + } + else { + var w = x; + var w; + } + if (typeof x === "string") { + var a = x; + var a; + } + else { + var b = x; + var b; + } +} diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.types b/tests/baselines/reference/TypeGuardWithEnumUnion.types new file mode 100644 index 00000000000..9296e0ad04e --- /dev/null +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.types @@ -0,0 +1,96 @@ +=== tests/cases/conformance/expressions/typeGuards/TypeGuardWithEnumUnion.ts === +enum Color { R, G, B } +>Color : Color +>R : Color +>G : Color +>B : Color + +function f1(x: Color | string) { +>f1 : (x: string | Color) => void +>x : string | Color +>Color : Color + + if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : string | Color + + var y = x; +>y : Color +>x : Color + + var y: Color; +>y : Color +>Color : Color + } + else { + var z = x; +>z : string +>x : string + + var z: string; +>z : string + } +} + +function f2(x: Color | string | string[]) { +>f2 : (x: string | string[] | Color) => void +>x : string | string[] | Color +>Color : Color + + if (typeof x === "object") { +>typeof x === "object" : boolean +>typeof x : string +>x : string | string[] | Color + + var y = x; +>y : string[] +>x : string[] + + var y: string[]; +>y : string[] + } + if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : string | string[] | Color + + var z = x; +>z : Color +>x : Color + + var z: Color; +>z : Color +>Color : Color + } + else { + var w = x; +>w : string | string[] +>x : string | string[] + + var w: string | string[]; +>w : string | string[] + } + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : string | string[] | Color + + var a = x; +>a : string +>x : string + + var a: string; +>a : string + } + else { + var b = x; +>b : string[] | Color +>x : string[] | Color + + var b: Color | string[]; +>b : string[] | Color +>Color : Color + } +} + diff --git a/tests/baselines/reference/TypeGuardWithEnumUnion.types.pull b/tests/baselines/reference/TypeGuardWithEnumUnion.types.pull new file mode 100644 index 00000000000..33a40762445 --- /dev/null +++ b/tests/baselines/reference/TypeGuardWithEnumUnion.types.pull @@ -0,0 +1,96 @@ +=== tests/cases/conformance/expressions/typeGuards/TypeGuardWithEnumUnion.ts === +enum Color { R, G, B } +>Color : Color +>R : Color +>G : Color +>B : Color + +function f1(x: Color | string) { +>f1 : (x: string | Color) => void +>x : string | Color +>Color : Color + + if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : string | Color + + var y = x; +>y : Color +>x : Color + + var y: Color; +>y : Color +>Color : Color + } + else { + var z = x; +>z : string +>x : string + + var z: string; +>z : string + } +} + +function f2(x: Color | string | string[]) { +>f2 : (x: string | Color | string[]) => void +>x : string | Color | string[] +>Color : Color + + if (typeof x === "object") { +>typeof x === "object" : boolean +>typeof x : string +>x : string | Color | string[] + + var y = x; +>y : string[] +>x : string[] + + var y: string[]; +>y : string[] + } + if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : string | Color | string[] + + var z = x; +>z : Color +>x : Color + + var z: Color; +>z : Color +>Color : Color + } + else { + var w = x; +>w : string | string[] +>x : string | string[] + + var w: string | string[]; +>w : string | string[] + } + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : string | Color | string[] + + var a = x; +>a : string +>x : string + + var a: string; +>a : string + } + else { + var b = x; +>b : Color | string[] +>x : Color | string[] + + var b: Color | string[]; +>b : Color | string[] +>Color : Color + } +} + diff --git a/tests/baselines/reference/VariableDeclaration10_es6.js b/tests/baselines/reference/VariableDeclaration10_es6.js new file mode 100644 index 00000000000..14f47cea04d --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration10_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration10_es6.ts] +let a: number = 1 + +//// [VariableDeclaration10_es6.js] +let a = 1; diff --git a/tests/baselines/reference/VariableDeclaration11_es6.js b/tests/baselines/reference/VariableDeclaration11_es6.js new file mode 100644 index 00000000000..83eec6d9a13 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration11_es6.js @@ -0,0 +1,7 @@ +//// [VariableDeclaration11_es6.ts] +"use strict"; +let + +//// [VariableDeclaration11_es6.js] +"use strict"; +let ; diff --git a/tests/baselines/reference/VariableDeclaration1_es6.js b/tests/baselines/reference/VariableDeclaration1_es6.js new file mode 100644 index 00000000000..26433bd88c3 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration1_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration1_es6.ts] +const + +//// [VariableDeclaration1_es6.js] +const ; diff --git a/tests/baselines/reference/VariableDeclaration2_es6.js b/tests/baselines/reference/VariableDeclaration2_es6.js new file mode 100644 index 00000000000..a955315a2f0 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration2_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration2_es6.ts] +const a + +//// [VariableDeclaration2_es6.js] +const a; diff --git a/tests/baselines/reference/VariableDeclaration3_es6.js b/tests/baselines/reference/VariableDeclaration3_es6.js new file mode 100644 index 00000000000..4be8a3daf38 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration3_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration3_es6.ts] +const a = 1 + +//// [VariableDeclaration3_es6.js] +const a = 1; diff --git a/tests/baselines/reference/VariableDeclaration4_es6.js b/tests/baselines/reference/VariableDeclaration4_es6.js new file mode 100644 index 00000000000..7a9934e052b --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration4_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration4_es6.ts] +const a: number + +//// [VariableDeclaration4_es6.js] +const a; diff --git a/tests/baselines/reference/VariableDeclaration5_es6.js b/tests/baselines/reference/VariableDeclaration5_es6.js new file mode 100644 index 00000000000..e6a3c175651 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration5_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration5_es6.ts] +const a: number = 1 + +//// [VariableDeclaration5_es6.js] +const a = 1; diff --git a/tests/baselines/reference/VariableDeclaration7_es6.js b/tests/baselines/reference/VariableDeclaration7_es6.js new file mode 100644 index 00000000000..00ab95503a6 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration7_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration7_es6.ts] +let a + +//// [VariableDeclaration7_es6.js] +let a; diff --git a/tests/baselines/reference/VariableDeclaration8_es6.js b/tests/baselines/reference/VariableDeclaration8_es6.js new file mode 100644 index 00000000000..9178871ef65 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration8_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration8_es6.ts] +let a = 1 + +//// [VariableDeclaration8_es6.js] +let a = 1; diff --git a/tests/baselines/reference/VariableDeclaration9_es6.js b/tests/baselines/reference/VariableDeclaration9_es6.js new file mode 100644 index 00000000000..b22c5691eb2 --- /dev/null +++ b/tests/baselines/reference/VariableDeclaration9_es6.js @@ -0,0 +1,5 @@ +//// [VariableDeclaration9_es6.ts] +let a: number + +//// [VariableDeclaration9_es6.js] +let a; diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js new file mode 100644 index 00000000000..f111e6e1bdf --- /dev/null +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -0,0 +1,11 @@ +//// [YieldExpression10_es6.ts] +var v = { * foo() { + yield(foo); + } +} + + +//// [YieldExpression10_es6.js] +var v = { foo: function () { + ; +} }; diff --git a/tests/baselines/reference/YieldExpression11_es6.js b/tests/baselines/reference/YieldExpression11_es6.js new file mode 100644 index 00000000000..306cef3051e --- /dev/null +++ b/tests/baselines/reference/YieldExpression11_es6.js @@ -0,0 +1,16 @@ +//// [YieldExpression11_es6.ts] +class C { + *foo() { + yield(foo); + } +} + +//// [YieldExpression11_es6.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + ; + }; + return C; +})(); diff --git a/tests/baselines/reference/YieldExpression12_es6.js b/tests/baselines/reference/YieldExpression12_es6.js new file mode 100644 index 00000000000..020340fc4a3 --- /dev/null +++ b/tests/baselines/reference/YieldExpression12_es6.js @@ -0,0 +1,14 @@ +//// [YieldExpression12_es6.ts] +class C { + constructor() { + yield foo + } +} + +//// [YieldExpression12_es6.js] +var C = (function () { + function C() { + ; + } + return C; +})(); diff --git a/tests/baselines/reference/YieldExpression13_es6.js b/tests/baselines/reference/YieldExpression13_es6.js new file mode 100644 index 00000000000..328fc80dbdd --- /dev/null +++ b/tests/baselines/reference/YieldExpression13_es6.js @@ -0,0 +1,7 @@ +//// [YieldExpression13_es6.ts] +function* foo() { yield } + +//// [YieldExpression13_es6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression14_es6.js b/tests/baselines/reference/YieldExpression14_es6.js new file mode 100644 index 00000000000..132890b1b6a --- /dev/null +++ b/tests/baselines/reference/YieldExpression14_es6.js @@ -0,0 +1,16 @@ +//// [YieldExpression14_es6.ts] +class C { + foo() { + yield foo + } +} + +//// [YieldExpression14_es6.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + ; + }; + return C; +})(); diff --git a/tests/baselines/reference/YieldExpression15_es6.js b/tests/baselines/reference/YieldExpression15_es6.js new file mode 100644 index 00000000000..13e6b92a577 --- /dev/null +++ b/tests/baselines/reference/YieldExpression15_es6.js @@ -0,0 +1,9 @@ +//// [YieldExpression15_es6.ts] +var v = () => { + yield foo + } + +//// [YieldExpression15_es6.js] +var v = function () { + ; +}; diff --git a/tests/baselines/reference/YieldExpression16_es6.js b/tests/baselines/reference/YieldExpression16_es6.js new file mode 100644 index 00000000000..ee73439a2d5 --- /dev/null +++ b/tests/baselines/reference/YieldExpression16_es6.js @@ -0,0 +1,13 @@ +//// [YieldExpression16_es6.ts] +function* foo() { + function bar() { + yield foo; + } +} + +//// [YieldExpression16_es6.js] +function foo() { + function bar() { + ; + } +} diff --git a/tests/baselines/reference/YieldExpression17_es6.js b/tests/baselines/reference/YieldExpression17_es6.js new file mode 100644 index 00000000000..6fd39844d80 --- /dev/null +++ b/tests/baselines/reference/YieldExpression17_es6.js @@ -0,0 +1,7 @@ +//// [YieldExpression17_es6.ts] +var v = { get foo() { yield foo; } } + +//// [YieldExpression17_es6.js] +var v = { get foo() { + ; +} }; diff --git a/tests/baselines/reference/YieldExpression18_es6.js b/tests/baselines/reference/YieldExpression18_es6.js new file mode 100644 index 00000000000..7fb630b9c08 --- /dev/null +++ b/tests/baselines/reference/YieldExpression18_es6.js @@ -0,0 +1,7 @@ +//// [YieldExpression18_es6.ts] +"use strict"; +yield(foo); + +//// [YieldExpression18_es6.js] +"use strict"; +; diff --git a/tests/baselines/reference/YieldExpression19_es6.js b/tests/baselines/reference/YieldExpression19_es6.js new file mode 100644 index 00000000000..91643e09b0e --- /dev/null +++ b/tests/baselines/reference/YieldExpression19_es6.js @@ -0,0 +1,17 @@ +//// [YieldExpression19_es6.ts] +function*foo() { + function bar() { + function* quux() { + yield(foo); + } + } +} + +//// [YieldExpression19_es6.js] +function foo() { + function bar() { + function quux() { + ; + } + } +} diff --git a/tests/baselines/reference/YieldExpression2_es6.js b/tests/baselines/reference/YieldExpression2_es6.js new file mode 100644 index 00000000000..0207b8afca0 --- /dev/null +++ b/tests/baselines/reference/YieldExpression2_es6.js @@ -0,0 +1,5 @@ +//// [YieldExpression2_es6.ts] +yield foo; + +//// [YieldExpression2_es6.js] +; diff --git a/tests/baselines/reference/YieldExpression3_es6.js b/tests/baselines/reference/YieldExpression3_es6.js new file mode 100644 index 00000000000..cc3716587ea --- /dev/null +++ b/tests/baselines/reference/YieldExpression3_es6.js @@ -0,0 +1,11 @@ +//// [YieldExpression3_es6.ts] +function* foo() { + yield + yield +} + +//// [YieldExpression3_es6.js] +function foo() { + ; + ; +} diff --git a/tests/baselines/reference/YieldExpression4_es6.js b/tests/baselines/reference/YieldExpression4_es6.js new file mode 100644 index 00000000000..84b11a03a2c --- /dev/null +++ b/tests/baselines/reference/YieldExpression4_es6.js @@ -0,0 +1,11 @@ +//// [YieldExpression4_es6.ts] +function* foo() { + yield; + yield; +} + +//// [YieldExpression4_es6.js] +function foo() { + ; + ; +} diff --git a/tests/baselines/reference/YieldExpression5_es6.js b/tests/baselines/reference/YieldExpression5_es6.js new file mode 100644 index 00000000000..5e0e9f811fa --- /dev/null +++ b/tests/baselines/reference/YieldExpression5_es6.js @@ -0,0 +1,9 @@ +//// [YieldExpression5_es6.ts] +function* foo() { + yield* +} + +//// [YieldExpression5_es6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression6_es6.js b/tests/baselines/reference/YieldExpression6_es6.js new file mode 100644 index 00000000000..5024e9bbd40 --- /dev/null +++ b/tests/baselines/reference/YieldExpression6_es6.js @@ -0,0 +1,9 @@ +//// [YieldExpression6_es6.ts] +function* foo() { + yield*foo +} + +//// [YieldExpression6_es6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression7_es6.js b/tests/baselines/reference/YieldExpression7_es6.js new file mode 100644 index 00000000000..96ef5af107e --- /dev/null +++ b/tests/baselines/reference/YieldExpression7_es6.js @@ -0,0 +1,9 @@ +//// [YieldExpression7_es6.ts] +function* foo() { + yield foo +} + +//// [YieldExpression7_es6.js] +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression8_es6.js b/tests/baselines/reference/YieldExpression8_es6.js new file mode 100644 index 00000000000..190c2cc3da5 --- /dev/null +++ b/tests/baselines/reference/YieldExpression8_es6.js @@ -0,0 +1,11 @@ +//// [YieldExpression8_es6.ts] +yield(foo); +function* foo() { + yield(foo); +} + +//// [YieldExpression8_es6.js] +yield(foo); +function foo() { + ; +} diff --git a/tests/baselines/reference/YieldExpression9_es6.js b/tests/baselines/reference/YieldExpression9_es6.js new file mode 100644 index 00000000000..978e0d455bd --- /dev/null +++ b/tests/baselines/reference/YieldExpression9_es6.js @@ -0,0 +1,9 @@ +//// [YieldExpression9_es6.ts] +var v = function*() { + yield(foo); +} + +//// [YieldExpression9_es6.js] +var v = function () { + ; +}; diff --git a/tests/baselines/reference/accessibilityModifiers.js b/tests/baselines/reference/accessibilityModifiers.js new file mode 100644 index 00000000000..901b3a29c2e --- /dev/null +++ b/tests/baselines/reference/accessibilityModifiers.js @@ -0,0 +1,171 @@ +//// [accessibilityModifiers.ts] + +// No errors +class C { + private static privateProperty; + private static privateMethod() { } + private static get privateGetter() { return 0; } + private static set privateSetter(a: number) { } + + protected static protectedProperty; + protected static protectedMethod() { } + protected static get protectedGetter() { return 0; } + protected static set protectedSetter(a: number) { } + + public static publicProperty; + public static publicMethod() { } + public static get publicGetter() { return 0; } + public static set publicSetter(a: number) { } +} + +// Errors, accessibility modifiers must precede static +class D { + static private privateProperty; + static private privateMethod() { } + static private get privateGetter() { return 0; } + static private set privateSetter(a: number) { } + + static protected protectedProperty; + static protected protectedMethod() { } + static protected get protectedGetter() { return 0; } + static protected set protectedSetter(a: number) { } + + static public publicProperty; + static public publicMethod() { } + static public get publicGetter() { return 0; } + static public set publicSetter(a: number) { } +} + +// Errors, multiple accessibility modifier +class E { + private public protected property; + public protected method() { } + private protected get getter() { return 0; } + public public set setter(a: number) { } +} + + +//// [accessibilityModifiers.js] +// No errors +var C = (function () { + function C() { + } + C.privateMethod = function () { + }; + Object.defineProperty(C, "privateGetter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "privateSetter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + C.protectedMethod = function () { + }; + Object.defineProperty(C, "protectedGetter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "protectedSetter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + C.publicMethod = function () { + }; + Object.defineProperty(C, "publicGetter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "publicSetter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +// Errors, accessibility modifiers must precede static +var D = (function () { + function D() { + } + D.privateMethod = function () { + }; + Object.defineProperty(D, "privateGetter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D, "privateSetter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + D.protectedMethod = function () { + }; + Object.defineProperty(D, "protectedGetter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D, "protectedSetter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + D.publicMethod = function () { + }; + Object.defineProperty(D, "publicGetter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D, "publicSetter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return D; +})(); +// Errors, multiple accessibility modifier +var E = (function () { + function E() { + } + E.prototype.method = function () { + }; + Object.defineProperty(E.prototype, "getter", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(E.prototype, "setter", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return E; +})(); diff --git a/tests/baselines/reference/accessorWithES3.js b/tests/baselines/reference/accessorWithES3.js new file mode 100644 index 00000000000..6eba5238a91 --- /dev/null +++ b/tests/baselines/reference/accessorWithES3.js @@ -0,0 +1,57 @@ +//// [accessorWithES3.ts] + +// error to use accessors in ES3 mode + +class C { + get x() { + return 1; + } +} + +class D { + set x(v) { + } +} + +var x = { + get a() { return 1 } +} + +var y = { + set b(v) { } +} + +//// [accessorWithES3.js] +// error to use accessors in ES3 mode +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function () { + function D() { + } + Object.defineProperty(D.prototype, "x", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return D; +})(); +var x = { + get a() { + return 1; + } +}; +var y = { + set b(v) { + } +}; diff --git a/tests/baselines/reference/accessorWithInitializer.js b/tests/baselines/reference/accessorWithInitializer.js new file mode 100644 index 00000000000..26e72fe7d7d --- /dev/null +++ b/tests/baselines/reference/accessorWithInitializer.js @@ -0,0 +1,27 @@ +//// [accessorWithInitializer.ts] + +class C { + set X(v = 0) { } + static set X(v2 = 0) { } +} + +//// [accessorWithInitializer.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "X", { + set: function (v) { + if (v === void 0) { v = 0; } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "X", { + set: function (v2) { + if (v2 === void 0) { v2 = 0; } + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/accessorWithRestParam.js b/tests/baselines/reference/accessorWithRestParam.js new file mode 100644 index 00000000000..9feafe1904d --- /dev/null +++ b/tests/baselines/reference/accessorWithRestParam.js @@ -0,0 +1,33 @@ +//// [accessorWithRestParam.ts] + +class C { + set X(...v) { } + static set X(...v2) { } +} + +//// [accessorWithRestParam.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "X", { + set: function () { + var v = []; + for (var _i = 0; _i < arguments.length; _i++) { + v[_i - 0] = arguments[_i]; + } + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "X", { + set: function () { + var v2 = []; + for (var _i = 0; _i < arguments.length; _i++) { + v2[_i - 0] = arguments[_i]; + } + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/accessorWithoutBody1.js b/tests/baselines/reference/accessorWithoutBody1.js new file mode 100644 index 00000000000..37f0ecbcfee --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody1.js @@ -0,0 +1,6 @@ +//// [accessorWithoutBody1.ts] +var v = { get foo() } + +//// [accessorWithoutBody1.js] +var v = { get foo() { +} }; diff --git a/tests/baselines/reference/accessorWithoutBody2.js b/tests/baselines/reference/accessorWithoutBody2.js new file mode 100644 index 00000000000..9dc34c1e744 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody2.js @@ -0,0 +1,6 @@ +//// [accessorWithoutBody2.ts] +var v = { set foo(a) } + +//// [accessorWithoutBody2.js] +var v = { set foo(a) { +} }; diff --git a/tests/baselines/reference/accessorsAreNotContextuallyTyped.js b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js new file mode 100644 index 00000000000..8c01173a13c --- /dev/null +++ b/tests/baselines/reference/accessorsAreNotContextuallyTyped.js @@ -0,0 +1,33 @@ +//// [accessorsAreNotContextuallyTyped.ts] +// accessors are not contextually typed + +class C { + set x(v: (a: string) => string) { + } + + get x() { + return (x: string) => ""; + } +} + +var c: C; +var r = c.x(''); // string + +//// [accessorsAreNotContextuallyTyped.js] +// accessors are not contextually typed +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return function (x) { return ""; }; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var c; +var r = c.x(''); // string diff --git a/tests/baselines/reference/accessorsEmit.js b/tests/baselines/reference/accessorsEmit.js new file mode 100644 index 00000000000..e2c097e263f --- /dev/null +++ b/tests/baselines/reference/accessorsEmit.js @@ -0,0 +1,49 @@ +//// [accessorsEmit.ts] +class Result { } + +class Test { + get Property(): Result { + var x = 1; + return null; + } +} + +class Test2 { + get Property() { + var x = 1; + return null; + } +} + +//// [accessorsEmit.js] +var Result = (function () { + function Result() { + } + return Result; +})(); +var Test = (function () { + function Test() { + } + Object.defineProperty(Test.prototype, "Property", { + get: function () { + var x = 1; + return null; + }, + enumerable: true, + configurable: true + }); + return Test; +})(); +var Test2 = (function () { + function Test2() { + } + Object.defineProperty(Test2.prototype, "Property", { + get: function () { + var x = 1; + return null; + }, + enumerable: true, + configurable: true + }); + return Test2; +})(); diff --git a/tests/baselines/reference/accessorsInAmbientContext.js b/tests/baselines/reference/accessorsInAmbientContext.js new file mode 100644 index 00000000000..e60831ede5b --- /dev/null +++ b/tests/baselines/reference/accessorsInAmbientContext.js @@ -0,0 +1,21 @@ +//// [accessorsInAmbientContext.ts] + +declare module M { + class C { + get X() { return 1; } + set X(v) { } + + static get Y() { return 1; } + static set Y(v) { } + } +} + +declare class C { + get X() { return 1; } + set X(v) { } + + static get Y() { return 1; } + static set Y(v) { } +} + +//// [accessorsInAmbientContext.js] diff --git a/tests/baselines/reference/accessorsNotAllowedInES3.js b/tests/baselines/reference/accessorsNotAllowedInES3.js new file mode 100644 index 00000000000..5cb5a5dc47a --- /dev/null +++ b/tests/baselines/reference/accessorsNotAllowedInES3.js @@ -0,0 +1,24 @@ +//// [accessorsNotAllowedInES3.ts] + +class C { + get x(): number { return 1; } +} +var y = { get foo() { return 3; } }; + + +//// [accessorsNotAllowedInES3.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var y = { get foo() { + return 3; +} }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js new file mode 100644 index 00000000000..6a3b3773aa6 --- /dev/null +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js @@ -0,0 +1,59 @@ +//// [accessors_spec_section-4.5_error-cases.ts] +class LanguageSpec_section_4_5_error_cases { + public set AnnotatedSetter_SetterFirst(a: number) { } + public get AnnotatedSetter_SetterFirst() { return ""; } + + public get AnnotatedSetter_SetterLast() { return ""; } + public set AnnotatedSetter_SetterLast(a: number) { } + + public get AnnotatedGetter_GetterFirst(): string { return ""; } + public set AnnotatedGetter_GetterFirst(aStr) { aStr = 0; } + + public set AnnotatedGetter_GetterLast(aStr) { aStr = 0; } + public get AnnotatedGetter_GetterLast(): string { return ""; } +} + +//// [accessors_spec_section-4.5_error-cases.js] +var LanguageSpec_section_4_5_error_cases = (function () { + function LanguageSpec_section_4_5_error_cases() { + } + Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", { + get: function () { + return ""; + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", { + get: function () { + return ""; + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", { + get: function () { + return ""; + }, + set: function (aStr) { + aStr = 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", { + get: function () { + return ""; + }, + set: function (aStr) { + aStr = 0; + }, + enumerable: true, + configurable: true + }); + return LanguageSpec_section_4_5_error_cases; +})(); diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js new file mode 100644 index 00000000000..b140e565b29 --- /dev/null +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -0,0 +1,104 @@ +//// [accessors_spec_section-4.5_inference.ts] +class A { } +class B extends A { } + +class LanguageSpec_section_4_5_inference { + + public set InferredGetterFromSetterAnnotation(a: A) { } + public get InferredGetterFromSetterAnnotation() { return new B(); } + + public get InferredGetterFromSetterAnnotation_GetterFirst() { return new B(); } + public set InferredGetterFromSetterAnnotation_GetterFirst(a: A) { } + + + public get InferredFromGetter() { return new B(); } + public set InferredFromGetter(a) { } + + public set InferredFromGetter_SetterFirst(a) { } + public get InferredFromGetter_SetterFirst() { return new B(); } + + public set InferredSetterFromGetterAnnotation(a) { } + public get InferredSetterFromGetterAnnotation() : A { return new B(); } + + public get InferredSetterFromGetterAnnotation_GetterFirst() : A { return new B(); } + public set InferredSetterFromGetterAnnotation_GetterFirst(a) { } +} + +//// [accessors_spec_section-4.5_inference.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var A = (function () { + function A() { + } + return A; +})(); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; +})(A); +var LanguageSpec_section_4_5_inference = (function () { + function LanguageSpec_section_4_5_inference() { + } + Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", { + get: function () { + return new B(); + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", { + get: function () { + return new B(); + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", { + get: function () { + return new B(); + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", { + get: function () { + return new B(); + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", { + get: function () { + return new B(); + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", { + get: function () { + return new B(); + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return LanguageSpec_section_4_5_inference; +})(); diff --git a/tests/baselines/reference/aliasErrors.js b/tests/baselines/reference/aliasErrors.js new file mode 100644 index 00000000000..e61ca167661 --- /dev/null +++ b/tests/baselines/reference/aliasErrors.js @@ -0,0 +1,68 @@ +//// [aliasErrors.ts] +module foo { + export class Provide { + } + export module bar { export module baz {export class boo {}}} +} + +import provide = foo; +import booz = foo.bar.baz; +import beez = foo.bar; + +import m = no; +import m2 = no.mod; +import n = 5; +import o = "s"; +import q = null; +import r = undefined; + + +var p = new provide.Provide(); + +function use() { + + beez.baz.boo; + var p1: provide.Provide; + var p2: foo.Provide; + var p3:booz.bar; + var p22 = new provide.Provide(); +} + + + +//// [aliasErrors.js] +var foo; +(function (foo) { + var Provide = (function () { + function Provide() { + } + return Provide; + })(); + foo.Provide = Provide; + var bar; + (function (bar) { + var baz; + (function (baz) { + var boo = (function () { + function boo() { + } + return boo; + })(); + baz.boo = boo; + })(baz = bar.baz || (bar.baz = {})); + })(bar = foo.bar || (foo.bar = {})); +})(foo || (foo = {})); +var provide = foo; +var booz = foo.bar.baz; +var beez = foo.bar; +5; +"s"; +null; +var p = new provide.Provide(); +function use() { + beez.baz.boo; + var p1; + var p2; + var p3; + var p22 = new provide.Provide(); +} diff --git a/tests/baselines/reference/aliasUsageInOrExpression.types.pull b/tests/baselines/reference/aliasUsageInOrExpression.types.pull new file mode 100644 index 00000000000..cc45af29f86 --- /dev/null +++ b/tests/baselines/reference/aliasUsageInOrExpression.types.pull @@ -0,0 +1,83 @@ +=== tests/cases/compiler/aliasUsageInOrExpression_main.ts === +import Backbone = require("aliasUsageInOrExpression_backbone"); +>Backbone : typeof Backbone + +import moduleA = require("aliasUsageInOrExpression_moduleA"); +>moduleA : typeof moduleA + +interface IHasVisualizationModel { +>IHasVisualizationModel : IHasVisualizationModel + + VisualizationModel: typeof Backbone.Model; +>VisualizationModel : typeof Backbone.Model +>Backbone : typeof Backbone +>Model : typeof Backbone.Model +} +var i: IHasVisualizationModel; +>i : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel + +var d1 = i || moduleA; +>d1 : typeof moduleA +>i || moduleA : typeof moduleA +>i : IHasVisualizationModel +>moduleA : typeof moduleA + +var d2: IHasVisualizationModel = i || moduleA; +>d2 : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>i || moduleA : typeof moduleA +>i : IHasVisualizationModel +>moduleA : typeof moduleA + +var d2: IHasVisualizationModel = moduleA || i; +>d2 : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>moduleA || i : typeof moduleA +>moduleA : typeof moduleA +>i : IHasVisualizationModel + +var e: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null || { x: moduleA }; +>e : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +><{ x: IHasVisualizationModel }>null || { x: moduleA } : { x: IHasVisualizationModel; } +><{ x: IHasVisualizationModel }>null : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>{ x: moduleA } : { x: typeof moduleA; } +>x : typeof moduleA +>moduleA : typeof moduleA + +var f: { x: IHasVisualizationModel } = <{ x: IHasVisualizationModel }>null ? { x: moduleA } : null; +>f : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +><{ x: IHasVisualizationModel }>null ? { x: moduleA } : null : { x: typeof moduleA; } +><{ x: IHasVisualizationModel }>null : { x: IHasVisualizationModel; } +>x : IHasVisualizationModel +>IHasVisualizationModel : IHasVisualizationModel +>{ x: moduleA } : { x: typeof moduleA; } +>x : typeof moduleA +>moduleA : typeof moduleA + +=== tests/cases/compiler/aliasUsageInOrExpression_backbone.ts === +export class Model { +>Model : Model + + public someData: string; +>someData : string +} + +=== tests/cases/compiler/aliasUsageInOrExpression_moduleA.ts === +import Backbone = require("aliasUsageInOrExpression_backbone"); +>Backbone : typeof Backbone + +export class VisualizationModel extends Backbone.Model { +>VisualizationModel : VisualizationModel +>Backbone : unknown +>Model : Backbone.Model + + // interesting stuff here +} + diff --git a/tests/baselines/reference/ambientDeclarationsExternal.js b/tests/baselines/reference/ambientDeclarationsExternal.js new file mode 100644 index 00000000000..7d8491e0062 --- /dev/null +++ b/tests/baselines/reference/ambientDeclarationsExternal.js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/ambient/ambientDeclarationsExternal.ts] //// + +//// [decls.ts] + +// Ambient external module with export assignment +declare module 'equ' { + var x; + export = x; +} + +declare module 'equ2' { + var x: number; +} + +// Ambient external import declaration referencing ambient external module using top level module name +//// [consumer.ts] +/// +import imp1 = require('equ'); + + +// Ambient external module members are always exported with or without export keyword when module lacks export assignment +import imp3 = require('equ2'); +var n = imp3.x; +var n: number; + + +//// [decls.js] +// Ambient external import declaration referencing ambient external module using top level module name +//// [consumer.js] +// Ambient external module members are always exported with or without export keyword when module lacks export assignment +var imp3 = require('equ2'); +var n = imp3.x; +var n; diff --git a/tests/baselines/reference/ambientEnum1.js b/tests/baselines/reference/ambientEnum1.js new file mode 100644 index 00000000000..8a477ab99fa --- /dev/null +++ b/tests/baselines/reference/ambientEnum1.js @@ -0,0 +1,11 @@ +//// [ambientEnum1.ts] + declare enum E1 { + y = 4.23 + } + + // Ambient enum with computer member + declare enum E2 { + x = 'foo'.length + } + +//// [ambientEnum1.js] diff --git a/tests/baselines/reference/ambientEnumElementInitializer3.js b/tests/baselines/reference/ambientEnumElementInitializer3.js new file mode 100644 index 00000000000..7a7a077ff8f --- /dev/null +++ b/tests/baselines/reference/ambientEnumElementInitializer3.js @@ -0,0 +1,6 @@ +//// [ambientEnumElementInitializer3.ts] +declare enum E { + e = 3.3 // Decimal +} + +//// [ambientEnumElementInitializer3.js] diff --git a/tests/baselines/reference/ambientErrors.js b/tests/baselines/reference/ambientErrors.js new file mode 100644 index 00000000000..c524a6cfe72 --- /dev/null +++ b/tests/baselines/reference/ambientErrors.js @@ -0,0 +1,63 @@ +//// [ambientErrors.ts] +// Ambient variable with an initializer +declare var x = 4; + +// Ambient functions with invalid overloads +declare function fn(x: number): string; +declare function fn(x: 'foo'): number; + +// Ambient functions with duplicate signatures +declare function fn1(x: number): string; +declare function fn1(x: number): string; + +// Ambient function overloads that differ only by return type +declare function fn2(x: number): string; +declare function fn2(x: number): number; + +// Ambient function with default parameter values +declare function fn3(x = 3); + +// Ambient function with function body +declare function fn4() { }; + +// Ambient enum with non - integer literal constant member +declare enum E1 { + y = 4.23 +} + +// Ambient enum with computer member +declare enum E2 { + x = 'foo'.length +} + +// Ambient module with initializers for values, bodies for functions / classes +declare module M1 { + var x = 3; + function fn() { } + class C { + static x = 3; + y = 4; + constructor() { } + fn() { } + static sfn() { } + } +} + +// Ambient external module not in the global module +module M2 { + declare module 'nope' { } +} + +// Ambient external module with a string literal name that isn't a top level external module name +declare module '../foo' { } + +// Ambient external module with export assignment and other exported members +declare module 'bar' { + var n; + export var q; + export = n; +} + + +//// [ambientErrors.js] +; diff --git a/tests/baselines/reference/ambientErrors1.js b/tests/baselines/reference/ambientErrors1.js new file mode 100644 index 00000000000..8605489d3df --- /dev/null +++ b/tests/baselines/reference/ambientErrors1.js @@ -0,0 +1,4 @@ +//// [ambientErrors1.ts] +declare var x = 4; + +//// [ambientErrors1.js] diff --git a/tests/baselines/reference/ambientGetters.js b/tests/baselines/reference/ambientGetters.js new file mode 100644 index 00000000000..9e267a1dddb --- /dev/null +++ b/tests/baselines/reference/ambientGetters.js @@ -0,0 +1,11 @@ +//// [ambientGetters.ts] + +declare class A { + get length() : number; +} + +declare class B { + get length() { return 0; } +} + +//// [ambientGetters.js] diff --git a/tests/baselines/reference/ambientStatement1.js b/tests/baselines/reference/ambientStatement1.js new file mode 100644 index 00000000000..f986f9717ad --- /dev/null +++ b/tests/baselines/reference/ambientStatement1.js @@ -0,0 +1,8 @@ +//// [ambientStatement1.ts] + declare module M1 { + while(true); + + export var v1 = () => false; + } + +//// [ambientStatement1.js] diff --git a/tests/baselines/reference/ambientWithStatements.js b/tests/baselines/reference/ambientWithStatements.js new file mode 100644 index 00000000000..997916d0bf7 --- /dev/null +++ b/tests/baselines/reference/ambientWithStatements.js @@ -0,0 +1,30 @@ +//// [ambientWithStatements.ts] +declare module M { + break; + continue; + debugger; + do { } while (true); + var x; + for (x in null) { } + if (true) { } else { } + 1; + L: var y; + return; + switch (x) { + case 1: + break; + default: + break; + } + throw "nooo"; + try { + } + catch (e) { + } + finally { + } + with (x) { + } +} + +//// [ambientWithStatements.js] diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.js b/tests/baselines/reference/ambiguousGenericAssertion1.js new file mode 100644 index 00000000000..40bbbee6dd2 --- /dev/null +++ b/tests/baselines/reference/ambiguousGenericAssertion1.js @@ -0,0 +1,15 @@ +//// [ambiguousGenericAssertion1.ts] +function f(x: T): T { return null; } +var r = (x: T) => x; +var r2 = < (x: T) => T>f; // valid +var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operation + + +//// [ambiguousGenericAssertion1.js] +function f(x) { + return null; +} +var r = function (x) { return x; }; +var r2 = f; // valid +var r3 = << T > (x), T; +T > f; // ambiguous, appears to the parser as a << operation diff --git a/tests/baselines/reference/amdModuleName2.js b/tests/baselines/reference/amdModuleName2.js new file mode 100644 index 00000000000..90e50ce1e48 --- /dev/null +++ b/tests/baselines/reference/amdModuleName2.js @@ -0,0 +1,24 @@ +//// [amdModuleName2.ts] +/// +/// +class Foo { + x: number; + constructor() { + this.x = 5; + } +} +export = Foo; + + +//// [amdModuleName2.js] +define("SecondModuleName", ["require", "exports"], function (require, exports) { + /// + /// + var Foo = (function () { + function Foo() { + this.x = 5; + } + return Foo; + })(); + return Foo; +}); diff --git a/tests/baselines/reference/anonymousModules.js b/tests/baselines/reference/anonymousModules.js new file mode 100644 index 00000000000..39b21f6990a --- /dev/null +++ b/tests/baselines/reference/anonymousModules.js @@ -0,0 +1,29 @@ +//// [anonymousModules.ts] +module { + export var foo = 1; + + module { + export var bar = 1; + } + + var bar = 2; + + module { + var x = bar; + } +} + +//// [anonymousModules.js] +module; +{ + exports.foo = 1; + module; + { + exports.bar = 1; + } + var bar = 2; + module; + { + var x = bar; + } +} diff --git a/tests/baselines/reference/anyIdenticalToItself.js b/tests/baselines/reference/anyIdenticalToItself.js new file mode 100644 index 00000000000..dc221b69aa7 --- /dev/null +++ b/tests/baselines/reference/anyIdenticalToItself.js @@ -0,0 +1,32 @@ +//// [anyIdenticalToItself.ts] +function foo(x: any); +function foo(x: any); +function foo(x: any, y: number) { } + +class C { + get X(): any { + var y: any; + return y; + } + set X(v: any) { + } +} + +//// [anyIdenticalToItself.js] +function foo(x, y) { +} +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "X", { + get: function () { + var y; + return y; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/arrayAssignmentTest3.errors.txt b/tests/baselines/reference/arrayAssignmentTest3.errors.txt index 1c88408eb52..31347782c5d 100644 --- a/tests/baselines/reference/arrayAssignmentTest3.errors.txt +++ b/tests/baselines/reference/arrayAssignmentTest3.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'. + Property 'length' is missing in type 'B'. ==== tests/cases/compiler/arrayAssignmentTest3.ts (1 errors) ==== @@ -16,5 +17,6 @@ tests/cases/compiler/arrayAssignmentTest3.ts(12,25): error TS2345: Argument of t var xx = new a(null, 7, new B()); ~~~~~~~ !!! error TS2345: Argument of type 'B' is not assignable to parameter of type 'B[]'. +!!! error TS2345: Property 'length' is missing in type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/arrayCast.errors.txt b/tests/baselines/reference/arrayCast.errors.txt index 53be1c903a3..10562cc57e4 100644 --- a/tests/baselines/reference/arrayCast.errors.txt +++ b/tests/baselines/reference/arrayCast.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. Type '{ foo: string; }' is not assignable to type '{ id: number; }'. + Property 'id' is missing in type '{ foo: string; }'. ==== tests/cases/compiler/arrayCast.ts (1 errors) ==== @@ -9,6 +10,7 @@ tests/cases/compiler/arrayCast.ts(3,1): error TS2352: Neither type '{ foo: strin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2352: Neither type '{ foo: string; }[]' nor type '{ id: number; }[]' is assignable to the other. !!! error TS2352: Type '{ foo: string; }' is not assignable to type '{ id: number; }'. +!!! error TS2352: Property 'id' is missing in type '{ foo: string; }'. // Should succeed, as the {} element causes the type of the array to be {}[] <{ id: number; }[]>[{ foo: "s" }, {}]; \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiterals.types.pull b/tests/baselines/reference/arrayLiterals.types.pull new file mode 100644 index 00000000000..bd06540aca3 --- /dev/null +++ b/tests/baselines/reference/arrayLiterals.types.pull @@ -0,0 +1,124 @@ +=== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals.ts === +// Empty array literal with no contextual type has type Undefined[] + +var arr1= [[], [1], ['']]; +>arr1 : (number[] | string[])[] +>[[], [1], ['']] : (number[] | string[])[] +>[] : undefined[] +>[1] : number[] +>[''] : string[] + +var arr2 = [[null], [1], ['']]; +>arr2 : (number[] | string[])[] +>[[null], [1], ['']] : (number[] | string[])[] +>[null] : null[] +>[1] : number[] +>[''] : string[] + + +// Array literal with elements of only EveryType E has type E[] +var stringArrArr = [[''], [""]]; +>stringArrArr : string[][] +>[[''], [""]] : string[][] +>[''] : string[] +>[""] : string[] + +var stringArr = ['', ""]; +>stringArr : string[] +>['', ""] : string[] + +var numberArr = [0, 0.0, 0x00, 1e1]; +>numberArr : number[] +>[0, 0.0, 0x00, 1e1] : number[] + +var boolArr = [false, true, false, true]; +>boolArr : boolean[] +>[false, true, false, true] : boolean[] + +class C { private p; } +>C : C +>p : any + +var classArr = [new C(), new C()]; +>classArr : C[] +>[new C(), new C()] : C[] +>new C() : C +>C : typeof C +>new C() : C +>C : typeof C + +var classTypeArray = [C, C, C]; +>classTypeArray : typeof C[] +>[C, C, C] : typeof C[] +>C : typeof C +>C : typeof C +>C : typeof C + +var classTypeArray: Array; // Should OK, not be a parse error +>classTypeArray : typeof C[] +>Array : T[] +>C : typeof C + +// Contextual type C with numeric index signature makes array literal of EveryType E of type BCT(E,C)[] +var context1: { [n: number]: { a: string; b: number; }; } = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; +>context1 : { [n: number]: { a: string; b: number; }; } +>n : number +>a : string +>b : number +>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] +>{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } +>a : string +>b : number +>c : string +>{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } +>a : string +>b : number +>c : number + +var context2 = [{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }]; +>context2 : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] +>[{ a: '', b: 0, c: '' }, { a: "", b: 3, c: 0 }] : ({ a: string; b: number; c: string; } | { a: string; b: number; c: number; })[] +>{ a: '', b: 0, c: '' } : { a: string; b: number; c: string; } +>a : string +>b : number +>c : string +>{ a: "", b: 3, c: 0 } : { a: string; b: number; c: number; } +>a : string +>b : number +>c : number + +// Contextual type C with numeric index signature of type Base makes array literal of Derived have type Base[] +class Base { private p; } +>Base : Base +>p : any + +class Derived1 extends Base { private m }; +>Derived1 : Derived1 +>Base : Base +>m : any + +class Derived2 extends Base { private n }; +>Derived2 : Derived2 +>Base : Base +>n : any + +var context3: Base[] = [new Derived1(), new Derived2()]; +>context3 : Base[] +>Base : Base +>[new Derived1(), new Derived2()] : (Derived1 | Derived2)[] +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 +>new Derived2() : Derived2 +>Derived2 : typeof Derived2 + +// Contextual type C with numeric index signature of type Base makes array literal of Derived1 and Derived2 have type Base[] +var context4: Base[] = [new Derived1(), new Derived1()]; +>context4 : Base[] +>Base : Base +>[new Derived1(), new Derived1()] : Derived1[] +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 +>new Derived1() : Derived1 +>Derived1 : typeof Derived1 + + diff --git a/tests/baselines/reference/arraySigChecking.js b/tests/baselines/reference/arraySigChecking.js new file mode 100644 index 00000000000..16189305ead --- /dev/null +++ b/tests/baselines/reference/arraySigChecking.js @@ -0,0 +1,46 @@ +//// [arraySigChecking.ts] +declare module M { + interface iBar { t: any; } + interface iFoo extends iBar { + s: any; + } + + class cFoo { + t: any; + } + + var foo: { [index: any]; }; // expect an error here +} + +interface myInt { + voidFn(): void; +} +var myVar: myInt; +var strArray: string[] = [myVar.voidFn()]; + + +var myArray: number[][][]; +myArray = [[1, 2]]; + +function isEmpty(l: { length: number }) { + return l.length === 0; +} + +isEmpty([]); +isEmpty(new Array(3)); +isEmpty(new Array(3)); +isEmpty(['a']); + + +//// [arraySigChecking.js] +var myVar; +var strArray = [myVar.voidFn()]; +var myArray; +myArray = [[1, 2]]; +function isEmpty(l) { + return l.length === 0; +} +isEmpty([]); +isEmpty(new Array(3)); +isEmpty(new Array(3)); +isEmpty(['a']); diff --git a/tests/baselines/reference/arrayTypeOfTypeOf.js b/tests/baselines/reference/arrayTypeOfTypeOf.js new file mode 100644 index 00000000000..f3653346be4 --- /dev/null +++ b/tests/baselines/reference/arrayTypeOfTypeOf.js @@ -0,0 +1,16 @@ +//// [arrayTypeOfTypeOf.ts] +// array type cannot use typeof. + +var x = 1; +var xs: typeof x[]; // Not an error. This is equivalent to Array +var xs2: typeof Array; +var xs3: typeof Array; +var xs4: typeof Array; + +//// [arrayTypeOfTypeOf.js] +// array type cannot use typeof. +var x = 1; +var xs; // Not an error. This is equivalent to Array +var xs2; +var xs3 = ; +var xs4 = ; diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index abb8fd0ab7a..cdf902a6c37 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -103,6 +103,7 @@ var __extends = this.__extends || function (d, b) { __.prototype = b.prototype; d.prototype = new __(); }; +// Arrow function used in with statement with (window) { var p = function () { return this; }; } @@ -142,6 +143,7 @@ var M; // Repeat above for module members that are functions? (necessary to redo all of them?) var M2; (function (M2) { + // Arrow function used in with statement with (window) { var p = function () { return this; }; } diff --git a/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.js b/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.js new file mode 100644 index 00000000000..931520294e9 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionMissingCurlyWithSemicolon.js @@ -0,0 +1,11 @@ +//// [arrowFunctionMissingCurlyWithSemicolon.ts] +// Should error at semicolon. +var f = () => ; +var b = 1 * 2 * 3 * 4; +var square = (x: number) => x * x; + +//// [arrowFunctionMissingCurlyWithSemicolon.js] +// Should error at semicolon. +var f = ; +var b = 1 * 2 * 3 * 4; +var square = function (x) { return x * x; }; diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.js b/tests/baselines/reference/arrowFunctionsMissingTokens.js new file mode 100644 index 00000000000..7bd24f07577 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -0,0 +1,140 @@ +//// [arrowFunctionsMissingTokens.ts] + +module missingArrowsWithCurly { + var a = () { }; + + var b = (): void { } + + var c = (x) { }; + + var d = (x: number, y: string) { }; + + var e = (x: number, y: string): void { }; +} + +module missingCurliesWithArrow { + module withStatement { + var a = () => var k = 10;}; + + var b = (): void => var k = 10;} + + var c = (x) => var k = 10;}; + + var d = (x: number, y: string) => var k = 10;}; + + var e = (x: number, y: string): void => var k = 10;}; + + var f = () => var k = 10;} + } + + module withoutStatement { + var a = () => }; + + var b = (): void => } + + var c = (x) => }; + + var d = (x: number, y: string) => }; + + var e = (x: number, y: string): void => }; + + var f = () => } + } +} + +module ce_nEst_pas_une_arrow_function { + var a = (); + + var b = (): void; + + var c = (x); + + var d = (x: number, y: string); + + var e = (x: number, y: string): void; +} + +module okay { + var a = () => { }; + + var b = (): void => { } + + var c = (x) => { }; + + var d = (x: number, y: string) => { }; + + var e = (x: number, y: string): void => { }; +} + +//// [arrowFunctionsMissingTokens.js] +var missingArrowsWithCurly; +(function (missingArrowsWithCurly) { + var a = function () { + }; + var b = function () { + }; + var c = function (x) { + }; + var d = function (x, y) { + }; + var e = function (x, y) { + }; +})(missingArrowsWithCurly || (missingArrowsWithCurly = {})); +var missingCurliesWithArrow; +(function (missingCurliesWithArrow) { + var withStatement; + (function (withStatement) { + var a = function () { + var k = 10; + }; + var b = function () { + var k = 10; + }; + var c = function (x) { + var k = 10; + }; + var d = function (x, y) { + var k = 10; + }; + var e = function (x, y) { + var k = 10; + }; + var f = function () { + var k = 10; + }; + })(withStatement || (withStatement = {})); + var withoutStatement; + (function (withoutStatement) { + var a = ; + })(withoutStatement || (withoutStatement = {})); + ; + var b = ; +})(missingCurliesWithArrow || (missingCurliesWithArrow = {})); +var c = ; +; +var d = ; +; +var e = ; +; +var f = ; +var ce_nEst_pas_une_arrow_function; +(function (ce_nEst_pas_une_arrow_function) { + var a = (); + var b = ; + var c = (x); + var d = ; + var e = ; +})(ce_nEst_pas_une_arrow_function || (ce_nEst_pas_une_arrow_function = {})); +var okay; +(function (okay) { + var a = function () { + }; + var b = function () { + }; + var c = function (x) { + }; + var d = function (x, y) { + }; + var e = function (x, y) { + }; +})(okay || (okay = {})); diff --git a/tests/baselines/reference/asiReturn.js b/tests/baselines/reference/asiReturn.js new file mode 100644 index 00000000000..ef2aada682c --- /dev/null +++ b/tests/baselines/reference/asiReturn.js @@ -0,0 +1,7 @@ +//// [asiReturn.ts] +// This should be an error for using a return outside a function, but ASI should work properly +return + +//// [asiReturn.js] +// This should be an error for using a return outside a function, but ASI should work properly +return; diff --git a/tests/baselines/reference/assertInWrapSomeTypeParameter.js b/tests/baselines/reference/assertInWrapSomeTypeParameter.js new file mode 100644 index 00000000000..efb7d31a86a --- /dev/null +++ b/tests/baselines/reference/assertInWrapSomeTypeParameter.js @@ -0,0 +1,16 @@ +//// [assertInWrapSomeTypeParameter.ts] +class C> { + foo>(x: U) { + return null; + } +} + +//// [assertInWrapSomeTypeParameter.js] +var C = (function () { + function C() { + } + C.prototype.foo = function (x) { + return null; + }; + return C; +})(); diff --git a/tests/baselines/reference/assignmentCompatBug2.errors.txt b/tests/baselines/reference/assignmentCompatBug2.errors.txt index b90c470d771..15bf1111391 100644 --- a/tests/baselines/reference/assignmentCompatBug2.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug2.errors.txt @@ -2,10 +2,10 @@ tests/cases/compiler/assignmentCompatBug2.ts(1,5): error TS2322: Type '{ a: numb Property 'b' is missing in type '{ a: number; }'. tests/cases/compiler/assignmentCompatBug2.ts(3,1): error TS2322: Type '{ a: number; }' is not assignable to type '{ b: number; }'. Property 'b' is missing in type '{ a: number; }'. -tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. - Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }'. -tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. - Property 'g' is missing in type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }'. +tests/cases/compiler/assignmentCompatBug2.ts(15,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. + Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. +tests/cases/compiler/assignmentCompatBug2.ts(20,1): error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. + Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'. tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n: number; k: (a: any) => any; }'. @@ -33,16 +33,16 @@ tests/cases/compiler/assignmentCompatBug2.ts(33,1): error TS2322: Type '{ f: (n: b3 = { ~~ -!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. -!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; n?: number; k?(a: any): any; }'. +!!! error TS2322: Type '{ f: (n: number) => number; g: (s: string) => number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. +!!! error TS2322: Property 'm' is missing in type '{ f: (n: number) => number; g: (s: string) => number; }'. f: (n) => { return 0; }, g: (s) => { return 0; }, }; // error b3 = { ~~ -!!! error TS2322: Type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. -!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => number; m: number; n?: number; k?(a: any): any; }'. +!!! error TS2322: Type '{ f: (n: number) => number; m: number; }' is not assignable to type '{ f(n: number): number; g(s: string): number; m: number; n?: number; k?(a: any): any; }'. +!!! error TS2322: Property 'g' is missing in type '{ f: (n: number) => number; m: number; }'. f: (n) => { return 0; }, m: 0, }; // error diff --git a/tests/baselines/reference/assignmentCompatBug3.js b/tests/baselines/reference/assignmentCompatBug3.js new file mode 100644 index 00000000000..6d3deedc5b8 --- /dev/null +++ b/tests/baselines/reference/assignmentCompatBug3.js @@ -0,0 +1,61 @@ +//// [assignmentCompatBug3.ts] +function makePoint(x: number, y: number) { + return { + get x() { return x;}, // shouldn't be "void" + get y() { return y;}, // shouldn't be "void" + //x: "yo", + //y: "boo", + dist: function () { + return Math.sqrt(x*x+y*y); // shouldn't be picking up "x" and "y" from the object lit + } + } +} + +class C { + get x() { + return 0; + } +} + +function foo(test: string) { } + +var x: any; +var y: any; + +foo(x); +foo(x + y); + +//// [assignmentCompatBug3.js] +function makePoint(x, y) { + return { + get x() { + return x; + }, + get y() { + return y; + }, + //x: "yo", + //y: "boo", + dist: function () { + return Math.sqrt(x * x + y * y); // shouldn't be picking up "x" and "y" from the object lit + } + }; +} +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +function foo(test) { +} +var x; +var y; +foo(x); +foo(x + y); diff --git a/tests/baselines/reference/assignmentCompatBug5.errors.txt b/tests/baselines/reference/assignmentCompatBug5.errors.txt index a015cc3bbcf..fd13a07a948 100644 --- a/tests/baselines/reference/assignmentCompatBug5.errors.txt +++ b/tests/baselines/reference/assignmentCompatBug5.errors.txt @@ -3,7 +3,10 @@ tests/cases/compiler/assignmentCompatBug5.ts(2,6): error TS2345: Argument of typ tests/cases/compiler/assignmentCompatBug5.ts(5,6): error TS2345: Argument of type 'string[]' is not assignable to parameter of type 'number[]'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatBug5.ts(8,6): error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. + Types of parameters 's' and 'n' are incompatible. + Type 'string' is not assignable to type 'number'. tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. + Type 'void' is not assignable to type 'number'. ==== tests/cases/compiler/assignmentCompatBug5.ts (4 errors) ==== @@ -23,8 +26,11 @@ tests/cases/compiler/assignmentCompatBug5.ts(9,6): error TS2345: Argument of typ foo3((s:string) => { }); ~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(s: string) => void' is not assignable to parameter of type '(n: number) => number'. +!!! error TS2345: Types of parameters 's' and 'n' are incompatible. +!!! error TS2345: Type 'string' is not assignable to type 'number'. foo3((n) => { return; }); ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(n: number) => void' is not assignable to parameter of type '(n: number) => number'. +!!! error TS2345: Type 'void' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt index f972c9a925e..65c1d307793 100644 --- a/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt +++ b/tests/baselines/reference/assignmentCompatInterfaceWithStringIndexSignature.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts(15,5): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'. + Index signature is missing in type 'Foo'. ==== tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts (1 errors) ==== @@ -19,4 +20,5 @@ tests/cases/compiler/assignmentCompatInterfaceWithStringIndexSignature.ts(15,5): Biz(new Foo()); ~~~~~~~~~ !!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'IHandlerMap'. +!!! error TS2345: Index signature is missing in type 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers3.types b/tests/baselines/reference/assignmentCompatWithObjectMembers3.types index ff7ef23307d..85a7e59ffbc 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers3.types +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers3.types @@ -51,13 +51,13 @@ var b: { foo: string; baz?: string } var a2: S2 = { foo: '' }; >a2 : S2 >S2 : S2 ->{ foo: '' } : { foo: string; bar?: string; } +>{ foo: '' } : { foo: string; } >foo : string var b2: T2 = { foo: '' }; >b2 : T2 >T2 : T2 ->{ foo: '' } : { foo: string; baz?: string; } +>{ foo: '' } : { foo: string; } >foo : string s = t; diff --git a/tests/baselines/reference/assignmentCompatability1.types b/tests/baselines/reference/assignmentCompatability1.types index 8bb4301b201..9949fc14bf5 100644 --- a/tests/baselines/reference/assignmentCompatability1.types +++ b/tests/baselines/reference/assignmentCompatability1.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentCompatability2.types b/tests/baselines/reference/assignmentCompatability2.types index 69a20b34dd7..16da45c7e35 100644 --- a/tests/baselines/reference/assignmentCompatability2.types +++ b/tests/baselines/reference/assignmentCompatability2.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentCompatability3.types b/tests/baselines/reference/assignmentCompatability3.types index 4b598fba84c..61279b9c7fa 100644 --- a/tests/baselines/reference/assignmentCompatability3.types +++ b/tests/baselines/reference/assignmentCompatability3.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentCompatability4.types b/tests/baselines/reference/assignmentCompatability4.types index 3d8e776ff72..f7e5801e9b3 100644 --- a/tests/baselines/reference/assignmentCompatability4.types +++ b/tests/baselines/reference/assignmentCompatability4.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentCompatability5.types b/tests/baselines/reference/assignmentCompatability5.types index 970c913955d..80eda3e510b 100644 --- a/tests/baselines/reference/assignmentCompatability5.types +++ b/tests/baselines/reference/assignmentCompatability5.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentCompatability6.types b/tests/baselines/reference/assignmentCompatability6.types index cf131600c41..5e9ae8c6a2f 100644 --- a/tests/baselines/reference/assignmentCompatability6.types +++ b/tests/baselines/reference/assignmentCompatability6.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; @@ -29,7 +29,7 @@ module __test2__ { >T : T >obj3 : interfaceWithOptional >interfaceWithOptional : interfaceWithOptional ->{ } : { one?: number; } +>{ } : {} export var __val__obj3 = obj3; >__val__obj3 : interfaceWithOptional diff --git a/tests/baselines/reference/assignmentCompatability7.types b/tests/baselines/reference/assignmentCompatability7.types index 5bb46428314..b7b2ab70566 100644 --- a/tests/baselines/reference/assignmentCompatability7.types +++ b/tests/baselines/reference/assignmentCompatability7.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; @@ -32,7 +32,7 @@ module __test2__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentCompatability8.types b/tests/baselines/reference/assignmentCompatability8.types index 21fa300a37d..1c009eea482 100644 --- a/tests/baselines/reference/assignmentCompatability8.types +++ b/tests/baselines/reference/assignmentCompatability8.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentCompatability9.types b/tests/baselines/reference/assignmentCompatability9.types index cc8df0387e7..a8235220bec 100644 --- a/tests/baselines/reference/assignmentCompatability9.types +++ b/tests/baselines/reference/assignmentCompatability9.types @@ -12,7 +12,7 @@ module __test1__ { >U : U >obj4 : interfaceWithPublicAndOptional >interfaceWithPublicAndOptional : interfaceWithPublicAndOptional ->{ one: 1 } : { one: number; two?: string; } +>{ one: 1 } : { one: number; } >one : number export var __val__obj4 = obj4; diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js new file mode 100644 index 00000000000..e6975e70146 --- /dev/null +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -0,0 +1,164 @@ +//// [assignmentLHSIsValue.ts] +// expected error for all the LHS of assignments +var value; + +// this +class C { + constructor() { this = value; } + foo() { this = value; } + static sfoo() { this = value; } +} + +function foo() { this = value; } + +this = value; + +// identifiers: module, class, enum, function +module M { export var a; } +M = value; + +C = value; + +enum E { } +E = value; + +foo = value; + +// literals +null = value; +true = value; +false = value; +0 = value; +'' = value; +/d+/ = value; + +// object literals +{ a: 0} = value; + +// array literals +['', ''] = value; + +// super +class Derived extends C { + constructor() { super(); super = value; } + + foo() { super = value } + + static sfoo() { super = value; } +} + +// function expression +function bar() { } = value; +() => { } = value; + +// function calls +foo() = value; + +// parentheses, the containted expression is value +(this) = value; +(M) = value; +(C) = value; +(E) = value; +(foo) = value; +(null) = value; +(true) = value; +(0) = value; +('') = value; +(/d+/) = value; +({}) = value; +([]) = value; +(function baz() { }) = value; +(foo()) = value; + +//// [assignmentLHSIsValue.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +// expected error for all the LHS of assignments +var value; +// this +var C = (function () { + function C() { + this = value; + } + C.prototype.foo = function () { + this = value; + }; + C.sfoo = function () { + this = value; + }; + return C; +})(); +function foo() { + this = value; +} +this = value; +// identifiers: module, class, enum, function +var M; +(function (M) { + M.a; +})(M || (M = {})); +M = value; +C = value; +var E; +(function (E) { +})(E || (E = {})); +E = value; +foo = value; +// literals +null = value; +true = value; +false = value; +0 = value; +'' = value; +/d+/ = value; +// object literals +{ + a: 0; +} +value; +// array literals +'' = value[0], '' = value[1]; +// super +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.call(this); + _super.prototype. = value; + } + Derived.prototype.foo = function () { + _super.prototype. = value; + }; + Derived.sfoo = function () { + _super. = value; + }; + return Derived; +})(C); +// function expression +function bar() { +} +value; +(function () { +}); +value; +// function calls +foo() = value; +// parentheses, the containted expression is value +(this) = value; +(M) = value; +(C) = value; +(E) = value; +(foo) = value; +(null) = value; +(true) = value; +(0) = value; +('') = value; +(/d+/) = value; +({}) = value; +([]) = value; +(function baz() { +}) = value; +(foo()) = value; diff --git a/tests/baselines/reference/augmentedTypesEnum2.js b/tests/baselines/reference/augmentedTypesEnum2.js index 434e508f14c..f0c86e5640b 100644 --- a/tests/baselines/reference/augmentedTypesEnum2.js +++ b/tests/baselines/reference/augmentedTypesEnum2.js @@ -31,7 +31,7 @@ var e2; (function (e2) { e2[e2["One"] = 0] = "One"; })(e2 || (e2 = {})); -; +; // error var e2 = (function () { function e2() { } diff --git a/tests/baselines/reference/augmentedTypesInterface.js b/tests/baselines/reference/augmentedTypesInterface.js index a5039f8b1d0..e28864fd547 100644 --- a/tests/baselines/reference/augmentedTypesInterface.js +++ b/tests/baselines/reference/augmentedTypesInterface.js @@ -47,5 +47,5 @@ var i3; (function (i3) { i3[i3["One"] = 0] = "One"; })(i3 || (i3 = {})); -; +; // error //import i4 = require(''); // error diff --git a/tests/baselines/reference/augmentedTypesModules.js b/tests/baselines/reference/augmentedTypesModules.js index a9bff3fa74b..3b7544996a1 100644 --- a/tests/baselines/reference/augmentedTypesModules.js +++ b/tests/baselines/reference/augmentedTypesModules.js @@ -124,21 +124,21 @@ var m1d; var m1d = 1; // error function m2() { } -; +; // ok since the module is not instantiated var m2a; (function (m2a) { var y = 2; })(m2a || (m2a = {})); function m2a() { } -; +; // error since the module is instantiated var m2b; (function (m2b) { m2b.y = 2; })(m2b || (m2b = {})); function m2b() { } -; +; // error since the module is instantiated // should be errors to have function first function m2c() { } diff --git a/tests/baselines/reference/augmentedTypesModules2.js b/tests/baselines/reference/augmentedTypesModules2.js index d1551b6244e..70fd31f03e0 100644 --- a/tests/baselines/reference/augmentedTypesModules2.js +++ b/tests/baselines/reference/augmentedTypesModules2.js @@ -31,21 +31,21 @@ module m2g { export class C { foo() { } } } //// [augmentedTypesModules2.js] function m2() { } -; +; // ok since the module is not instantiated var m2a; (function (m2a) { var y = 2; })(m2a || (m2a = {})); function m2a() { } -; +; // error since the module is instantiated var m2b; (function (m2b) { m2b.y = 2; })(m2b || (m2b = {})); function m2b() { } -; +; // error since the module is instantiated function m2c() { } ; @@ -59,7 +59,7 @@ var m2cc; })(m2cc || (m2cc = {})); function m2cc() { } -; +; // error to have module first function m2f() { } ; diff --git a/tests/baselines/reference/autoLift2.js b/tests/baselines/reference/autoLift2.js new file mode 100644 index 00000000000..cf840277d70 --- /dev/null +++ b/tests/baselines/reference/autoLift2.js @@ -0,0 +1,52 @@ +//// [autoLift2.ts] +class A + +{ + constructor() { + this.foo: any; + this.bar: any; + } + + + baz() { + + this.foo = "foo"; + + this.bar = "bar"; + + [1, 2].forEach((p) => this.foo); + + [1, 2].forEach((p) => this.bar); + + } + +} + + + +var a = new A(); + +a.baz(); + + + + +//// [autoLift2.js] +var A = (function () { + function A() { + this.foo; + any; + this.bar; + any; + } + A.prototype.baz = function () { + var _this = this; + this.foo = "foo"; + this.bar = "bar"; + [1, 2].forEach(function (p) { return _this.foo; }); + [1, 2].forEach(function (p) { return _this.bar; }); + }; + return A; +})(); +var a = new A(); +a.baz(); diff --git a/tests/baselines/reference/badArrayIndex.js b/tests/baselines/reference/badArrayIndex.js new file mode 100644 index 00000000000..210dd6add8e --- /dev/null +++ b/tests/baselines/reference/badArrayIndex.js @@ -0,0 +1,5 @@ +//// [badArrayIndex.ts] +var results = number[]; + +//// [badArrayIndex.js] +var results = number[]; diff --git a/tests/baselines/reference/badArraySyntax.js b/tests/baselines/reference/badArraySyntax.js new file mode 100644 index 00000000000..f5ca1e0c0ba --- /dev/null +++ b/tests/baselines/reference/badArraySyntax.js @@ -0,0 +1,26 @@ +//// [badArraySyntax.ts] +class Z { + public x = ""; +} + +var a1: Z[] = []; +var a2 = new Z[]; +var a3 = new Z[](); +var a4: Z[] = new Z[]; +var a5: Z[] = new Z[](); +var a6: Z[][] = new Z [ ] [ ]; + + +//// [badArraySyntax.js] +var Z = (function () { + function Z() { + this.x = ""; + } + return Z; +})(); +var a1 = []; +var a2 = new Z[]; +var a3 = new Z[](); +var a4 = new Z[]; +var a5 = new Z[](); +var a6 = new Z[][]; diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js new file mode 100644 index 00000000000..32d65d1a248 --- /dev/null +++ b/tests/baselines/reference/bases.js @@ -0,0 +1,46 @@ +//// [bases.ts] +interface I { + x; +} + +class B { + constructor() { + this.y: any; + } +} + +class C extends B implements I { + constructor() { + this.x: any; + } +} + +new C().x; +new C().y; + + + +//// [bases.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var B = (function () { + function B() { + this.y; + any; + } + return B; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + this.x; + any; + } + return C; +})(B); +new C().x; +new C().y; diff --git a/tests/baselines/reference/binaryIntegerLiteralError.js b/tests/baselines/reference/binaryIntegerLiteralError.js new file mode 100644 index 00000000000..215514982c0 --- /dev/null +++ b/tests/baselines/reference/binaryIntegerLiteralError.js @@ -0,0 +1,23 @@ +//// [binaryIntegerLiteralError.ts] +// error +var bin1 = 0B1102110; +var bin1 = 0b11023410; + +var obj1 = { + 0b11010: "hi", + 26: "Hello", + "26": "world", +}; + + +//// [binaryIntegerLiteralError.js] +// error +var bin1 = 6; +2110; +var bin1 = 6; +23410; +var obj1 = { + 26: "hi", + 26: "Hello", + "26": "world" +}; diff --git a/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js new file mode 100644 index 00000000000..1b64091c048 --- /dev/null +++ b/tests/baselines/reference/bitwiseNotOperatorInvalidOperations.js @@ -0,0 +1,24 @@ +//// [bitwiseNotOperatorInvalidOperations.ts] +// Unary operator ~ +var q; + +// operand before ~ +var a = q~; //expect error + +// multiple operands after ~ +var mul = ~[1, 2, "abc"], ""; //expect error + +// miss an operand +var b =~; + +//// [bitwiseNotOperatorInvalidOperations.js] +// Unary operator ~ +var q; +// operand before ~ +var a = q; +~; //expect error +// multiple operands after ~ +var mul = ~[1, 2, "abc"]; +""; //expect error +// miss an operand +var b = ~; diff --git a/tests/baselines/reference/breakNotInIterationOrSwitchStatement1.js b/tests/baselines/reference/breakNotInIterationOrSwitchStatement1.js new file mode 100644 index 00000000000..21ca5d4cce4 --- /dev/null +++ b/tests/baselines/reference/breakNotInIterationOrSwitchStatement1.js @@ -0,0 +1,5 @@ +//// [breakNotInIterationOrSwitchStatement1.ts] +break; + +//// [breakNotInIterationOrSwitchStatement1.js] +break; diff --git a/tests/baselines/reference/breakNotInIterationOrSwitchStatement2.js b/tests/baselines/reference/breakNotInIterationOrSwitchStatement2.js new file mode 100644 index 00000000000..531e5b5e5b6 --- /dev/null +++ b/tests/baselines/reference/breakNotInIterationOrSwitchStatement2.js @@ -0,0 +1,13 @@ +//// [breakNotInIterationOrSwitchStatement2.ts] +while (true) { + function f() { + break; + } +} + +//// [breakNotInIterationOrSwitchStatement2.js] +while (true) { + function f() { + break; + } +} diff --git a/tests/baselines/reference/breakTarget5.js b/tests/baselines/reference/breakTarget5.js new file mode 100644 index 00000000000..197e4e147bd --- /dev/null +++ b/tests/baselines/reference/breakTarget5.js @@ -0,0 +1,18 @@ +//// [breakTarget5.ts] +target: +while (true) { + function f() { + while (true) { + break target; + } + } +} + +//// [breakTarget5.js] +target: while (true) { + function f() { + while (true) { + break target; + } + } +} diff --git a/tests/baselines/reference/breakTarget6.js b/tests/baselines/reference/breakTarget6.js new file mode 100644 index 00000000000..9c5bcc3ded1 --- /dev/null +++ b/tests/baselines/reference/breakTarget6.js @@ -0,0 +1,9 @@ +//// [breakTarget6.ts] +while (true) { + break target; +} + +//// [breakTarget6.js] +while (true) { + break target; +} diff --git a/tests/baselines/reference/callExpressionWithMissingTypeArgument1.js b/tests/baselines/reference/callExpressionWithMissingTypeArgument1.js new file mode 100644 index 00000000000..e073758e428 --- /dev/null +++ b/tests/baselines/reference/callExpressionWithMissingTypeArgument1.js @@ -0,0 +1,5 @@ +//// [callExpressionWithMissingTypeArgument1.ts] +Foo(); + +//// [callExpressionWithMissingTypeArgument1.js] +Foo(); diff --git a/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js new file mode 100644 index 00000000000..0f8a033067d --- /dev/null +++ b/tests/baselines/reference/callSignatureWithOptionalParameterAndInitializer.js @@ -0,0 +1,112 @@ +//// [callSignatureWithOptionalParameterAndInitializer.ts] +// Optional parameters cannot also have initializer expressions, these are all errors + +function foo(x?: number = 1) { } +var f = function foo(x?: number = 1) { } +var f2 = (x: number, y? = 1) => { } + +foo(1); +foo(); +f(1); +f(); +f2(1); +f2(1, 2); + +class C { + foo(x?: number = 1) { } +} + +var c: C; +c.foo(); +c.foo(1); + +interface I { + (x? = 1); + foo(x: number, y?: number = 1); +} + +var i: I; +i(); +i(1); +i.foo(1); +i.foo(1, 2); + +var a: { + (x?: number = 1); + foo(x? = 1); +} + +a(); +a(1); +a.foo(); +a.foo(1); + +var b = { + foo(x?: number = 1) { }, + a: function foo(x: number, y?: number = '') { }, + b: (x?: any = '') => { } +} + +b.foo(); +b.foo(1); +b.a(1); +b.a(1, 2); +b.b(); +b.b(1); + + +//// [callSignatureWithOptionalParameterAndInitializer.js] +// Optional parameters cannot also have initializer expressions, these are all errors +function foo(x) { + if (x === void 0) { x = 1; } +} +var f = function foo(x) { + if (x === void 0) { x = 1; } +}; +var f2 = function (x, y) { + if (y === void 0) { y = 1; } +}; +foo(1); +foo(); +f(1); +f(); +f2(1); +f2(1, 2); +var C = (function () { + function C() { + } + C.prototype.foo = function (x) { + if (x === void 0) { x = 1; } + }; + return C; +})(); +var c; +c.foo(); +c.foo(1); +var i; +i(); +i(1); +i.foo(1); +i.foo(1, 2); +var a; +a(); +a(1); +a.foo(); +a.foo(1); +var b = { + foo: function (x) { + if (x === void 0) { x = 1; } + }, + a: function foo(x, y) { + if (y === void 0) { y = ''; } + }, + b: function (x) { + if (x === void 0) { x = ''; } + } +}; +b.foo(); +b.foo(1); +b.a(1); +b.a(1, 2); +b.b(); +b.b(1); diff --git a/tests/baselines/reference/callSignaturesWithParameterInitializers2.js b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js new file mode 100644 index 00000000000..0524db42f65 --- /dev/null +++ b/tests/baselines/reference/callSignaturesWithParameterInitializers2.js @@ -0,0 +1,56 @@ +//// [callSignaturesWithParameterInitializers2.ts] +// Optional parameters allow initializers only in implementation signatures +// All the below declarations are errors + +function foo(x = 2); +function foo(x = 1) { } + +foo(1); +foo(); + +class C { + foo(x = 2); + foo(x = 1) { } +} + +var c: C; +c.foo(); +c.foo(1); + +var b = { + foo(x = 1), // error + foo(x = 1) { }, // error +} + +b.foo(); +b.foo(1); + +//// [callSignaturesWithParameterInitializers2.js] +// Optional parameters allow initializers only in implementation signatures +// All the below declarations are errors +function foo(x) { + if (x === void 0) { x = 1; } +} +foo(1); +foo(); +var C = (function () { + function C() { + } + C.prototype.foo = function (x) { + if (x === void 0) { x = 1; } + }; + return C; +})(); +var c; +c.foo(); +c.foo(1); +var b = { + foo: function (x) { + if (x === void 0) { x = 1; } + }, + foo: function (x) { + if (x === void 0) { x = 1; } + } +}; +b.foo(); +b.foo(1); diff --git a/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js new file mode 100644 index 00000000000..2b05f8d3389 --- /dev/null +++ b/tests/baselines/reference/cannotInvokeNewOnErrorExpression.js @@ -0,0 +1,17 @@ +//// [cannotInvokeNewOnErrorExpression.ts] +module M +{ + class ClassA {} +} +var t = new M.ClassA[]; + +//// [cannotInvokeNewOnErrorExpression.js] +var M; +(function (M) { + var ClassA = (function () { + function ClassA() { + } + return ClassA; + })(); +})(M || (M = {})); +var t = new M.ClassA[]; diff --git a/tests/baselines/reference/catchClauseWithTypeAnnotation.js b/tests/baselines/reference/catchClauseWithTypeAnnotation.js new file mode 100644 index 00000000000..097abe0a9ca --- /dev/null +++ b/tests/baselines/reference/catchClauseWithTypeAnnotation.js @@ -0,0 +1,10 @@ +//// [catchClauseWithTypeAnnotation.ts] +try { +} catch (e: any) { +} + +//// [catchClauseWithTypeAnnotation.js] +try { +} +catch (e) { +} diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt index be465275de5..f9edcf4eef6 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.errors.txt @@ -1,4 +1,5 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,59): error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'. + Type 'B' is not assignable to type 'C'. ==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ==== @@ -22,4 +23,5 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete // Ok to go down the chain, but error to try to climb back up (new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); ~~~~~~~~~~ -!!! error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'. \ No newline at end of file +!!! error TS2345: Argument of type '(c: C) => B' is not assignable to parameter of type '(x: C) => C'. +!!! error TS2345: Type 'B' is not assignable to type 'C'. \ No newline at end of file diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt index e307cc9be89..8f5924586df 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(7,43): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. + Type 'T' is not assignable to type 'S'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(10,29): error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. + Type 'T' is not assignable to type 'S'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(32,9): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(36,9): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter2.ts(37,9): error TS2322: Type 'string' is not assignable to type 'number'. @@ -15,11 +17,13 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete (new Chain(t)).then(tt => s).then(ss => t); ~~~~~~~ !!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. +!!! error TS2345: Type 'T' is not assignable to type 'S'. // But error to try to climb up the chain (new Chain(s)).then(ss => t); ~~~~~~~ !!! error TS2345: Argument of type '(ss: S) => T' is not assignable to parameter of type '(x: S) => S'. +!!! error TS2345: Type 'T' is not assignable to type 'S'. // Staying at T or S should be fine (new Chain(t)).then(tt => t).then(tt => t).then(tt => t); diff --git a/tests/baselines/reference/circularReference.js b/tests/baselines/reference/circularReference.js new file mode 100644 index 00000000000..02eef63db06 --- /dev/null +++ b/tests/baselines/reference/circularReference.js @@ -0,0 +1,66 @@ +//// [tests/cases/conformance/externalModules/circularReference.ts] //// + +//// [foo1.ts] +import foo2 = require('./foo2'); +export module M1 { + export class C1 { + m1: foo2.M1.C1; + x: number; + constructor(){ + this.m1 = new foo2.M1.C1(); + this.m1.y = 10; // OK + this.m1.x = 20; // Error + } + } +} + +//// [foo2.ts] +import foo1 = require('./foo1'); +export module M1 { + export class C1 { + m1: foo1.M1.C1; + y: number + constructor(){ + this.m1 = new foo1.M1.C1(); + this.m1.y = 10; // Error + this.m1.x = 20; // OK + + var tmp = new M1.C1(); + tmp.y = 10; // OK + tmp.x = 20; // Error + } + } +} + + +//// [foo1.js] +var foo2 = require('./foo2'); +var M1; +(function (M1) { + var C1 = (function () { + function C1() { + this.m1 = new foo2.M1.C1(); + this.m1.y = 10; // OK + this.m1.x = 20; // Error + } + return C1; + })(); + M1.C1 = C1; +})(M1 = exports.M1 || (exports.M1 = {})); +//// [foo2.js] +var foo1 = require('./foo1'); +var M1; +(function (M1) { + var C1 = (function () { + function C1() { + this.m1 = new foo1.M1.C1(); + this.m1.y = 10; // Error + this.m1.x = 20; // OK + var tmp = new M1.C1(); + tmp.y = 10; // OK + tmp.x = 20; // Error + } + return C1; + })(); + M1.C1 = C1; +})(M1 = exports.M1 || (exports.M1 = {})); diff --git a/tests/baselines/reference/class2.js b/tests/baselines/reference/class2.js new file mode 100644 index 00000000000..03b60ac8dc5 --- /dev/null +++ b/tests/baselines/reference/class2.js @@ -0,0 +1,10 @@ +//// [class2.ts] +class foo { constructor() { static f = 3; } } + +//// [class2.js] +var foo = (function () { + function foo() { + } + foo.f = 3; + return foo; +})(); diff --git a/tests/baselines/reference/classBodyWithStatements.js b/tests/baselines/reference/classBodyWithStatements.js new file mode 100644 index 00000000000..bae4860f722 --- /dev/null +++ b/tests/baselines/reference/classBodyWithStatements.js @@ -0,0 +1,37 @@ +//// [classBodyWithStatements.ts] +class C { + var x = 1; +} + +class C2 { + function foo() {} +} + +var x = 1; +var y = 2; +class C3 { + x: number = y + 1; // ok, need a var in the statement production +} + +//// [classBodyWithStatements.js] +var C = (function () { + function C() { + } + return C; +})(); +var x = 1; +var C2 = (function () { + function C2() { + } + return C2; +})(); +function foo() { +} +var x = 1; +var y = 2; +var C3 = (function () { + function C3() { + this.x = y + 1; // ok, need a var in the statement production + } + return C3; +})(); diff --git a/tests/baselines/reference/classConstructorAccessibility.js b/tests/baselines/reference/classConstructorAccessibility.js new file mode 100644 index 00000000000..15b12190392 --- /dev/null +++ b/tests/baselines/reference/classConstructorAccessibility.js @@ -0,0 +1,82 @@ +//// [classConstructorAccessibility.ts] +class C { + public constructor(public x: number) { } +} + +class D { + private constructor(public x: number) { } // error +} + +class E { + protected constructor(public x: number) { } // error +} + +var c = new C(1); +var d = new D(1); +var e = new E(1); + +module Generic { + class C { + public constructor(public x: T) { } + } + + class D { + private constructor(public x: T) { } // error + } + + class E { + protected constructor(public x: T) { } // error + } + + var c = new C(1); + var d = new D(1); + var e = new E(1); +} + + +//// [classConstructorAccessibility.js] +var C = (function () { + function C(x) { + this.x = x; + } + return C; +})(); +var D = (function () { + function D(x) { + this.x = x; + } // error + return D; +})(); +var E = (function () { + function E(x) { + this.x = x; + } // error + return E; +})(); +var c = new C(1); +var d = new D(1); +var e = new E(1); +var Generic; +(function (Generic) { + var C = (function () { + function C(x) { + this.x = x; + } + return C; + })(); + var D = (function () { + function D(x) { + this.x = x; + } // error + return D; + })(); + var E = (function () { + function E(x) { + this.x = x; + } // error + return E; + })(); + var c = new C(1); + var d = new D(1); + var e = new E(1); +})(Generic || (Generic = {})); diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js new file mode 100644 index 00000000000..9d902abbf52 --- /dev/null +++ b/tests/baselines/reference/classExpression.js @@ -0,0 +1,34 @@ +//// [classExpression.ts] +var x = class C { +} + +var y = { + foo: class C2 { + } +} + +module M { + var z = class C4 { + } +} + +//// [classExpression.js] +var x = ; +var C = (function () { + function C() { + } + return C; +})(); +var y = { + foo: , + class: C2 +}, _a = void 0; +var M; +(function (M) { + var z = ; + var C4 = (function () { + function C4() { + } + return C4; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js new file mode 100644 index 00000000000..b69bc3403f4 --- /dev/null +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -0,0 +1,98 @@ +//// [classExtendingPrimitive.ts] +// classes cannot extend primitives + +class C extends number { } +class C2 extends string { } +class C3 extends boolean { } +class C4 extends Void { } +class C4a extends void {} +class C5 extends Null { } +class C5a extends null { } +class C6 extends undefined { } +class C7 extends Undefined { } + +enum E { A } +class C8 extends E { } + +//// [classExtendingPrimitive.js] +// classes cannot extend primitives +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(number); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(string); +var C3 = (function (_super) { + __extends(C3, _super); + function C3() { + _super.apply(this, arguments); + } + return C3; +})(boolean); +var C4 = (function (_super) { + __extends(C4, _super); + function C4() { + _super.apply(this, arguments); + } + return C4; +})(Void); +var C4a = (function () { + function C4a() { + } + return C4a; +})(); +void {}; +var C5 = (function (_super) { + __extends(C5, _super); + function C5() { + _super.apply(this, arguments); + } + return C5; +})(Null); +var C5a = (function () { + function C5a() { + } + return C5a; +})(); +null; +{ +} +var C6 = (function (_super) { + __extends(C6, _super); + function C6() { + _super.apply(this, arguments); + } + return C6; +})(undefined); +var C7 = (function (_super) { + __extends(C7, _super); + function C7() { + _super.apply(this, arguments); + } + return C7; +})(Undefined); +var E; +(function (E) { + E[E["A"] = 0] = "A"; +})(E || (E = {})); +var C8 = (function (_super) { + __extends(C8, _super); + function C8() { + _super.apply(this, arguments); + } + return C8; +})(E); diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js new file mode 100644 index 00000000000..9a507934455 --- /dev/null +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -0,0 +1,22 @@ +//// [classExtendingPrimitive2.ts] +// classes cannot extend primitives + +class C4a extends void {} +class C5a extends null { } + +//// [classExtendingPrimitive2.js] +// classes cannot extend primitives +var C4a = (function () { + function C4a() { + } + return C4a; +})(); +void {}; +var C5a = (function () { + function C5a() { + } + return C5a; +})(); +null; +{ +} diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js new file mode 100644 index 00000000000..2adb974bb28 --- /dev/null +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -0,0 +1,75 @@ +//// [classExtendsEveryObjectType.ts] +interface I { + foo: string; +} +class C extends I { } // error + +class C2 extends { foo: string; } { } // error +var x: { foo: string; } +class C3 extends x { } // error + +module M { export var x = 1; } +class C4 extends M { } // error + +function foo() { } +class C5 extends foo { } // error + +class C6 extends []{ } // error + +//// [classExtendsEveryObjectType.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(I); // error +var C2 = (function () { + function C2() { + } + return C2; +})(); +{ +} // error +var x; +var C3 = (function (_super) { + __extends(C3, _super); + function C3() { + _super.apply(this, arguments); + } + return C3; +})(x); // error +var M; +(function (M) { + M.x = 1; +})(M || (M = {})); +var C4 = (function (_super) { + __extends(C4, _super); + function C4() { + _super.apply(this, arguments); + } + return C4; +})(M); // error +function foo() { +} +var C5 = (function (_super) { + __extends(C5, _super); + function C5() { + _super.apply(this, arguments); + } + return C5; +})(foo); // error +var C6 = (function () { + function C6() { + } + return C6; +})(); +[]; +{ +} // error diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js new file mode 100644 index 00000000000..f2bcb02fee4 --- /dev/null +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -0,0 +1,21 @@ +//// [classExtendsEveryObjectType2.ts] +class C2 extends { foo: string; } { } // error + +class C6 extends []{ } // error + +//// [classExtendsEveryObjectType2.js] +var C2 = (function () { + function C2() { + } + return C2; +})(); +{ +} // error +var C6 = (function () { + function C6() { + } + return C6; +})(); +[]; +{ +} // error diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js new file mode 100644 index 00000000000..07d6450f405 --- /dev/null +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -0,0 +1,29 @@ +//// [classExtendsMultipleBaseClasses.ts] +class A { } +class B { } +class C extends A,B { } + +//// [classExtendsMultipleBaseClasses.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var A = (function () { + function A() { + } + return A; +})(); +var B = (function () { + function B() { + } + return B; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js new file mode 100644 index 00000000000..5c6470ffdfd --- /dev/null +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -0,0 +1,24 @@ +//// [classHeritageWithTrailingSeparator.ts] +class C { foo: number } +class D extends C, { +} + +//// [classHeritageWithTrailingSeparator.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +})(C); diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.js b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.js new file mode 100644 index 00000000000..bcf4cd60d7d --- /dev/null +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping3.js @@ -0,0 +1,34 @@ +//// [tests/cases/compiler/classMemberInitializerWithLamdaScoping3.ts] //// + +//// [classMemberInitializerWithLamdaScoping3_0.ts] +var field1: string; + +//// [classMemberInitializerWithLamdaScoping3_1.ts] +declare var console: { + log(msg?: any): void; +}; +export class Test1 { + constructor(private field1: string) { + } + messageHandler = () => { + console.log(field1); // But this should be error as the field1 will resolve to var field1 + // but since this code would be generated inside constructor, in generated js + // it would resolve to private field1 and thats not what user intended here. + }; +} + +//// [classMemberInitializerWithLamdaScoping3_0.js] +var field1; +//// [classMemberInitializerWithLamdaScoping3_1.js] +var Test1 = (function () { + function Test1(field1) { + this.field1 = field1; + this.messageHandler = function () { + console.log(field1); // But this should be error as the field1 will resolve to var field1 + // but since this code would be generated inside constructor, in generated js + // it would resolve to private field1 and thats not what user intended here. + }; + } + return Test1; +})(); +exports.Test1 = Test1; diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js new file mode 100644 index 00000000000..a8e0718f277 --- /dev/null +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/classMemberInitializerWithLamdaScoping4.ts] //// + +//// [classMemberInitializerWithLamdaScoping3_0.ts] +export var field1: string; + +//// [classMemberInitializerWithLamdaScoping3_1.ts] +declare var console: { + log(msg?: any): void; +}; +export class Test1 { + constructor(private field1: string) { + } + messageHandler = () => { + console.log(field1); // Should be error that couldnt find symbol field1 + }; +} + +//// [classMemberInitializerWithLamdaScoping3_0.js] +exports.field1; +//// [classMemberInitializerWithLamdaScoping3_1.js] +var Test1 = (function () { + function Test1(field1) { + this.field1 = field1; + this.messageHandler = function () { + console.log(field1); // Should be error that couldnt find symbol field1 + }; + } + return Test1; +})(); +exports.Test1 = Test1; diff --git a/tests/baselines/reference/classPropertyAsPrivate.js b/tests/baselines/reference/classPropertyAsPrivate.js new file mode 100644 index 00000000000..8b59dcde771 --- /dev/null +++ b/tests/baselines/reference/classPropertyAsPrivate.js @@ -0,0 +1,63 @@ +//// [classPropertyAsPrivate.ts] +class C { + private x: string; + private get y() { return null; } + private set y(x) { } + private foo() { } + + private static a: string; + private static get b() { return null; } + private static set b(x) { } + private static foo() { } +} + +var c: C; +// all errors +c.x; +c.y; +c.y = 1; +c.foo(); + +C.a; +C.b(); +C.b = 1; +C.foo(); + +//// [classPropertyAsPrivate.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return null; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + }; + Object.defineProperty(C, "b", { + get: function () { + return null; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + C.foo = function () { + }; + return C; +})(); +var c; +// all errors +c.x; +c.y; +c.y = 1; +c.foo(); +C.a; +C.b(); +C.b = 1; +C.foo(); diff --git a/tests/baselines/reference/classPropertyAsProtected.js b/tests/baselines/reference/classPropertyAsProtected.js new file mode 100644 index 00000000000..ddb193f072a --- /dev/null +++ b/tests/baselines/reference/classPropertyAsProtected.js @@ -0,0 +1,63 @@ +//// [classPropertyAsProtected.ts] +class C { + protected x: string; + protected get y() { return null; } + protected set y(x) { } + protected foo() { } + + protected static a: string; + protected static get b() { return null; } + protected static set b(x) { } + protected static foo() { } +} + +var c: C; +// all errors +c.x; +c.y; +c.y = 1; +c.foo(); + +C.a; +C.b(); +C.b = 1; +C.foo(); + +//// [classPropertyAsProtected.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return null; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + }; + Object.defineProperty(C, "b", { + get: function () { + return null; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + C.foo = function () { + }; + return C; +})(); +var c; +// all errors +c.x; +c.y; +c.y = 1; +c.foo(); +C.a; +C.b(); +C.b = 1; +C.foo(); diff --git a/tests/baselines/reference/classPropertyIsPublicByDefault.js b/tests/baselines/reference/classPropertyIsPublicByDefault.js new file mode 100644 index 00000000000..db1eca56c11 --- /dev/null +++ b/tests/baselines/reference/classPropertyIsPublicByDefault.js @@ -0,0 +1,61 @@ +//// [classPropertyIsPublicByDefault.ts] +class C { + x: string; + get y() { return null; } + set y(x) { } + foo() { } + + static a: string; + static get b() { return null; } + static set b(x) { } + static foo() { } +} + +var c: C; +c.x; +c.y; +c.y = 1; +c.foo(); + +C.a; +C.b(); +C.b = 1; +C.foo(); + +//// [classPropertyIsPublicByDefault.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return null; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + }; + Object.defineProperty(C, "b", { + get: function () { + return null; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + C.foo = function () { + }; + return C; +})(); +var c; +c.x; +c.y; +c.y = 1; +c.foo(); +C.a; +C.b(); +C.b = 1; +C.foo(); diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js new file mode 100644 index 00000000000..351ddac52e8 --- /dev/null +++ b/tests/baselines/reference/classUpdateTests.js @@ -0,0 +1,264 @@ +//// [classUpdateTests.ts] +// +// test codegen for instance properties +// +class A { + public p1 = 0; + private p2 = 0; + p3; +} + +class B { + public p1 = 0; + private p2 = 0; + p3; + + constructor() {} +} + +class C { + constructor(public p1=0, private p2=0, p3=0) {} +} + +// +// test requirements for super calls +// +class D { // NO ERROR + +} + +class E extends D { // NO ERROR + public p1 = 0; +} + +class F extends E { + constructor() {} // ERROR - super call required +} + +class G extends D { + public p1 = 0; + constructor() { super(); } // NO ERROR +} + +class H { + constructor() { super(); } // ERROR - no super call allowed +} + +class I extends Object { + constructor() { super(); } // ERROR - no super call allowed +} + +class J extends G { + constructor(public p1:number) { + super(); // NO ERROR + } +} + +class K extends G { + constructor(public p1:number) { // ERROR + var i = 0; + super(); + } +} + +class L extends G { + constructor(private p1:number) { + super(); // NO ERROR + } +} + +class M extends G { + constructor(private p1:number) { // ERROR + var i = 0; + super(); + } +} + +// +// test this reference in field initializers +// +class N { + public p1 = 0; + public p2 = this.p1; + + constructor() { + this.p2 = 0; + } +} + +// +// test error on property declarations within class constructors +// +class O { + constructor() { + public p1 = 0; // ERROR + } +} + +class P { + constructor() { + private p1 = 0; // ERROR + } +} + +class Q { + constructor() { + public this.p1 = 0; // ERROR + } +} + +class R { + constructor() { + private this.p1 = 0; // ERROR + } +} + +//// [classUpdateTests.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +// +// test codegen for instance properties +// +var A = (function () { + function A() { + this.p1 = 0; + this.p2 = 0; + } + return A; +})(); +var B = (function () { + function B() { + this.p1 = 0; + this.p2 = 0; + } + return B; +})(); +var C = (function () { + function C(p1, p2, p3) { + if (p1 === void 0) { p1 = 0; } + if (p2 === void 0) { p2 = 0; } + if (p3 === void 0) { p3 = 0; } + this.p1 = p1; + this.p2 = p2; + } + return C; +})(); +// +// test requirements for super calls +// +var D = (function () { + function D() { + } + return D; +})(); +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + this.p1 = 0; + } + return E; +})(D); +var F = (function (_super) { + __extends(F, _super); + function F() { + } // ERROR - super call required + return F; +})(E); +var G = (function (_super) { + __extends(G, _super); + function G() { + _super.call(this); + this.p1 = 0; + } // NO ERROR + return G; +})(D); +var H = (function () { + function H() { + _super.call(this); + } // ERROR - no super call allowed + return H; +})(); +var I = (function (_super) { + __extends(I, _super); + function I() { + _super.call(this); + } // ERROR - no super call allowed + return I; +})(Object); +var J = (function (_super) { + __extends(J, _super); + function J(p1) { + _super.call(this); // NO ERROR + this.p1 = p1; + } + return J; +})(G); +var K = (function (_super) { + __extends(K, _super); + function K(p1) { + this.p1 = p1; + var i = 0; + _super.call(this); + } + return K; +})(G); +var L = (function (_super) { + __extends(L, _super); + function L(p1) { + _super.call(this); // NO ERROR + this.p1 = p1; + } + return L; +})(G); +var M = (function (_super) { + __extends(M, _super); + function M(p1) { + this.p1 = p1; + var i = 0; + _super.call(this); + } + return M; +})(G); +// +// test this reference in field initializers +// +var N = (function () { + function N() { + this.p1 = 0; + this.p2 = this.p1; + this.p2 = 0; + } + return N; +})(); +// +// test error on property declarations within class constructors +// +var O = (function () { + function O() { + this.p1 = 0; // ERROR + } + return O; +})(); +var P = (function () { + function P() { + this.p1 = 0; // ERROR + } + return P; +})(); +var Q = (function () { + function Q() { + this.p1 = 0; // ERROR + } + return Q; +})(); +var R = (function () { + function R() { + this.p1 = 0; // ERROR + } + return R; +})(); diff --git a/tests/baselines/reference/classWithOptionalParameter.js b/tests/baselines/reference/classWithOptionalParameter.js new file mode 100644 index 00000000000..082e624916a --- /dev/null +++ b/tests/baselines/reference/classWithOptionalParameter.js @@ -0,0 +1,29 @@ +//// [classWithOptionalParameter.ts] +// classes do not permit optional parameters, these are errors + +class C { + x?: string; + f?() {} +} + +class C2 { + x?: T; + f?(x: T) {} +} + +//// [classWithOptionalParameter.js] +// classes do not permit optional parameters, these are errors +var C = (function () { + function C() { + } + C.prototype.f = function () { + }; + return C; +})(); +var C2 = (function () { + function C2() { + } + C2.prototype.f = function (x) { + }; + return C2; +})(); diff --git a/tests/baselines/reference/classWithPredefinedTypesAsNames2.js b/tests/baselines/reference/classWithPredefinedTypesAsNames2.js new file mode 100644 index 00000000000..a47adcbe32f --- /dev/null +++ b/tests/baselines/reference/classWithPredefinedTypesAsNames2.js @@ -0,0 +1,13 @@ +//// [classWithPredefinedTypesAsNames2.ts] +// classes cannot use predefined types as names + +class void {} + +//// [classWithPredefinedTypesAsNames2.js] +// classes cannot use predefined types as names +var = (function () { + function () { + } + return ; +})(); +void {}; diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js new file mode 100644 index 00000000000..2cded4b1f2e --- /dev/null +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -0,0 +1,60 @@ +//// [classWithStaticMembers.ts] +class C { + static fn() { return this; } + static get x() { return 1; } + static set x(v) { } + constructor(public a: number, private b: number) { } + static foo: string; +} + +var r = C.fn(); +var r2 = r.x; +var r3 = r.foo; + +class D extends C { + bar: string; +} + +var r = D.fn(); +var r2 = r.x; +var r3 = r.foo; + +//// [classWithStaticMembers.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C(a, b) { + this.a = a; + this.b = b; + } + C.fn = function () { + return this; + }; + Object.defineProperty(C, "x", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var r = C.fn(); +var r2 = r.x; +var r3 = r.foo; +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +})(C); +var r = D.fn(); +var r2 = r.x; +var r3 = r.foo; diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js new file mode 100644 index 00000000000..859476c0dad --- /dev/null +++ b/tests/baselines/reference/classdecl.js @@ -0,0 +1,268 @@ +//// [classdecl.ts] +class a { + //constructor (); + constructor (n: number); + constructor (s: string); + constructor (ns: any) { + + } + + public pgF() { } + + public pv; + public get d() { + return 30; + } + public set d() { + } + + public static get p2() { + return { x: 30, y: 40 }; + } + + private static d2() { + } + private static get p3() { + return "string"; + } + private pv3; + + private foo(n: number): string; + private foo(s: string): string; + private foo(ns: any) { + return ns.toString(); + } +} + +class b extends a { +} + +module m1 { + export class b { + } + class d { + } + + + export interface ib { + } +} + +module m2 { + + export module m3 { + export class c extends b { + } + export class ib2 implements m1.ib { + } + } +} + +class c extends m1.b { +} + +class ib2 implements m1.ib { +} + +declare class aAmbient { + constructor (n: number); + constructor (s: string); + public pgF(): void; + public pv; + public d : number; + static p2 : { x: number; y: number; }; + static d2(); + static p3; + private pv3; + private foo(s); +} + +class d { + private foo(n: number): string; + private foo(s: string): string; + private foo(ns: any) { + return ns.toString(); + } +} + +class e { + private foo(s: string): string; + private foo(n: number): string; + private foo(ns: any) { + return ns.toString(); + } +} + +//// [classdecl.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a(ns) { + } + a.prototype.pgF = function () { + }; + Object.defineProperty(a.prototype, "d", { + get: function () { + return 30; + }, + set: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(a, "p2", { + get: function () { + return { x: 30, y: 40 }; + }, + enumerable: true, + configurable: true + }); + a.d2 = function () { + }; + Object.defineProperty(a, "p3", { + get: function () { + return "string"; + }, + enumerable: true, + configurable: true + }); + a.prototype.foo = function (ns) { + return ns.toString(); + }; + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + return b; +})(a); +var m1; +(function (m1) { + var b = (function () { + function b() { + } + return b; + })(); + m1.b = b; + var d = (function () { + function d() { + } + return d; + })(); +})(m1 || (m1 = {})); +var m2; +(function (m2) { + var m3; + (function (m3) { + var c = (function (_super) { + __extends(c, _super); + function c() { + _super.apply(this, arguments); + } + return c; + })(b); + m3.c = c; + var ib2 = (function () { + function ib2() { + } + return ib2; + })(); + m3.ib2 = ib2; + })(m3 = m2.m3 || (m2.m3 = {})); +})(m2 || (m2 = {})); +var c = (function (_super) { + __extends(c, _super); + function c() { + _super.apply(this, arguments); + } + return c; +})(m1.b); +var ib2 = (function () { + function ib2() { + } + return ib2; +})(); +var d = (function () { + function d() { + } + d.prototype.foo = function (ns) { + return ns.toString(); + }; + return d; +})(); +var e = (function () { + function e() { + } + e.prototype.foo = function (ns) { + return ns.toString(); + }; + return e; +})(); + + +//// [classdecl.d.ts] +declare class a { + constructor(n: number); + constructor(s: string); + pgF(): void; + pv: any; + d: number; + static p2: { + x: number; + y: number; + }; + private static d2(); + private static p3; + private pv3; + private foo(n); + private foo(s); +} +declare class b extends a { +} +declare module m1 { + class b { + } + interface ib { + } +} +declare module m2 { + module m3 { + class c extends b { + } + class ib2 implements m1.ib { + } + } +} +declare class c extends m1.b { +} +declare class ib2 implements m1.ib { +} +declare class aAmbient { + constructor(n: number); + constructor(s: string); + pgF(): void; + pv: any; + d: number; + static p2: { + x: number; + y: number; + }; + static d2(): any; + static p3: any; + private pv3; + private foo(s); +} +declare class d { + private foo(n); + private foo(s); +} +declare class e { + private foo(s); + private foo(n); +} diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.js b/tests/baselines/reference/cloduleWithDuplicateMember1.js new file mode 100644 index 00000000000..ed4d69545fc --- /dev/null +++ b/tests/baselines/reference/cloduleWithDuplicateMember1.js @@ -0,0 +1,52 @@ +//// [cloduleWithDuplicateMember1.ts] +class C { + get x() { return 1; } + static get x() { + return ''; + } + static foo() { } +} + +module C { + export var x = 1; +} +module C { + export function foo() { } + export function x() { } +} + +//// [cloduleWithDuplicateMember1.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "x", { + get: function () { + return ''; + }, + enumerable: true, + configurable: true + }); + C.foo = function () { + }; + return C; +})(); +var C; +(function (C) { + C.x = 1; +})(C || (C = {})); +var C; +(function (C) { + function foo() { + } + C.foo = foo; + function x() { + } + C.x = x; +})(C || (C = {})); diff --git a/tests/baselines/reference/cloduleWithDuplicateMember2.js b/tests/baselines/reference/cloduleWithDuplicateMember2.js new file mode 100644 index 00000000000..461930c02ae --- /dev/null +++ b/tests/baselines/reference/cloduleWithDuplicateMember2.js @@ -0,0 +1,41 @@ +//// [cloduleWithDuplicateMember2.ts] +class C { + set x(y) { } + static set y(z) { } +} + +module C { + export var x = 1; +} +module C { + export function x() { } +} + +//// [cloduleWithDuplicateMember2.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + set: function (y) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "y", { + set: function (z) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var C; +(function (C) { + C.x = 1; +})(C || (C = {})); +var C; +(function (C) { + function x() { + } + C.x = x; +})(C || (C = {})); diff --git a/tests/baselines/reference/clodulesDerivedClasses.errors.txt b/tests/baselines/reference/clodulesDerivedClasses.errors.txt index 1753f6051bd..c3866c9e4be 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.errors.txt +++ b/tests/baselines/reference/clodulesDerivedClasses.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/clodulesDerivedClasses.ts(9,7): error TS2417: Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape'. Types of property 'Utils' are incompatible. - Type 'typeof Utils' is not assignable to type 'typeof Utils'. + Type 'typeof Path.Utils' is not assignable to type 'typeof Shape.Utils'. Property 'convert' is missing in type 'typeof Utils'. @@ -17,7 +17,7 @@ tests/cases/compiler/clodulesDerivedClasses.ts(9,7): error TS2417: Class static ~~~~ !!! error TS2417: Class static side 'typeof Path' incorrectly extends base class static side 'typeof Shape'. !!! error TS2417: Types of property 'Utils' are incompatible. -!!! error TS2417: Type 'typeof Utils' is not assignable to type 'typeof Utils'. +!!! error TS2417: Type 'typeof Path.Utils' is not assignable to type 'typeof Shape.Utils'. !!! error TS2417: Property 'convert' is missing in type 'typeof Utils'. name: string; diff --git a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js new file mode 100644 index 00000000000..9db005de9b9 --- /dev/null +++ b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js @@ -0,0 +1,126 @@ +//// [collisionCodeGenModuleWithAccessorChildren.ts] +module M { + export var x = 3; + class c { + private y; + set Z(M) { + this.y = x; + } + } +} + +module M { + class d { + private y; + set Z(p) { + var M = 10; + this.y = x; + } + } +} + +module M { // Shouldnt be _M + class e { + private y; + set M(p) { + this.y = x; + } + } +} + +module M { + class f { + get Z() { + var M = 10; + return x; + } + } +} + +module M { // Shouldnt be _M + class e { + get M() { + return x; + } + } +} + +//// [collisionCodeGenModuleWithAccessorChildren.js] +var M; +(function (_M) { + _M.x = 3; + var c = (function () { + function c() { + } + Object.defineProperty(c.prototype, "Z", { + set: function (M) { + this.y = _M.x; + }, + enumerable: true, + configurable: true + }); + return c; + })(); +})(M || (M = {})); +var M; +(function (_M) { + var d = (function () { + function d() { + } + Object.defineProperty(d.prototype, "Z", { + set: function (p) { + var M = 10; + this.y = _M.x; + }, + enumerable: true, + configurable: true + }); + return d; + })(); +})(M || (M = {})); +var M; +(function (M) { + var e = (function () { + function e() { + } + Object.defineProperty(e.prototype, "M", { + set: function (p) { + this.y = M.x; + }, + enumerable: true, + configurable: true + }); + return e; + })(); +})(M || (M = {})); +var M; +(function (_M) { + var f = (function () { + function f() { + } + Object.defineProperty(f.prototype, "Z", { + get: function () { + var M = 10; + return _M.x; + }, + enumerable: true, + configurable: true + }); + return f; + })(); +})(M || (M = {})); +var M; +(function (M) { + var e = (function () { + function e() { + } + Object.defineProperty(e.prototype, "M", { + get: function () { + return M.x; + }, + enumerable: true, + configurable: true + }); + return e; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js new file mode 100644 index 00000000000..92ddebd156c --- /dev/null +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -0,0 +1,112 @@ +//// [collisionSuperAndLocalFunctionInAccessors.ts] +function _super() { // No error +} +class Foo { + get prop1(): number { + function _super() { // No error + } + return 10; + } + set prop1(val: number) { + function _super() { // No error + } + } +} +class b extends Foo { + get prop2(): number { + function _super() { // Should be error + } + return 10; + } + set prop2(val: number) { + function _super() { // Should be error + } + } +} +class c extends Foo { + get prop2(): number { + var x = () => { + function _super() { // Should be error + } + } + return 10; + } + set prop2(val: number) { + var x = () => { + function _super() { // Should be error + } + } + } +} + +//// [collisionSuperAndLocalFunctionInAccessors.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +function _super() { +} +var Foo = (function () { + function Foo() { + } + Object.defineProperty(Foo.prototype, "prop1", { + get: function () { + function _super() { + } + return 10; + }, + set: function (val) { + function _super() { + } + }, + enumerable: true, + configurable: true + }); + return Foo; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b.prototype, "prop2", { + get: function () { + function _super() { + } + return 10; + }, + set: function (val) { + function _super() { + } + }, + enumerable: true, + configurable: true + }); + return b; +})(Foo); +var c = (function (_super) { + __extends(c, _super); + function c() { + _super.apply(this, arguments); + } + Object.defineProperty(c.prototype, "prop2", { + get: function () { + var x = function () { + function _super() { + } + }; + return 10; + }, + set: function (val) { + var x = function () { + function _super() { + } + }; + }, + enumerable: true, + configurable: true + }); + return c; +})(Foo); diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js new file mode 100644 index 00000000000..5a8e54a6c3d --- /dev/null +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -0,0 +1,98 @@ +//// [collisionSuperAndLocalVarInAccessors.ts] +var _super = 10; // No Error +class Foo { + get prop1(): number { + var _super = 10; // No error + return 10; + } + set prop1(val: number) { + var _super = 10; // No error + } +} +class b extends Foo { + get prop2(): number { + var _super = 10; // Should be error + return 10; + } + set prop2(val: number) { + var _super = 10; // Should be error + } +} +class c extends Foo { + get prop2(): number { + var x = () => { + var _super = 10; // Should be error + } + return 10; + } + set prop2(val: number) { + var x = () => { + var _super = 10; // Should be error + } + } +} + +//// [collisionSuperAndLocalVarInAccessors.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var _super = 10; // No Error +var Foo = (function () { + function Foo() { + } + Object.defineProperty(Foo.prototype, "prop1", { + get: function () { + var _super = 10; // No error + return 10; + }, + set: function (val) { + var _super = 10; // No error + }, + enumerable: true, + configurable: true + }); + return Foo; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b.prototype, "prop2", { + get: function () { + var _super = 10; // Should be error + return 10; + }, + set: function (val) { + var _super = 10; // Should be error + }, + enumerable: true, + configurable: true + }); + return b; +})(Foo); +var c = (function (_super) { + __extends(c, _super); + function c() { + _super.apply(this, arguments); + } + Object.defineProperty(c.prototype, "prop2", { + get: function () { + var x = function () { + var _super = 10; // Should be error + }; + return 10; + }, + set: function (val) { + var x = function () { + var _super = 10; // Should be error + }; + }, + enumerable: true, + configurable: true + }); + return c; +})(Foo); diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js new file mode 100644 index 00000000000..be9e0ce3f68 --- /dev/null +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -0,0 +1,136 @@ +//// [collisionSuperAndParameter.ts] +class Foo { + a() { + var lamda = (_super: number) => { // No Error + return x => this; // New scope. So should inject new _this capture + } + } + b(_super: number) { // No Error + var lambda = () => { + return x => this; // New scope. So should inject new _this capture + } + } + set c(_super: number) { // No error + } +} +class Foo2 extends Foo { + x() { + var lamda = (_super: number) => { // Error + return x => this; // New scope. So should inject new _this capture + } + } + y(_super: number) { // Error + var lambda = () => { + return x => this; // New scope. So should inject new _this capture + } + } + set z(_super: number) { // Error + } + public prop3: { + doStuff: (_super: number) => void; // no error - no code gen + } + public prop4 = { + doStuff: (_super: number) => { // should be error + } + } + constructor(_super: number) { // should be error + super(); + } +} +declare class Foo3 extends Foo { + x(); + y(_super: number); // No error - no code gen + constructor(_super: number); // No error - no code gen + public prop2: { + doStuff: (_super: number) => void; // no error - no code gen + }; + public _super: number; // No error +} + +class Foo4 extends Foo { + constructor(_super: number); // no code gen - no error + constructor(_super: string);// no code gen - no error + constructor(_super: any) { // should be error + super(); + } + y(_super: number); // no code gen - no error + y(_super: string); // no code gen - no error + y(_super: any) { // Error + var lambda = () => { + return x => this; // New scope. So should inject new _this capture + } + } +} + +//// [collisionSuperAndParameter.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + Foo.prototype.a = function () { + var _this = this; + var lamda = function (_super) { + return function (x) { return _this; }; // New scope. So should inject new _this capture + }; + }; + Foo.prototype.b = function (_super) { + var _this = this; + var lambda = function () { + return function (x) { return _this; }; // New scope. So should inject new _this capture + }; + }; + Object.defineProperty(Foo.prototype, "c", { + set: function (_super) { + }, + enumerable: true, + configurable: true + }); + return Foo; +})(); +var Foo2 = (function (_super) { + __extends(Foo2, _super); + function Foo2(_super) { + _super.call(this); + this.prop4 = { + doStuff: function (_super) { + } + }; + } + Foo2.prototype.x = function () { + var _this = this; + var lamda = function (_super) { + return function (x) { return _this; }; // New scope. So should inject new _this capture + }; + }; + Foo2.prototype.y = function (_super) { + var _this = this; + var lambda = function () { + return function (x) { return _this; }; // New scope. So should inject new _this capture + }; + }; + Object.defineProperty(Foo2.prototype, "z", { + set: function (_super) { + }, + enumerable: true, + configurable: true + }); + return Foo2; +})(Foo); +var Foo4 = (function (_super) { + __extends(Foo4, _super); + function Foo4(_super) { + _super.call(this); + } + Foo4.prototype.y = function (_super) { + var _this = this; + var lambda = function () { + return function (x) { return _this; }; // New scope. So should inject new _this capture + }; + }; + return Foo4; +})(Foo); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.js new file mode 100644 index 00000000000..53df2984544 --- /dev/null +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInAccessors.js @@ -0,0 +1,102 @@ +//// [collisionThisExpressionAndLocalVarInAccessors.ts] +class class1 { + get a(): number { + var x2 = { + doStuff: (callback) => () => { + var _this = 2; + return callback(this); + } + } + + return 10; + } + set a(val: number) { + var x2 = { + doStuff: (callback) => () => { + var _this = 2; + return callback(this); + } + } + + } +} + +class class2 { + get a(): number { + var _this = 2; + var x2 = { + doStuff: (callback) => () => { + return callback(this); + } + } + + return 10; + } + set a(val: number) { + var _this = 2; + var x2 = { + doStuff: (callback) => () => { + return callback(this); + } + } + + } +} + +//// [collisionThisExpressionAndLocalVarInAccessors.js] +var class1 = (function () { + function class1() { + } + Object.defineProperty(class1.prototype, "a", { + get: function () { + var _this = this; + var x2 = { + doStuff: function (callback) { return function () { + var _this = 2; + return callback(_this); + }; } + }; + return 10; + }, + set: function (val) { + var _this = this; + var x2 = { + doStuff: function (callback) { return function () { + var _this = 2; + return callback(_this); + }; } + }; + }, + enumerable: true, + configurable: true + }); + return class1; +})(); +var class2 = (function () { + function class2() { + } + Object.defineProperty(class2.prototype, "a", { + get: function () { + var _this = this; + var _this = 2; + var x2 = { + doStuff: function (callback) { return function () { + return callback(_this); + }; } + }; + return 10; + }, + set: function (val) { + var _this = this; + var _this = 2; + var x2 = { + doStuff: function (callback) { return function () { + return callback(_this); + }; } + }; + }, + enumerable: true, + configurable: true + }); + return class2; +})(); diff --git a/tests/baselines/reference/commaOperatorOtherValidOperation.js b/tests/baselines/reference/commaOperatorOtherValidOperation.js index 4d556472adc..383b7c5058e 100644 --- a/tests/baselines/reference/commaOperatorOtherValidOperation.js +++ b/tests/baselines/reference/commaOperatorOtherValidOperation.js @@ -22,6 +22,7 @@ function foo1() //// [commaOperatorOtherValidOperation.js] +//Comma operator in for loop for (var i = 0, j = 10; i < j; i++, j--) { } //Comma operator in fuction arguments and return diff --git a/tests/baselines/reference/commaOperatorWithoutOperand.js b/tests/baselines/reference/commaOperatorWithoutOperand.js new file mode 100644 index 00000000000..d52b8212344 --- /dev/null +++ b/tests/baselines/reference/commaOperatorWithoutOperand.js @@ -0,0 +1,46 @@ +//// [commaOperatorWithoutOperand.ts] +var ANY: any; +var BOOLEAN: boolean; +var NUMBER: number; +var STRING: string; +var OBJECT: Object; + +// Expect to have compiler errors +// Missing the second operand +(ANY, ); +(BOOLEAN, ); +(NUMBER, ); +(STRING, ); +(OBJECT, ); + +// Missing the first operand +(, ANY); +(, BOOLEAN); +(, NUMBER); +(, STRING); +(, OBJECT); + +// Missing all operands +( , ); + +//// [commaOperatorWithoutOperand.js] +var ANY; +var BOOLEAN; +var NUMBER; +var STRING; +var OBJECT; +// Expect to have compiler errors +// Missing the second operand +(ANY, ); +(BOOLEAN, ); +(NUMBER, ); +(STRING, ); +(OBJECT, ); +// Missing the first operand +(, ANY); +(, BOOLEAN); +(, NUMBER); +(, STRING); +(, OBJECT); +// Missing all operands +(, ); diff --git a/tests/baselines/reference/commentOnClassAccessor1.js b/tests/baselines/reference/commentOnClassAccessor1.js new file mode 100644 index 00000000000..cdd14a829fc --- /dev/null +++ b/tests/baselines/reference/commentOnClassAccessor1.js @@ -0,0 +1,24 @@ +//// [commentOnClassAccessor1.ts] +class C { + /** + * @type {number} + */ + get bar(): number { return 1;} +} + +//// [commentOnClassAccessor1.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "bar", { + /** + * @type {number} + */ + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/commentOnClassAccessor2.js b/tests/baselines/reference/commentOnClassAccessor2.js new file mode 100644 index 00000000000..c85d17e6e19 --- /dev/null +++ b/tests/baselines/reference/commentOnClassAccessor2.js @@ -0,0 +1,34 @@ +//// [commentOnClassAccessor2.ts] +class C { + /** + * Getter. + */ + get bar(): number { return 1;} + + /** + * Setter. + */ + set bar(v) { } +} + +//// [commentOnClassAccessor2.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "bar", { + /** + * Getter. + */ + get: function () { + return 1; + }, + /** + * Setter. + */ + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/commentsOnObjectLiteral1.js b/tests/baselines/reference/commentsOnObjectLiteral1.js index 1c47ed68d8d..feb6a521b8d 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral1.js +++ b/tests/baselines/reference/commentsOnObjectLiteral1.js @@ -8,4 +8,8 @@ var Person = makeClass( ); //// [commentsOnObjectLiteral1.js] -var Person = makeClass({}); +var Person = makeClass( +/** + @scope Person +*/ +{}); diff --git a/tests/baselines/reference/commentsVarDecl.js b/tests/baselines/reference/commentsVarDecl.js index 5105e03879d..5ff2a3c1c6a 100644 --- a/tests/baselines/reference/commentsVarDecl.js +++ b/tests/baselines/reference/commentsVarDecl.js @@ -66,7 +66,9 @@ var n = 30; /** var deckaration with comment on type as well*/ var y = 20; /// var deckaration with comment on type as well -var yy = 20; +var yy = +/// value comment +20; /** comment2 */ var z = function (x, y) { return x + y; }; var z2; diff --git a/tests/baselines/reference/commentsdoNotEmitComments.js b/tests/baselines/reference/commentsdoNotEmitComments.js index fa1cc4c4d12..301ab56e4c0 100644 --- a/tests/baselines/reference/commentsdoNotEmitComments.js +++ b/tests/baselines/reference/commentsdoNotEmitComments.js @@ -86,6 +86,11 @@ module m1 { /// this is x declare var x; + + +/** const enum member value comment (generated by TS) */ +const enum color { red, green, blue } +var shade: color = color.green; //// [commentsdoNotEmitComments.js] @@ -129,6 +134,7 @@ var m1; })(); m1.b = b; })(m1 || (m1 = {})); +var shade = 1; //// [commentsdoNotEmitComments.d.ts] @@ -161,3 +167,9 @@ declare module m1 { } } declare var x: any; +declare const enum color { + red = 0, + green = 1, + blue = 2, +} +declare var shade: color; diff --git a/tests/baselines/reference/commentsdoNotEmitComments.types b/tests/baselines/reference/commentsdoNotEmitComments.types index c42d3d2c17c..bbe3a685ca1 100644 --- a/tests/baselines/reference/commentsdoNotEmitComments.types +++ b/tests/baselines/reference/commentsdoNotEmitComments.types @@ -151,3 +151,18 @@ module m1 { declare var x; >x : any + +/** const enum member value comment (generated by TS) */ +const enum color { red, green, blue } +>color : color +>red : color +>green : color +>blue : color + +var shade: color = color.green; +>shade : color +>color : color +>color.green : color +>color : typeof color +>green : color + diff --git a/tests/baselines/reference/complicatedPrivacy.errors.txt b/tests/baselines/reference/complicatedPrivacy.errors.txt index fd47927f883..5aa399d1d84 100644 --- a/tests/baselines/reference/complicatedPrivacy.errors.txt +++ b/tests/baselines/reference/complicatedPrivacy.errors.txt @@ -1,8 +1,9 @@ tests/cases/compiler/complicatedPrivacy.ts(24,38): error TS1005: ';' expected. +tests/cases/compiler/complicatedPrivacy.ts(35,6): error TS2304: Cannot find name 'number'. tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' has no exported member 'i6'. -==== tests/cases/compiler/complicatedPrivacy.ts (2 errors) ==== +==== tests/cases/compiler/complicatedPrivacy.ts (3 errors) ==== module m1 { export module m2 { @@ -39,7 +40,9 @@ tests/cases/compiler/complicatedPrivacy.ts(73,49): error TS2305: Module 'mglo5' export function f4(arg1: { - [number]: C1; + [number]: C1; // Used to be indexer, now it is a computed property + ~~~~~~ +!!! error TS2304: Cannot find name 'number'. }) { } diff --git a/tests/baselines/reference/complicatedPrivacy.js b/tests/baselines/reference/complicatedPrivacy.js new file mode 100644 index 00000000000..3d5b321a36f --- /dev/null +++ b/tests/baselines/reference/complicatedPrivacy.js @@ -0,0 +1,204 @@ +//// [complicatedPrivacy.ts] +module m1 { + export module m2 { + + + export function f1(c1: C1) { + } + export function f2(c2: C2) { + } + + export class C2 implements m3.i3 { + public get p1(arg) { + return new C1(); + } + + public set p1(arg1: C1) { + } + + public f55() { + return "Hello world"; + } + } + } + + export function f2(arg1: { x?: C1, y: number }) { + } + + export function f3(): { + (a: number) : C1; + } { + return null; + } + + export function f4(arg1: + { + [number]: C1; // Used to be indexer, now it is a computed property + }) { + } + + + export function f5(arg2: { + new (arg1: C1) : C1 + }) { + } + module m3 { + function f2(f1: C1) { + } + + export interface i3 { + f55(): string; + } + } + + class C1 { + } + + interface i { + x: number; + } + + export class C5 implements i { + public x: number; + } + + export var v2: C1[]; +} + +class C2 { +} + +module m2 { + export module m3 { + + export class c_pr implements mglo5.i5, mglo5.i6 { + f1() { + return "Hello"; + } + } + + module m4 { + class C { + } + module m5 { + + export module m6 { + function f1() { + return new C(); + } + } + } + } + + } +} + +module mglo5 { + export interface i5 { + f1(): string; + } + + interface i6 { + f6(): number; + } +} + + +//// [complicatedPrivacy.js] +var m1; +(function (m1) { + var m2; + (function (m2) { + function f1(c1) { + } + m2.f1 = f1; + function f2(c2) { + } + m2.f2 = f2; + var C2 = (function () { + function C2() { + } + Object.defineProperty(C2.prototype, "p1", { + get: function (arg) { + return new C1(); + }, + set: function (arg1) { + }, + enumerable: true, + configurable: true + }); + C2.prototype.f55 = function () { + return "Hello world"; + }; + return C2; + })(); + m2.C2 = C2; + })(m2 = m1.m2 || (m1.m2 = {})); + function f2(arg1) { + } + m1.f2 = f2; + function f3() { + return null; + } + m1.f3 = f3; + function f4(arg1) { + } + m1.f4 = f4; + function f5(arg2) { + } + m1.f5 = f5; + var m3; + (function (m3) { + function f2(f1) { + } + })(m3 || (m3 = {})); + var C1 = (function () { + function C1() { + } + return C1; + })(); + var C5 = (function () { + function C5() { + } + return C5; + })(); + m1.C5 = C5; + m1.v2; +})(m1 || (m1 = {})); +var C2 = (function () { + function C2() { + } + return C2; +})(); +var m2; +(function (m2) { + var m3; + (function (m3) { + var c_pr = (function () { + function c_pr() { + } + c_pr.prototype.f1 = function () { + return "Hello"; + }; + return c_pr; + })(); + m3.c_pr = c_pr; + var m4; + (function (m4) { + var C = (function () { + function C() { + } + return C; + })(); + var m5; + (function (m5) { + var m6; + (function (m6) { + function f1() { + return new C(); + } + })(m6 = m5.m6 || (m5.m6 = {})); + })(m5 || (m5 = {})); + })(m4 || (m4 = {})); + })(m3 = m2.m3 || (m2.m3 = {})); +})(m2 || (m2 = {})); diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js new file mode 100644 index 00000000000..5cefd44e1c5 --- /dev/null +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -0,0 +1,261 @@ +//// [compoundAssignmentLHSIsValue.ts] +// expected error for all the LHS of compound assignments (arithmetic and addition) +var value; + +// this +class C { + constructor() { + this *= value; + this += value; + } + foo() { + this *= value; + this += value; + } + static sfoo() { + this *= value; + this += value; + } +} + +function foo() { + this *= value; + this += value; +} + +this *= value; +this += value; + +// identifiers: module, class, enum, function +module M { export var a; } +M *= value; +M += value; + +C *= value; +C += value; + +enum E { } +E *= value; +E += value; + +foo *= value; +foo += value; + +// literals +null *= value; +null += value; +true *= value; +true += value; +false *= value; +false += value; +0 *= value; +0 += value; +'' *= value; +'' += value; +/d+/ *= value; +/d+/ += value; + +// object literals +{ a: 0} *= value; +{ a: 0} += value; + +// array literals +['', ''] *= value; +['', ''] += value; + +// super +class Derived extends C { + constructor() { + super(); + super *= value; + super += value; + } + + foo() { + super *= value; + super += value; + } + + static sfoo() { + super *= value; + super += value; + } +} + +// function expression +function bar1() { } *= value; +function bar2() { } += value; +() => { } *= value; +() => { } += value; + +// function calls +foo() *= value; +foo() += value; + +// parentheses, the containted expression is value +(this) *= value; +(this) += value; +(M) *= value; +(M) += value; +(C) *= value; +(C) += value; +(E) *= value; +(E) += value; +(foo) *= value; +(foo) += value; +(null) *= value; +(null) += value; +(true) *= value; +(true) += value; +(0) *= value; +(0) += value; +('') *= value; +('') += value; +(/d+/) *= value; +(/d+/) += value; +({}) *= value; +({}) += value; +([]) *= value; +([]) += value; +(function baz1() { }) *= value; +(function baz2() { }) += value; +(foo()) *= value; +(foo()) += value; + +//// [compoundAssignmentLHSIsValue.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +// expected error for all the LHS of compound assignments (arithmetic and addition) +var value; +// this +var C = (function () { + function C() { + this *= value; + this += value; + } + C.prototype.foo = function () { + this *= value; + this += value; + }; + C.sfoo = function () { + this *= value; + this += value; + }; + return C; +})(); +function foo() { + this *= value; + this += value; +} +this *= value; +this += value; +// identifiers: module, class, enum, function +var M; +(function (M) { + M.a; +})(M || (M = {})); +M *= value; +M += value; +C *= value; +C += value; +var E; +(function (E) { +})(E || (E = {})); +E *= value; +E += value; +foo *= value; +foo += value; +// literals +null *= value; +null += value; +true *= value; +true += value; +false *= value; +false += value; +0 *= value; +0 += value; +'' *= value; +'' += value; +/d+/ *= value; +/d+/ += value; +// object literals +{ + a: 0; +} +value; +{ + a: 0; +} +value; +// array literals +['', ''] *= value; +['', ''] += value; +// super +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.call(this); + _super.prototype. *= value; + _super.prototype. += value; + } + Derived.prototype.foo = function () { + _super.prototype. *= value; + _super.prototype. += value; + }; + Derived.sfoo = function () { + _super. *= value; + _super. += value; + }; + return Derived; +})(C); +// function expression +function bar1() { +} +value; +function bar2() { +} +value; +(function () { +}); +value; +(function () { +}); +value; +// function calls +foo() *= value; +foo() += value; +// parentheses, the containted expression is value +(this) *= value; +(this) += value; +(M) *= value; +(M) += value; +(C) *= value; +(C) += value; +(E) *= value; +(E) += value; +(foo) *= value; +(foo) += value; +(null) *= value; +(null) += value; +(true) *= value; +(true) += value; +(0) *= value; +(0) += value; +('') *= value; +('') += value; +(/d+/) *= value; +(/d+/) += value; +({}) *= value; +({}) += value; +([]) *= value; +([]) += value; +(function baz1() { +}) *= value; +(function baz2() { +}) += value; +(foo()) *= value; +(foo()) += value; diff --git a/tests/baselines/reference/computedPropertyNames1.errors.txt b/tests/baselines/reference/computedPropertyNames1.errors.txt deleted file mode 100644 index 02abbcd6b2d..00000000000 --- a/tests/baselines/reference/computedPropertyNames1.errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(2,9): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts(3,9): error TS9002: Computed property names are not currently supported. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts (2 errors) ==== - var v = { - get [0 + 1]() { return 0 }, - ~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - set [0 + 1](v: string) { } //No error - ~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1.js new file mode 100644 index 00000000000..8f3e448d698 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames1.ts] +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} + +//// [computedPropertyNames1.js] +var v = { + get [0 + 1]() { + return 0; + }, + set [0 + 1](v) { + } //No error +}; diff --git a/tests/baselines/reference/computedPropertyNames1.types b/tests/baselines/reference/computedPropertyNames1.types new file mode 100644 index 00000000000..b44aa3c69d0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts === +var v = { +>v : {} +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} + + get [0 + 1]() { return 0 }, +>0 + 1 : number + + set [0 + 1](v: string) { } //No error +>0 + 1 : number +>v : string +} diff --git a/tests/baselines/reference/computedPropertyNames10.js b/tests/baselines/reference/computedPropertyNames10.js new file mode 100644 index 00000000000..138cbd7a4b2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10.js @@ -0,0 +1,46 @@ +//// [computedPropertyNames10.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames10.js] +var s; +var n; +var a; +var v = { + [s]() { + }, + [n]() { + }, + [s + s]() { + }, + [s + n]() { + }, + [+s]() { + }, + [""]() { + }, + [0]() { + }, + [a]() { + }, + [true]() { + }, + [`hello bye`]() { + }, + [`hello ${a} bye`]() { + } +}; diff --git a/tests/baselines/reference/computedPropertyNames10.types b/tests/baselines/reference/computedPropertyNames10.types new file mode 100644 index 00000000000..29bf6c43bef --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {} + + [s]() { }, +>s : string + + [n]() { }, +>n : number + + [s + s]() { }, +>s + s : string +>s : string +>s : string + + [s + n]() { }, +>s + n : string +>s : string +>n : number + + [+s]() { }, +>+s : number +>s : string + + [""]() { }, + [0]() { }, + [a]() { }, +>a : any + + [true]() { }, +>true : any + + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames11.js b/tests/baselines/reference/computedPropertyNames11.js new file mode 100644 index 00000000000..d82a7c4e512 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames11.ts] +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames11.js] +var s; +var n; +var a; +var v = { + get [s]() { + return 0; + }, + set [n](v) { + }, + get [s + s]() { + return 0; + }, + set [s + n](v) { + }, + get [+s]() { + return 0; + }, + set [""](v) { + }, + get [0]() { + return 0; + }, + set [a](v) { + }, + get [true]() { + return 0; + }, + set [`hello bye`](v) { + }, + get [`hello ${a} bye`]() { + return 0; + } +}; diff --git a/tests/baselines/reference/computedPropertyNames11.types b/tests/baselines/reference/computedPropertyNames11.types new file mode 100644 index 00000000000..ee0796320d6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : {} + + get [s]() { return 0; }, +>s : string + + set [n](v) { }, +>n : number +>v : any + + get [s + s]() { return 0; }, +>s + s : string +>s : string +>s : string + + set [s + n](v) { }, +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; }, +>+s : number +>s : string + + set [""](v) { }, +>v : any + + get [0]() { return 0; }, + set [a](v) { }, +>a : any +>v : any + + get [true]() { return 0; }, +>true : any + + set [`hello bye`](v) { }, +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12.errors.txt new file mode 100644 index 00000000000..56774fe8dae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [n] = n; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [+s]: typeof s; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [""]: number; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [0]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [a]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12.js b/tests/baselines/reference/computedPropertyNames12.js new file mode 100644 index 00000000000..5e5dec0c549 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames12.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} + +//// [computedPropertyNames12.js] +var s; +var n; +var a; +var C = (function () { + function C() { + this[n] = n; + this[s + n] = 2; + this[`hello bye`] = 0; + } + C[`hello ${a} bye`] = 0; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames13.js b/tests/baselines/reference/computedPropertyNames13.js new file mode 100644 index 00000000000..ea531a9c644 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13.js @@ -0,0 +1,49 @@ +//// [computedPropertyNames13.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames13.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + C.prototype[s] = function () { + }; + C.prototype[n] = function () { + }; + C[s + s] = function () { + }; + C.prototype[s + n] = function () { + }; + C.prototype[+s] = function () { + }; + C[""] = function () { + }; + C.prototype[0] = function () { + }; + C.prototype[a] = function () { + }; + C[true] = function () { + }; + C.prototype[`hello bye`] = function () { + }; + C[`hello ${a} bye`] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames13.types b/tests/baselines/reference/computedPropertyNames13.types new file mode 100644 index 00000000000..4f267f2e893 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + [s]() {} +>s : string + + [n]() { } +>n : number + + static [s + s]() { } +>s + s : string +>s : string +>s : string + + [s + n]() { } +>s + n : string +>s : string +>n : number + + [+s]() { } +>+s : number +>s : string + + static [""]() { } + [0]() { } + [a]() { } +>a : any + + static [true]() { } +>true : any + + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14.errors.txt new file mode 100644 index 00000000000..1cf5b1445f2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== + var b: boolean; + class C { + [b]() {} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [true]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [[]]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [{}]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [undefined]() { } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [null]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14.js b/tests/baselines/reference/computedPropertyNames14.js new file mode 100644 index 00000000000..aa551795da6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14.js @@ -0,0 +1,30 @@ +//// [computedPropertyNames14.ts] +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} + +//// [computedPropertyNames14.js] +var b; +var C = (function () { + function C() { + } + C.prototype[b] = function () { + }; + C[true] = function () { + }; + C.prototype[[]] = function () { + }; + C[{}] = function () { + }; + C.prototype[undefined] = function () { + }; + C[null] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15.errors.txt new file mode 100644 index 00000000000..0e759668a95 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + class C { + [p1]() { } + [p2]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [p3]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15.js b/tests/baselines/reference/computedPropertyNames15.js new file mode 100644 index 00000000000..1b506bbeb90 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames15.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} + +//// [computedPropertyNames15.js] +var p1; +var p2; +var p3; +var C = (function () { + function C() { + } + C.prototype[p1] = function () { + }; + C.prototype[p2] = function () { + }; + C.prototype[p3] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16.js b/tests/baselines/reference/computedPropertyNames16.js new file mode 100644 index 00000000000..295deb9ee82 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16.js @@ -0,0 +1,99 @@ +//// [computedPropertyNames16.ts] +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames16.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, n, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, s + s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, s + n, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, +s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 0, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, a, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, `hello bye`, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, `hello ${a} bye`, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16.types b/tests/baselines/reference/computedPropertyNames16.types new file mode 100644 index 00000000000..ccfa7996066 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + get [s]() { return 0;} +>s : string + + set [n](v) { } +>n : number +>v : any + + static get [s + s]() { return 0; } +>s + s : string +>s : string +>s : string + + set [s + n](v) { } +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; } +>+s : number +>s : string + + static set [""](v) { } +>v : any + + get [0]() { return 0; } + set [a](v) { } +>a : any +>v : any + + static get [true]() { return 0; } +>true : any + + set [`hello bye`](v) { } +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17.errors.txt new file mode 100644 index 00000000000..b236ae3245e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== + var b: boolean; + class C { + get [b]() { return 0;} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static set [true](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + get [[]]() { return 0; } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [{}](v) { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static get [undefined]() { return 0; } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [null](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17.js b/tests/baselines/reference/computedPropertyNames17.js new file mode 100644 index 00000000000..5a55dbf7e1b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17.js @@ -0,0 +1,57 @@ +//// [computedPropertyNames17.ts] +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} + +//// [computedPropertyNames17.js] +var b; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, b, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [], { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, {}, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, undefined, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, null, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames18.js b/tests/baselines/reference/computedPropertyNames18.js new file mode 100644 index 00000000000..af2d68b3095 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18.js @@ -0,0 +1,13 @@ +//// [computedPropertyNames18.ts] +function foo() { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames18.js] +function foo() { + var obj = { + [this.bar]: 0 + }; +} diff --git a/tests/baselines/reference/computedPropertyNames18.types b/tests/baselines/reference/computedPropertyNames18.types new file mode 100644 index 00000000000..0976e5fc3ca --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts === +function foo() { +>foo : () => void + + var obj = { +>obj : {} +>{ [this.bar]: 0 } : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any + } +} diff --git a/tests/baselines/reference/computedPropertyNames19.errors.txt b/tests/baselines/reference/computedPropertyNames19.errors.txt new file mode 100644 index 00000000000..2037008992f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts (1 errors) ==== + module M { + var obj = { + [this.bar]: 0 + ~~~~ +!!! error TS2331: 'this' cannot be referenced in a module body. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames19.js b/tests/baselines/reference/computedPropertyNames19.js new file mode 100644 index 00000000000..3fd2f99eea6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames19.ts] +module M { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames19.js] +var M; +(function (M) { + var obj = { + [this.bar]: 0 + }; +})(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2.errors.txt index 3dd4ac01d5f..d0fd1de4576 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2.errors.txt @@ -1,37 +1,19 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(4,5): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(5,12): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(7,9): error TS9002: Computed property names are not currently supported. tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(9,16): error TS9002: Computed property names are not currently supported. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (8 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { [methodName]() { } - ~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. static [methodName]() { } - ~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. get [accessorName]() { } ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. - ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. set [accessorName](v) { } - ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. static get [accessorName]() { } ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. - ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. static set [accessorName](v) { } - ~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2.js b/tests/baselines/reference/computedPropertyNames2.js new file mode 100644 index 00000000000..78d53ef94fc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames2.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} + +//// [computedPropertyNames2.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function () { + }; + C[methodName] = function () { + }; + Object.defineProperty(C.prototype, accessorName, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, accessorName, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames20.js b/tests/baselines/reference/computedPropertyNames20.js new file mode 100644 index 00000000000..2a1edf06142 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames20.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20.js] +var obj = { + [this.bar]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames20.types b/tests/baselines/reference/computedPropertyNames20.types new file mode 100644 index 00000000000..abd1b203e87 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts === +var obj = { +>obj : {} +>{ [this.bar]: 0} : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any +} diff --git a/tests/baselines/reference/computedPropertyNames21.errors.txt b/tests/baselines/reference/computedPropertyNames21.errors.txt new file mode 100644 index 00000000000..a44c8d60ee8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [this.bar()]() { } + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames21.js b/tests/baselines/reference/computedPropertyNames21.js new file mode 100644 index 00000000000..250d9142aa5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames21.ts] +class C { + bar() { + return 0; + } + [this.bar()]() { } +} + +//// [computedPropertyNames21.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[this.bar()] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22.js b/tests/baselines/reference/computedPropertyNames22.js new file mode 100644 index 00000000000..b42946536d0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames22.ts] +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames22.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = { + [this.bar()]() { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22.types b/tests/baselines/reference/computedPropertyNames22.types new file mode 100644 index 00000000000..d23546192c0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts === +class C { +>C : C + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [this.bar()]() { } } : {} + + [this.bar()]() { } +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames23.errors.txt b/tests/baselines/reference/computedPropertyNames23.errors.txt new file mode 100644 index 00000000000..0846ba4d6c6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames23.js b/tests/baselines/reference/computedPropertyNames23.js new file mode 100644 index 00000000000..9d71ef34c1e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23.js @@ -0,0 +1,21 @@ +//// [computedPropertyNames23.ts] +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames23.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[{ [this.bar()]: 1 }[0]] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames24.errors.txt b/tests/baselines/reference/computedPropertyNames24.errors.txt new file mode 100644 index 00000000000..938fb64b82e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames24.js b/tests/baselines/reference/computedPropertyNames24.js new file mode 100644 index 00000000000..2ef2826ee22 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24.js @@ -0,0 +1,38 @@ +//// [computedPropertyNames24.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} + +//// [computedPropertyNames24.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[super.bar.call(this)] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25.js b/tests/baselines/reference/computedPropertyNames25.js new file mode 100644 index 00000000000..a15fcb217e7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25.js @@ -0,0 +1,44 @@ +//// [computedPropertyNames25.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames25.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var obj = { + [_super.prototype.bar.call(this)]() { + } + }; + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25.types b/tests/baselines/reference/computedPropertyNames25.types new file mode 100644 index 00000000000..d8567dc86ad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + var obj = { +>obj : {} +>{ [super.bar()]() { } } : {} + + [super.bar()]() { } +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames26.errors.txt b/tests/baselines/reference/computedPropertyNames26.errors.txt new file mode 100644 index 00000000000..bbe51c6a0c8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames26.js b/tests/baselines/reference/computedPropertyNames26.js new file mode 100644 index 00000000000..96760fc279c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26.js @@ -0,0 +1,40 @@ +//// [computedPropertyNames26.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames26.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[{ [super.bar.call(this)]: 1 }[0]] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames27.errors.txt b/tests/baselines/reference/computedPropertyNames27.errors.txt new file mode 100644 index 00000000000..c2872197363 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts (1 errors) ==== + class Base { + } + class C extends Base { + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames27.js b/tests/baselines/reference/computedPropertyNames27.js new file mode 100644 index 00000000000..71db977e9b6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27.js @@ -0,0 +1,28 @@ +//// [computedPropertyNames27.ts] +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} + +//// [computedPropertyNames27.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype[(_super.call(this), "prop")] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28.js b/tests/baselines/reference/computedPropertyNames28.js new file mode 100644 index 00000000000..96c7cd082f1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames28.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} + +//// [computedPropertyNames28.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + var obj = { + [(_super.call(this), "prop")]() { + } + }; + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28.types b/tests/baselines/reference/computedPropertyNames28.types new file mode 100644 index 00000000000..2adf52f8c5f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts === +class Base { +>Base : Base +} +class C extends Base { +>C : C +>Base : Base + + constructor() { + super(); +>super() : void +>super : typeof Base + + var obj = { +>obj : {} +>{ [(super(), "prop")]() { } } : {} + + [(super(), "prop")]() { } +>(super(), "prop") : string +>super(), "prop" : string +>super() : void +>super : typeof Base + + }; + } +} diff --git a/tests/baselines/reference/computedPropertyNames29.js b/tests/baselines/reference/computedPropertyNames29.js new file mode 100644 index 00000000000..94e83f34629 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames29.ts] +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames29.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + (() => { + var obj = { + [this.bar()]() { + } // needs capture + }; + }); + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames29.types b/tests/baselines/reference/computedPropertyNames29.types new file mode 100644 index 00000000000..ed4db5862e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts === +class C { +>C : C + + bar() { +>bar : () => number + + () => { +>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [this.bar()]() { } // needs capture } : {} + + [this.bar()]() { } // needs capture +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt index 084a1f8889f..080bff1ab9a 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3.errors.txt @@ -1,36 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(3,5): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(8,16): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (8 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== var id; class C { [0 + 1]() { } - ~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. static [() => { }]() { } ~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. get [delete id]() { } ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. set [[0, 1]](v) { } ~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static get [""]() { } ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static set [id.toString()](v) { } - ~~~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.js b/tests/baselines/reference/computedPropertyNames3.js new file mode 100644 index 00000000000..969bbf96d86 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3.js @@ -0,0 +1,47 @@ +//// [computedPropertyNames3.ts] +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} + +//// [computedPropertyNames3.js] +var id; +var C = (function () { + function C() { + } + C.prototype[0 + 1] = function () { + }; + C[() => { + }] = function () { + }; + Object.defineProperty(C.prototype, delete id, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [0, 1], { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, id.toString(), { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames30.errors.txt b/tests/baselines/reference/computedPropertyNames30.errors.txt new file mode 100644 index 00000000000..f7b6411f867 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts (1 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + }; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames30.js b/tests/baselines/reference/computedPropertyNames30.js new file mode 100644 index 00000000000..608531ffb5b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30.js @@ -0,0 +1,45 @@ +//// [computedPropertyNames30.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} + +//// [computedPropertyNames30.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + (() => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(_super.call(this), "prop")]() { + } + }; + }); + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames31.js b/tests/baselines/reference/computedPropertyNames31.js new file mode 100644 index 00000000000..9a31b80e346 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31.js @@ -0,0 +1,49 @@ +//// [computedPropertyNames31.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames31.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var _this = this; + (() => { + var obj = { + [_super.prototype.bar.call(_this)]() { + } // needs capture + }; + }); + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames31.types b/tests/baselines/reference/computedPropertyNames31.types new file mode 100644 index 00000000000..90e73bc3dcb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + () => { +>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [super.bar()]() { } // needs capture } : {} + + [super.bar()]() { } // needs capture +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32.errors.txt new file mode 100644 index 00000000000..e2f08c79fc9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ==== + function foo() { return '' } + class C { + bar() { + return 0; + } + [foo()]() { } + ~ +!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32.js b/tests/baselines/reference/computedPropertyNames32.js new file mode 100644 index 00000000000..d3e98681369 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames32.ts] +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} + +//// [computedPropertyNames32.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[foo()] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33.js b/tests/baselines/reference/computedPropertyNames33.js new file mode 100644 index 00000000000..554ec315897 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames33.ts] +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames33.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = { + [foo()]() { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33.types b/tests/baselines/reference/computedPropertyNames33.types new file mode 100644 index 00000000000..8cbe8e93ef2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts === +function foo() { return '' } +>foo : () => string +>T : T + +class C { +>C : C +>T : T + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [foo()]() { } } : {} + + [foo()]() { } +>foo() : string +>foo : () => string +>T : T + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames34.errors.txt b/tests/baselines/reference/computedPropertyNames34.errors.txt new file mode 100644 index 00000000000..c6d4a9aa4eb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts(5,18): error TS2302: Static members cannot reference class type parameters. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts (1 errors) ==== + function foo() { return '' } + class C { + static bar() { + var obj = { + [foo()]() { } + ~ +!!! error TS2302: Static members cannot reference class type parameters. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames34.js b/tests/baselines/reference/computedPropertyNames34.js new file mode 100644 index 00000000000..f1d774139b1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames34.ts] +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames34.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.bar = function () { + var obj = { + [foo()]() { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35.errors.txt new file mode 100644 index 00000000000..01c4614e84a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35.js b/tests/baselines/reference/computedPropertyNames35.js new file mode 100644 index 00000000000..5a731fd8bda --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35.js @@ -0,0 +1,11 @@ +//// [computedPropertyNames35.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35.js] +function foo() { + return ''; +} diff --git a/tests/baselines/reference/computedPropertyNames36.errors.txt b/tests/baselines/reference/computedPropertyNames36.errors.txt new file mode 100644 index 00000000000..a473ebfba8e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames36.js b/tests/baselines/reference/computedPropertyNames36.js new file mode 100644 index 00000000000..7c731014d1e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames36.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames36.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37.js b/tests/baselines/reference/computedPropertyNames37.js new file mode 100644 index 00000000000..fb4c32909d5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames37.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames37.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37.types b/tests/baselines/reference/computedPropertyNames37.types new file mode 100644 index 00000000000..b50e0590b79 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: number]: Foo2; +>s : number +>Foo2 : Foo2 + + // Computed properties + get ["get1"]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo + + set ["set1"](p: Foo2) { } +>p : Foo2 +>Foo2 : Foo2 +} diff --git a/tests/baselines/reference/computedPropertyNames38.errors.txt b/tests/baselines/reference/computedPropertyNames38.errors.txt new file mode 100644 index 00000000000..fc5f31f1329 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames38.js b/tests/baselines/reference/computedPropertyNames38.js new file mode 100644 index 00000000000..922244bfecf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames38.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames38.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames39.errors.txt b/tests/baselines/reference/computedPropertyNames39.errors.txt new file mode 100644 index 00000000000..573ef726241 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39.js b/tests/baselines/reference/computedPropertyNames39.js new file mode 100644 index 00000000000..62621f4e754 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames39.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames39.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames4.js b/tests/baselines/reference/computedPropertyNames4.js new file mode 100644 index 00000000000..5acb6d957da --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames4.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} + +//// [computedPropertyNames4.js] +var s; +var n; +var a; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames4.types b/tests/baselines/reference/computedPropertyNames4.types new file mode 100644 index 00000000000..968cc86b598 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : {} + + [s]: 0, +>s : string + + [n]: n, +>n : number +>n : number + + [s + s]: 1, +>s + s : string +>s : string +>s : string + + [s + n]: 2, +>s + n : string +>s : string +>n : number + + [+s]: s, +>+s : number +>s : string +>s : string + + [""]: 0, + [0]: 0, + [a]: 1, +>a : any + + [true]: 0, +>true : any + + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames40.errors.txt b/tests/baselines/reference/computedPropertyNames40.errors.txt new file mode 100644 index 00000000000..c5bda4ed999 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + [""]() { return new Foo2 } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40.js b/tests/baselines/reference/computedPropertyNames40.js new file mode 100644 index 00000000000..1c9b5d3bfa8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames40.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} + +//// [computedPropertyNames40.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C.prototype[""] = function () { + return new Foo; + }; + C.prototype[""] = function () { + return new Foo2; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41.js b/tests/baselines/reference/computedPropertyNames41.js new file mode 100644 index 00000000000..34fe2d33df7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames41.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} + +//// [computedPropertyNames41.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C[""] = function () { + return new Foo; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41.types b/tests/baselines/reference/computedPropertyNames41.types new file mode 100644 index 00000000000..1fb0af282ca --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: string]: () => Foo2; +>s : string +>Foo2 : Foo2 + + // Computed properties + static [""]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo +} diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42.errors.txt new file mode 100644 index 00000000000..059b3117a43 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + ~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42.js b/tests/baselines/reference/computedPropertyNames42.js new file mode 100644 index 00000000000..c9f24a1c708 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames42.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} + +//// [computedPropertyNames42.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames43.errors.txt b/tests/baselines/reference/computedPropertyNames43.errors.txt new file mode 100644 index 00000000000..d38dcca9216 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + } + + class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43.js b/tests/baselines/reference/computedPropertyNames43.js new file mode 100644 index 00000000000..22ac7774439 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43.js @@ -0,0 +1,57 @@ +//// [computedPropertyNames43.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames43.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames44.errors.txt b/tests/baselines/reference/computedPropertyNames44.errors.txt new file mode 100644 index 00000000000..bf1de6687e1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } + + class D extends C { + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44.js b/tests/baselines/reference/computedPropertyNames44.js new file mode 100644 index 00000000000..c91a52e8199 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44.js @@ -0,0 +1,55 @@ +//// [computedPropertyNames44.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames44.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames45.errors.txt b/tests/baselines/reference/computedPropertyNames45.errors.txt new file mode 100644 index 00000000000..7ad29340b25 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + get ["get1"]() { return new Foo } + } + + class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45.js b/tests/baselines/reference/computedPropertyNames45.js new file mode 100644 index 00000000000..7ec3c165e12 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45.js @@ -0,0 +1,56 @@ +//// [computedPropertyNames45.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames45.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames46.js b/tests/baselines/reference/computedPropertyNames46.js new file mode 100644 index 00000000000..e2ef2b2e729 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames46.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46.js] +var o = { + ["" || 0]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames46.types b/tests/baselines/reference/computedPropertyNames46.types new file mode 100644 index 00000000000..cf8585828f4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts === +var o = { +>o : {} +>{ ["" || 0]: 0} : {} + + ["" || 0]: 0 +>"" || 0 : string | number + +}; diff --git a/tests/baselines/reference/computedPropertyNames47.js b/tests/baselines/reference/computedPropertyNames47.js new file mode 100644 index 00000000000..88e28e54239 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames47.ts] +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; + +//// [computedPropertyNames47.js] +var E1; +(function (E1) { + E1[E1["x"] = 0] = "x"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["x"] = 0] = "x"; +})(E2 || (E2 = {})); +var o = { + [0 /* x */ || 0 /* x */]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames47.types b/tests/baselines/reference/computedPropertyNames47.types new file mode 100644 index 00000000000..20d7ab1d31e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts === +enum E1 { x } +>E1 : E1 +>x : E1 + +enum E2 { x } +>E2 : E2 +>x : E2 + +var o = { +>o : {} +>{ [E1.x || E2.x]: 0} : {} + + [E1.x || E2.x]: 0 +>E1.x || E2.x : E1 | E2 +>E1.x : E1 +>E1 : typeof E1 +>x : E1 +>E2.x : E2 +>E2 : typeof E2 +>x : E2 + +}; diff --git a/tests/baselines/reference/computedPropertyNames48.js b/tests/baselines/reference/computedPropertyNames48.js new file mode 100644 index 00000000000..9f8e0442ebe --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48.js @@ -0,0 +1,34 @@ +//// [computedPropertyNames48.ts] +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) + +//// [computedPropertyNames48.js] +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +var a; +extractIndexer({ + [a]: "" +}); // Should return string +extractIndexer({ + [0 /* x */]: "" +}); // Should return string +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames48.types b/tests/baselines/reference/computedPropertyNames48.types new file mode 100644 index 00000000000..78755d5d5d7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts === +declare function extractIndexer(p: { [n: number]: T }): T; +>extractIndexer : (p: { [n: number]: T; }) => T +>T : T +>p : { [n: number]: T; } +>n : number +>T : T +>T : T + +enum E { x } +>E : E +>x : E + +var a: any; +>a : any + +extractIndexer({ +>extractIndexer({ [a]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [a]: ""} : { [x: number]: string; } + + [a]: "" +>a : any + +}); // Should return string + +extractIndexer({ +>extractIndexer({ [E.x]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [E.x]: ""} : { [x: number]: string; } + + [E.x]: "" +>E.x : E +>E : typeof E +>x : E + +}); // Should return string + +extractIndexer({ +>extractIndexer({ ["" || 0]: ""}) : any +>extractIndexer : (p: { [n: number]: T; }) => T +>{ ["" || 0]: ""} : { [x: number]: undefined; } + + ["" || 0]: "" +>"" || 0 : string | number + +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5.errors.txt new file mode 100644 index 00000000000..2b8cf5503b8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== + var b: boolean; + var v = { + [b]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [true]: 1, + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [[]]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [{}]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [undefined]: undefined, + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [null]: null + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5.js b/tests/baselines/reference/computedPropertyNames5.js new file mode 100644 index 00000000000..d0158da6400 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5.js @@ -0,0 +1,21 @@ +//// [computedPropertyNames5.ts] +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} + +//// [computedPropertyNames5.js] +var b; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +}; diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6.errors.txt new file mode 100644 index 00000000000..57798e9f6b6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + var v = { + [p1]: 0, + [p2]: 1, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [p3]: 2 + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6.js b/tests/baselines/reference/computedPropertyNames6.js new file mode 100644 index 00000000000..e131ef4417f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames6.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} + +//// [computedPropertyNames6.js] +var p1; +var p2; +var p3; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +}; diff --git a/tests/baselines/reference/computedPropertyNames7.js b/tests/baselines/reference/computedPropertyNames7.js new file mode 100644 index 00000000000..075b149522b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7.js @@ -0,0 +1,16 @@ +//// [computedPropertyNames7.ts] +enum E { + member +} +var v = { + [E.member]: 0 +} + +//// [computedPropertyNames7.js] +var E; +(function (E) { + E[E["member"] = 0] = "member"; +})(E || (E = {})); +var v = { + [0 /* member */]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames7.types b/tests/baselines/reference/computedPropertyNames7.types new file mode 100644 index 00000000000..0b5f26614fc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts === +enum E { +>E : E + + member +>member : E +} +var v = { +>v : {} +>{ [E.member]: 0} : {} + + [E.member]: 0 +>E.member : E +>E : typeof E +>member : E +} diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8.errors.txt new file mode 100644 index 00000000000..515af1f4fc4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== + function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [u]: 1 + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + }; + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8.js b/tests/baselines/reference/computedPropertyNames8.js new file mode 100644 index 00000000000..44a21d79a1c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames8.ts] +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} + +//// [computedPropertyNames8.js] +function f() { + var t; + var u; + var v = { + [t]: 0, + [u]: 1 + }; +} diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9.errors.txt new file mode 100644 index 00000000000..d87576f1f77 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== + function f(s: string): string; + function f(n: number): number; + function f(x: T): T; + function f(x): any { } + + var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 + ~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9.js b/tests/baselines/reference/computedPropertyNames9.js new file mode 100644 index 00000000000..ede8bb3012b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames9.ts] +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} + +//// [computedPropertyNames9.js] +function f(x) { +} +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.js b/tests/baselines/reference/computedPropertyNamesContextualType1.js new file mode 100644 index 00000000000..82429be9c40 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesContextualType1.ts] +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} + +//// [computedPropertyNamesContextualType1.js] +var o = { + ["" + 0](y) { + return y.length; + }, + ["" + 1]: y => { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.types b/tests/baselines/reference/computedPropertyNamesContextualType1.types new file mode 100644 index 00000000000..1697542fba6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string + + [s: number]: (x: any) => number; // Doesn't get hit +>s : number +>x : any +} + +var o: I = { +>o : I +>I : I +>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; } + + ["" + 0](y) { return y.length; }, +>"" + 0 : string +>y : string +>y.length : number +>y : string +>length : number + + ["" + 1]: y => y.length +>"" + 1 : string +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt new file mode 100644 index 00000000000..5e9fbe7b45b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts (1 errors) ==== + interface I { + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.js b/tests/baselines/reference/computedPropertyNamesContextualType10.js new file mode 100644 index 00000000000..125a014852e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10.js @@ -0,0 +1,15 @@ +//// [computedPropertyNamesContextualType10.ts] +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType10.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.js b/tests/baselines/reference/computedPropertyNamesContextualType2.js new file mode 100644 index 00000000000..028e797be18 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesContextualType2.ts] +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType2.js] +var o = { + [+"foo"](y) { + return y.length; + }, + [+"bar"]: y => { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.types b/tests/baselines/reference/computedPropertyNamesContextualType2.types new file mode 100644 index 00000000000..408fd6a5062 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts === +interface I { +>I : I + + [s: string]: (x: any) => number; // Doesn't get hit +>s : string +>x : any + + [s: number]: (x: string) => number; +>s : number +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.js b/tests/baselines/reference/computedPropertyNamesContextualType3.js new file mode 100644 index 00000000000..944bb3595d4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType3.ts] +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType3.js] +var o = { + [+"foo"](y) { + return y.length; + }, + [+"bar"]: y => { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.types b/tests/baselines/reference/computedPropertyNamesContextualType3.types new file mode 100644 index 00000000000..a1a36c1b7e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.js b/tests/baselines/reference/computedPropertyNamesContextualType4.js new file mode 100644 index 00000000000..6ddd22baf6e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType4.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType4.js] +var o = { + ["" + "foo"]: "", + ["" + "bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.types b/tests/baselines/reference/computedPropertyNamesContextualType4.types new file mode 100644 index 00000000000..d22f56f24fe --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; } + + [""+"foo"]: "", +>""+"foo" : string + + [""+"bar"]: 0 +>""+"bar" : string +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.js b/tests/baselines/reference/computedPropertyNamesContextualType5.js new file mode 100644 index 00000000000..f2bd79644a0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType5.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.types b/tests/baselines/reference/computedPropertyNamesContextualType5.types new file mode 100644 index 00000000000..12c3332acfa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; } + + [+"foo"]: "", +>+"foo" : number + + [+"bar"]: 0 +>+"bar" : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.js b/tests/baselines/reference/computedPropertyNamesContextualType6.js new file mode 100644 index 00000000000..a92958871d9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6.js @@ -0,0 +1,24 @@ +//// [computedPropertyNamesContextualType6.ts] +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType6.js] +foo({ + p: "", + 0: () => { + }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types b/tests/baselines/reference/computedPropertyNamesContextualType6.types new file mode 100644 index 00000000000..acbae75ad4c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull new file mode 100644 index 00000000000..a7a65d6618d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.js b/tests/baselines/reference/computedPropertyNamesContextualType7.js new file mode 100644 index 00000000000..00103bc76db --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7.js @@ -0,0 +1,24 @@ +//// [computedPropertyNamesContextualType7.ts] +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType7.js] +foo({ + p: "", + 0: () => { + }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types b/tests/baselines/reference/computedPropertyNamesContextualType7.types new file mode 100644 index 00000000000..da059d490b0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull new file mode 100644 index 00000000000..ff68ec8d0b0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt new file mode 100644 index 00000000000..07b55b799e4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [""+"foo"]: "", + [""+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.js b/tests/baselines/reference/computedPropertyNamesContextualType8.js new file mode 100644 index 00000000000..d98538c40c1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType8.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType8.js] +var o = { + ["" + "foo"]: "", + ["" + "bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt new file mode 100644 index 00000000000..6a1d9316fd7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.js b/tests/baselines/reference/computedPropertyNamesContextualType9.js new file mode 100644 index 00000000000..ed8791a51e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType9.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType9.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js new file mode 100644 index 00000000000..bc8b5d0e910 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js @@ -0,0 +1,33 @@ +//// [computedPropertyNamesDeclarationEmit1.ts] +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit1.js] +var C = (function () { + function C() { + } + C.prototype["" + ""] = function () { + }; + Object.defineProperty(C.prototype, "" + "", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "" + "", { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit1.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types new file mode 100644 index 00000000000..e8e184a652e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts === +class C { +>C : C + + ["" + ""]() { } +>"" + "" : string + + get ["" + ""]() { return 0; } +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js new file mode 100644 index 00000000000..647f3fab135 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js @@ -0,0 +1,33 @@ +//// [computedPropertyNamesDeclarationEmit2.ts] +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit2.js] +var C = (function () { + function C() { + } + C["" + ""] = function () { + }; + Object.defineProperty(C, "" + "", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "" + "", { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit2.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types new file mode 100644 index 00000000000..df1da17abea --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts === +class C { +>C : C + + static ["" + ""]() { } +>"" + "" : string + + static get ["" + ""]() { return 0; } +>"" + "" : string + + static set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt new file mode 100644 index 00000000000..69ff2b9e452 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: Computed property names are not allowed in interfaces. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js new file mode 100644 index 00000000000..affe949797e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js @@ -0,0 +1,11 @@ +//// [computedPropertyNamesDeclarationEmit3.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3.js] + + +//// [computedPropertyNamesDeclarationEmit3.d.ts] +interface I { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt new file mode 100644 index 00000000000..53eb057f8a1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: Computed property names are not allowed in type literals. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js new file mode 100644 index 00000000000..f68c1633ef9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js @@ -0,0 +1,12 @@ +//// [computedPropertyNamesDeclarationEmit4.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4.js] +var v; + + +//// [computedPropertyNamesDeclarationEmit4.d.ts] +declare var v: { +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js new file mode 100644 index 00000000000..d7ac3319eca --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNamesDeclarationEmit5.ts] +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit5.js] +var v = { + ["" + ""]: 0, + ["" + ""]() { + }, + get ["" + ""]() { + return 0; + }, + set ["" + ""](x) { + } +}; + + +//// [computedPropertyNamesDeclarationEmit5.d.ts] +declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types new file mode 100644 index 00000000000..c63d6d0d5c3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts === +var v = { +>v : {} +>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} + + ["" + ""]: 0, +>"" + "" : string + + ["" + ""]() { }, +>"" + "" : string + + get ["" + ""]() { return 0; }, +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt index 6329ab39f0f..b3c2957a13f 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt @@ -1,9 +1,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(6,5): error TS9002: Computed property names are not currently supported. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { @@ -14,6 +13,4 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads. ~~~~~~~~~~~~ !!! error TS1168: Computed property names are not allowed in method overloads. [methodName](v?: string) { } - ~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.js b/tests/baselines/reference/computedPropertyNamesOnOverloads.js new file mode 100644 index 00000000000..1db857620e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads.js @@ -0,0 +1,19 @@ +//// [computedPropertyNamesOnOverloads.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} + +//// [computedPropertyNamesOnOverloads.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function (v) { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js b/tests/baselines/reference/computedPropertyNamesSourceMap1.js new file mode 100644 index 00000000000..b65e3f0ce5b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesSourceMap1.ts] +class C { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap1.js] +var C = (function () { + function C() { + } + C.prototype["hello"] = function () { + debugger; + }; + return C; +})(); +//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map new file mode 100644 index 00000000000..5833df72f7f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt new file mode 100644 index 00000000000..e806eee1aa7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap1.js +mapUrl: computedPropertyNamesSourceMap1.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap1.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.js +sourceFile:computedPropertyNamesSourceMap1.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^-> +1 > +2 >class +3 > C +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +1-> +2 > class +3 > C +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (C) +3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (C) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > ["hello"]() { + > debugger; + > } + > +2 > } +1 >Emitted(3, 5) Source(5, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) name (C.constructor) +--- +>>> C.prototype["hello"] = function () { +1->^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^ +1-> +2 > [ +3 > "hello" +4 > ] +5 > +1->Emitted(4, 5) Source(2, 5) + SourceIndex(0) name (C) +2 >Emitted(4, 17) Source(2, 6) + SourceIndex(0) name (C) +3 >Emitted(4, 24) Source(2, 13) + SourceIndex(0) name (C) +4 >Emitted(4, 25) Source(2, 14) + SourceIndex(0) name (C) +5 >Emitted(4, 28) Source(2, 5) + SourceIndex(0) name (C) +--- +>>> debugger; +1 >^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >["hello"]() { + > +2 > debugger +3 > ; +1 >Emitted(5, 9) Source(3, 9) + SourceIndex(0) name (C["hello"]) +2 >Emitted(5, 17) Source(3, 17) + SourceIndex(0) name (C["hello"]) +3 >Emitted(5, 18) Source(3, 18) + SourceIndex(0) name (C["hello"]) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) name (C["hello"]) +2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) name (C["hello"]) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > ["hello"]() { + > debugger; + > } + > } +1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) name (C) +3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.types b/tests/baselines/reference/computedPropertyNamesSourceMap1.types new file mode 100644 index 00000000000..54a2a9f19d0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts === +class C { +>C : C + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js b/tests/baselines/reference/computedPropertyNamesSourceMap2.js new file mode 100644 index 00000000000..d967cb0d468 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2.js] +var v = { + ["hello"]() { + debugger; + } +}; +//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map new file mode 100644 index 00000000000..6c485c24f6f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt new file mode 100644 index 00000000000..29f11b95e1f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt @@ -0,0 +1,73 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap2.js +mapUrl: computedPropertyNamesSourceMap2.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.js +sourceFile:computedPropertyNamesSourceMap2.ts +------------------------------------------------------------------- +>>>var v = { +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^-> +1 > +2 >var +3 > v +4 > = +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +--- +>>> ["hello"]() { +1->^^^^ +2 > ^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^^^-> +1->{ + > +2 > [ +3 > "hello" +4 > ] +1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +--- +>>> debugger; +1->^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1->() { + > +2 > debugger +3 > ; +1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"]) +2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"]) +3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"]) +--- +>>> } +1 >^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"]) +2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"]) +--- +>>>}; +1 >^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +2 > +1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) +2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.types b/tests/baselines/reference/computedPropertyNamesSourceMap2.types new file mode 100644 index 00000000000..972259eb3e2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts === +var v = { +>v : {} +>{ ["hello"]() { debugger; }} : {} + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/conflictMarkerTrivia1.js b/tests/baselines/reference/conflictMarkerTrivia1.js new file mode 100644 index 00000000000..68f1b82d38b --- /dev/null +++ b/tests/baselines/reference/conflictMarkerTrivia1.js @@ -0,0 +1,16 @@ +//// [conflictMarkerTrivia1.ts] +class C { +<<<<<<< HEAD + v = 1; +======= + v = 2; +>>>>>>> Branch-a +} + +//// [conflictMarkerTrivia1.js] +var C = (function () { + function C() { + this.v = 1; + } + return C; +})(); diff --git a/tests/baselines/reference/conflictMarkerTrivia2.js b/tests/baselines/reference/conflictMarkerTrivia2.js new file mode 100644 index 00000000000..bbb631de388 --- /dev/null +++ b/tests/baselines/reference/conflictMarkerTrivia2.js @@ -0,0 +1,26 @@ +//// [conflictMarkerTrivia2.ts] +class C { + foo() { +<<<<<<< B + a(); + } +======= + b(); + } +>>>>>>> A + + public bar() { } +} + + +//// [conflictMarkerTrivia2.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + a(); + }; + C.prototype.bar = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.js b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.js new file mode 100644 index 00000000000..9fcc9f8f568 --- /dev/null +++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.js @@ -0,0 +1,43 @@ +//// [constDeclarationShadowedByVarDeclaration.ts] + +// Error as declaration of var would cause a write to the const value +var x = 0; +{ + const x = 0; + + var x = 0; +} + + +var y = 0; +{ + const y = 0; + { + var y = 0; + } +} + + +{ + const z = 0; + var z = 0 +} + +//// [constDeclarationShadowedByVarDeclaration.js] +// Error as declaration of var would cause a write to the const value +var x = 0; +{ + const x = 0; + var x = 0; +} +var y = 0; +{ + const y = 0; + { + var y = 0; + } +} +{ + const z = 0; + var z = 0; +} diff --git a/tests/baselines/reference/constDeclarations-access.js b/tests/baselines/reference/constDeclarations-access.js new file mode 100644 index 00000000000..ba913f2d5fc --- /dev/null +++ b/tests/baselines/reference/constDeclarations-access.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/constDeclarations-access.ts] //// + +//// [file1.ts] + +const x = 0 + +//// [file2.ts] +x++; + +//// [file1.js] +const x = 0; +//// [file2.js] +x++; diff --git a/tests/baselines/reference/constDeclarations-access2.js b/tests/baselines/reference/constDeclarations-access2.js new file mode 100644 index 00000000000..fd51c932636 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-access2.js @@ -0,0 +1,74 @@ +//// [constDeclarations-access2.ts] + +const x = 0 + +// Errors +x = 1; +x += 2; +x -= 3; +x *= 4; +x /= 5; +x %= 6; +x <<= 7; +x >>= 8; +x >>>= 9; +x &= 10; +x |= 11; +x ^= 12; + +x++; +x--; +++x; +--x; + +++((x)); + +// OK +var a = x + 1; + +function f(v: number) { } +f(x); + +if (x) { } + +x; +(x); + +-x; ++x; + +x.toString(); + + +//// [constDeclarations-access2.js] +const x = 0; +// Errors +x = 1; +x += 2; +x -= 3; +x *= 4; +x /= 5; +x %= 6; +x <<= 7; +x >>= 8; +x >>>= 9; +x &= 10; +x |= 11; +x ^= 12; +x++; +x--; +++x; +--x; +++((x)); +// OK +var a = x + 1; +function f(v) { +} +f(x); +if (x) { +} +x; +(x); +-x; ++x; +x.toString(); diff --git a/tests/baselines/reference/constDeclarations-access3.js b/tests/baselines/reference/constDeclarations-access3.js new file mode 100644 index 00000000000..9ac4880bdd1 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-access3.js @@ -0,0 +1,83 @@ +//// [constDeclarations-access3.ts] + + +module M { + export const x = 0; +} + +// Errors +M.x = 1; +M.x += 2; +M.x -= 3; +M.x *= 4; +M.x /= 5; +M.x %= 6; +M.x <<= 7; +M.x >>= 8; +M.x >>>= 9; +M.x &= 10; +M.x |= 11; +M.x ^= 12; + +M.x++; +M.x--; +++M.x; +--M.x; + +++((M.x)); + +M["x"] = 0; + +// OK +var a = M.x + 1; + +function f(v: number) { } +f(M.x); + +if (M.x) { } + +M.x; +(M.x); + +-M.x; ++M.x; + +M.x.toString(); + + +//// [constDeclarations-access3.js] +var M; +(function (M) { + M.x = 0; +})(M || (M = {})); +// Errors +M.x = 1; +M.x += 2; +M.x -= 3; +M.x *= 4; +M.x /= 5; +M.x %= 6; +M.x <<= 7; +M.x >>= 8; +M.x >>>= 9; +M.x &= 10; +M.x |= 11; +M.x ^= 12; +M.x++; +M.x--; +++M.x; +--M.x; +++((M.x)); +M["x"] = 0; +// OK +var a = M.x + 1; +function f(v) { +} +f(M.x); +if (M.x) { +} +M.x; +(M.x); +-M.x; ++M.x; +M.x.toString(); diff --git a/tests/baselines/reference/constDeclarations-access4.js b/tests/baselines/reference/constDeclarations-access4.js new file mode 100644 index 00000000000..b226e746bba --- /dev/null +++ b/tests/baselines/reference/constDeclarations-access4.js @@ -0,0 +1,79 @@ +//// [constDeclarations-access4.ts] + + +declare module M { + const x: number; +} + +// Errors +M.x = 1; +M.x += 2; +M.x -= 3; +M.x *= 4; +M.x /= 5; +M.x %= 6; +M.x <<= 7; +M.x >>= 8; +M.x >>>= 9; +M.x &= 10; +M.x |= 11; +M.x ^= 12; + +M.x++; +M.x--; +++M.x; +--M.x; + +++((M.x)); + +M["x"] = 0; + +// OK +var a = M.x + 1; + +function f(v: number) { } +f(M.x); + +if (M.x) { } + +M.x; +(M.x); + +-M.x; ++M.x; + +M.x.toString(); + + +//// [constDeclarations-access4.js] +// Errors +M.x = 1; +M.x += 2; +M.x -= 3; +M.x *= 4; +M.x /= 5; +M.x %= 6; +M.x <<= 7; +M.x >>= 8; +M.x >>>= 9; +M.x &= 10; +M.x |= 11; +M.x ^= 12; +M.x++; +M.x--; +++M.x; +--M.x; +++((M.x)); +M["x"] = 0; +// OK +var a = M.x + 1; +function f(v) { +} +f(M.x); +if (M.x) { +} +M.x; +(M.x); +-M.x; ++M.x; +M.x.toString(); diff --git a/tests/baselines/reference/constDeclarations-access5.js b/tests/baselines/reference/constDeclarations-access5.js new file mode 100644 index 00000000000..7acc95ad055 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-access5.js @@ -0,0 +1,89 @@ +//// [tests/cases/compiler/constDeclarations-access5.ts] //// + +//// [constDeclarations_access_1.ts] + + +export const x = 0; + +//// [constDeclarations_access_2.ts] +/// +import m = require('constDeclarations_access_1'); +// Errors +m.x = 1; +m.x += 2; +m.x -= 3; +m.x *= 4; +m.x /= 5; +m.x %= 6; +m.x <<= 7; +m.x >>= 8; +m.x >>>= 9; +m.x &= 10; +m.x |= 11; +m.x ^= 12; +m +m.x++; +m.x--; +++m.x; +--m.x; + +++((m.x)); + +m["x"] = 0; + +// OK +var a = m.x + 1; + +function f(v: number) { } +f(m.x); + +if (m.x) { } + +m.x; +(m.x); + +-m.x; ++m.x; + +m.x.toString(); + + +//// [constDeclarations_access_1.js] +define(["require", "exports"], function (require, exports) { + exports.x = 0; +}); +//// [constDeclarations_access_2.js] +define(["require", "exports", 'constDeclarations_access_1'], function (require, exports, m) { + // Errors + m.x = 1; + m.x += 2; + m.x -= 3; + m.x *= 4; + m.x /= 5; + m.x %= 6; + m.x <<= 7; + m.x >>= 8; + m.x >>>= 9; + m.x &= 10; + m.x |= 11; + m.x ^= 12; + m; + m.x++; + m.x--; + ++m.x; + --m.x; + ++((m.x)); + m["x"] = 0; + // OK + var a = m.x + 1; + function f(v) { + } + f(m.x); + if (m.x) { + } + m.x; + (m.x); + -m.x; + +m.x; + m.x.toString(); +}); diff --git a/tests/baselines/reference/constDeclarations-ambient-errors.js b/tests/baselines/reference/constDeclarations-ambient-errors.js new file mode 100644 index 00000000000..e6e7ac1fb16 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-ambient-errors.js @@ -0,0 +1,13 @@ +//// [constDeclarations-ambient-errors.ts] + +// error: no intialization expected in ambient declarations +declare const c1: boolean = true; +declare const c2: number = 0; +declare const c3 = null, c4 :string = "", c5: any = 0; + +declare module M { + const c6 = 0; + const c7: number = 7; +} + +//// [constDeclarations-ambient-errors.js] diff --git a/tests/baselines/reference/constDeclarations-errors.js b/tests/baselines/reference/constDeclarations-errors.js new file mode 100644 index 00000000000..0af646010f0 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-errors.js @@ -0,0 +1,36 @@ +//// [constDeclarations-errors.ts] + +// error, missing intialicer +const c1; +const c2: number; +const c3, c4, c5 :string, c6; // error, missing initialicer + +// error, can not be unintalized +for(const c in {}) { } + +// error, assigning to a const +for(const c8 = 0; c8 < 1; c8++) { } + +// error, can not be unintalized +for(const c9; c9 < 1;) { } + +// error, can not be unintalized +for(const c10 = 0, c11; c10 < 1;) { } + +//// [constDeclarations-errors.js] +// error, missing intialicer +const c1; +const c2; +const c3, c4, c5, c6; // error, missing initialicer +// error, can not be unintalized +for (var c in {}) { +} +// error, assigning to a const +for (const c8 = 0; c8 < 1; c8++) { +} +// error, can not be unintalized +for (const c9; c9 < 1;) { +} +// error, can not be unintalized +for (const c10 = 0, c11; c10 < 1;) { +} diff --git a/tests/baselines/reference/constDeclarations-es5.js b/tests/baselines/reference/constDeclarations-es5.js new file mode 100644 index 00000000000..20deb9dca37 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-es5.js @@ -0,0 +1,11 @@ +//// [constDeclarations-es5.ts] + +const z7 = false; +const z8: number = 23; +const z9 = 0, z10 :string = "", z11 = null; + + +//// [constDeclarations-es5.js] +const z7 = false; +const z8 = 23; +const z9 = 0, z10 = "", z11 = null; diff --git a/tests/baselines/reference/constDeclarations-invalidContexts.js b/tests/baselines/reference/constDeclarations-invalidContexts.js new file mode 100644 index 00000000000..a9dc1b47145 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-invalidContexts.js @@ -0,0 +1,57 @@ +//// [constDeclarations-invalidContexts.ts] + +// Errors, const must be defined inside a block +if (true) + const c1 = 0; +else + const c2 = 0; + +while (true) + const c3 = 0; + +do + const c4 = 0; +while (true); + +var obj; +with (obj) + const c5 = 0; // No Error will be reported here since we turn off all type checking + +for (var i = 0; i < 10; i++) + const c6 = 0; + +for (var i2 in {}) + const c7 = 0; + +if (true) + label: const c8 = 0; + +while (false) + label2: label3: label4: const c9 = 0; + + + + + +//// [constDeclarations-invalidContexts.js] +// Errors, const must be defined inside a block +if (true) + const c1 = 0; +else + const c2 = 0; +while (true) + const c3 = 0; +do + const c4 = 0; +while (true); +var obj; +with (obj) + const c5 = 0; // No Error will be reported here since we turn off all type checking +for (var i = 0; i < 10; i++) + const c6 = 0; +for (var i2 in {}) + const c7 = 0; +if (true) + label: const c8 = 0; +while (false) + label2: label3: label4: const c9 = 0; diff --git a/tests/baselines/reference/constDeclarations-scopes.js b/tests/baselines/reference/constDeclarations-scopes.js index aa1d59aee81..f8fbc47312b 100644 --- a/tests/baselines/reference/constDeclarations-scopes.js +++ b/tests/baselines/reference/constDeclarations-scopes.js @@ -189,6 +189,7 @@ while (false) { label2: label3: label4: const c = 0; n = c; } +// Try/catch/finally try { const c = 0; n = c; @@ -201,12 +202,14 @@ finally { const c = 0; n = c; } +// Switch switch (0) { case 0: const c = 0; n = c; break; } +// blocks { const c = 0; n = c; @@ -220,7 +223,7 @@ function F() { const c = 0; n = c; } -var F2 = function () { +var F2 = () => { const c = 0; n = c; }; @@ -269,7 +272,7 @@ var o = { const c = 0; n = c; }, - f2: function () { + f2: () => { const c = 0; n = c; } diff --git a/tests/baselines/reference/constDeclarations-scopes2.js b/tests/baselines/reference/constDeclarations-scopes2.js index 1d0f252ab4f..d407cf56801 100644 --- a/tests/baselines/reference/constDeclarations-scopes2.js +++ b/tests/baselines/reference/constDeclarations-scopes2.js @@ -20,6 +20,7 @@ for (const c = 0; c < 10; n = c ) { const c = "string"; var n; var b; +// for scope for (const c = 0; c < 10; n = c) { // for block const c = false; diff --git a/tests/baselines/reference/constDeclarations-useBeforeDefinition.js b/tests/baselines/reference/constDeclarations-useBeforeDefinition.js new file mode 100644 index 00000000000..4fe0e64f275 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-useBeforeDefinition.js @@ -0,0 +1,24 @@ +//// [constDeclarations-useBeforeDefinition.ts] + +{ + c1; + const c1 = 0; +} + +var v1; +{ + v1; + const v1 = 0; +} + + +//// [constDeclarations-useBeforeDefinition.js] +{ + c1; + const c1 = 0; +} +var v1; +{ + v1; + const v1 = 0; +} diff --git a/tests/baselines/reference/constDeclarations-useBeforeDefinition2.js b/tests/baselines/reference/constDeclarations-useBeforeDefinition2.js new file mode 100644 index 00000000000..7d1f4cf5725 --- /dev/null +++ b/tests/baselines/reference/constDeclarations-useBeforeDefinition2.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/constDeclarations-useBeforeDefinition2.ts] //// + +//// [file1.ts] + +c; + +//// [file2.ts] +const c = 0; + +//// [out.js] +c; +const c = 0; diff --git a/tests/baselines/reference/constDeclarations-validContexts.js b/tests/baselines/reference/constDeclarations-validContexts.js index 8be43633d70..5a54e915713 100644 --- a/tests/baselines/reference/constDeclarations-validContexts.js +++ b/tests/baselines/reference/constDeclarations-validContexts.js @@ -153,6 +153,7 @@ if (true) { while (false) { label2: label3: label4: const c9 = 0; } +// Try/catch/finally try { const c10 = 0; } @@ -162,6 +163,7 @@ catch (e) { finally { const c12 = 0; } +// Switch switch (0) { case 0: const c13 = 0; @@ -170,6 +172,7 @@ switch (0) { const c14 = 0; break; } +// blocks { const c15 = 0; { @@ -183,7 +186,7 @@ const c18 = 0; function F() { const c19 = 0; } -var F2 = function () { +var F2 = () => { const c20 = 0; }; var F3 = function () { @@ -223,7 +226,7 @@ var o = { f() { const c28 = 0; }, - f2: function () { + f2: () => { const c29 = 0; } }; diff --git a/tests/baselines/reference/constEnumBadPropertyNames.js b/tests/baselines/reference/constEnumBadPropertyNames.js new file mode 100644 index 00000000000..b73eed780e5 --- /dev/null +++ b/tests/baselines/reference/constEnumBadPropertyNames.js @@ -0,0 +1,6 @@ +//// [constEnumBadPropertyNames.ts] +const enum E { A } +var x = E["B"] + +//// [constEnumBadPropertyNames.js] +var x = E["B"]; diff --git a/tests/baselines/reference/constEnumErrors.js b/tests/baselines/reference/constEnumErrors.js new file mode 100644 index 00000000000..4afd98982f0 --- /dev/null +++ b/tests/baselines/reference/constEnumErrors.js @@ -0,0 +1,58 @@ +//// [constEnumErrors.ts] +const enum E { + A +} + +module E { + var x = 1; +} + +const enum E1 { + // illegal case + // forward reference to the element of the same enum + X = Y, + // forward reference to the element of the same enum + Y = E1.Z, + Y1 = E1["Z"] +} + +const enum E2 { + A +} + +var y0 = E2[1] +var name = "A"; +var y1 = E2[name]; + +var x = E2; +var y = [E2]; + +function foo(t: any): void { +} + +foo(E2); + +const enum NaNOrInfinity { + A = 9007199254740992, + B = A * A, + C = B * B, + D = C * C, + E = D * D, + F = E * E, // overflow + G = 1 / 0, // overflow + H = 0 / 0 // NaN +} + +//// [constEnumErrors.js] +var E; +(function (E) { + var x = 1; +})(E || (E = {})); +var y0 = E2[1]; +var name = "A"; +var y1 = E2[name]; +var x = E2; +var y = [E2]; +function foo(t) { +} +foo(E2); diff --git a/tests/baselines/reference/constructorArgsErrors1.js b/tests/baselines/reference/constructorArgsErrors1.js new file mode 100644 index 00000000000..25701901e13 --- /dev/null +++ b/tests/baselines/reference/constructorArgsErrors1.js @@ -0,0 +1,12 @@ +//// [constructorArgsErrors1.ts] +class foo { + constructor (static a: number) { + } +} + +//// [constructorArgsErrors1.js] +var foo = (function () { + function foo(a) { + } + return foo; +})(); diff --git a/tests/baselines/reference/constructorArgsErrors2.js b/tests/baselines/reference/constructorArgsErrors2.js new file mode 100644 index 00000000000..a0cab9f39f8 --- /dev/null +++ b/tests/baselines/reference/constructorArgsErrors2.js @@ -0,0 +1,14 @@ +//// [constructorArgsErrors2.ts] +class foo { + constructor (public static a: number) { + } +} + + +//// [constructorArgsErrors2.js] +var foo = (function () { + function foo(a) { + this.a = a; + } + return foo; +})(); diff --git a/tests/baselines/reference/constructorArgsErrors3.js b/tests/baselines/reference/constructorArgsErrors3.js new file mode 100644 index 00000000000..3f9b09254a1 --- /dev/null +++ b/tests/baselines/reference/constructorArgsErrors3.js @@ -0,0 +1,14 @@ +//// [constructorArgsErrors3.ts] +class foo { + constructor (public public a: number) { + } +} + + +//// [constructorArgsErrors3.js] +var foo = (function () { + function foo(a) { + this.a = a; + } + return foo; +})(); diff --git a/tests/baselines/reference/constructorArgsErrors4.js b/tests/baselines/reference/constructorArgsErrors4.js new file mode 100644 index 00000000000..c0646a54148 --- /dev/null +++ b/tests/baselines/reference/constructorArgsErrors4.js @@ -0,0 +1,14 @@ +//// [constructorArgsErrors4.ts] +class foo { + constructor (private public a: number) { + } +} + + +//// [constructorArgsErrors4.js] +var foo = (function () { + function foo(a) { + this.a = a; + } + return foo; +})(); diff --git a/tests/baselines/reference/constructorArgsErrors5.js b/tests/baselines/reference/constructorArgsErrors5.js new file mode 100644 index 00000000000..3455490aa6f --- /dev/null +++ b/tests/baselines/reference/constructorArgsErrors5.js @@ -0,0 +1,13 @@ +//// [constructorArgsErrors5.ts] +class foo { + constructor (export a: number) { + } +} + + +//// [constructorArgsErrors5.js] +var foo = (function () { + function foo(a) { + } + return foo; +})(); diff --git a/tests/baselines/reference/constructorOverloads6.js b/tests/baselines/reference/constructorOverloads6.js new file mode 100644 index 00000000000..1996449165c --- /dev/null +++ b/tests/baselines/reference/constructorOverloads6.js @@ -0,0 +1,32 @@ +//// [constructorOverloads6.ts] +declare class FooBase { + constructor(s: string); + constructor(n: number); + constructor(x: any) { + + } + bar1():void; +} + + declare class Foo extends FooBase { + constructor(s: string); + constructor(n: number); + constructor(x: any, y?:any); + + bar1():void; +} + +var f1 = new Foo("hey"); +var f2 = new Foo(0); +var f3 = new Foo(f1); +var f4 = new Foo([f1,f2,f3]); + +f1.bar1(); + + +//// [constructorOverloads6.js] +var f1 = new Foo("hey"); +var f2 = new Foo(0); +var f3 = new Foo(f1); +var f4 = new Foo([f1, f2, f3]); +f1.bar1(); diff --git a/tests/baselines/reference/constructorStaticParamNameErrors.js b/tests/baselines/reference/constructorStaticParamNameErrors.js new file mode 100644 index 00000000000..0bb8985545c --- /dev/null +++ b/tests/baselines/reference/constructorStaticParamNameErrors.js @@ -0,0 +1,15 @@ +//// [constructorStaticParamNameErrors.ts] +'use strict' +// static as constructor parameter name should give error if 'use strict' +class test { + constructor (static) { } +} + +//// [constructorStaticParamNameErrors.js] +'use strict'; +// static as constructor parameter name should give error if 'use strict' +var test = (function () { + function test() { + } + return test; +})(); diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js new file mode 100644 index 00000000000..5a9a03f293c --- /dev/null +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -0,0 +1,569 @@ +//// [constructorWithIncompleteTypeAnnotation.ts] +declare module "fs" { + export class File { + constructor(filename: string); + public ReadAllText(): string; + } + export interface IFile { + [index: number]: string; + } +} + +import fs = module("fs"); + + +module TypeScriptAllInOne { + export class Program { + static Main(...args: string[]) { + try { + var bfs = new BasicFeatures(); + var retValue: number = 0; + + retValue = bfs.VARIABLES(); + if (retValue != 0 ^= { + + return 1; + } + + case = bfs.STATEMENTS(4); + if (retValue != 0) { + + return 1; + ^ + + + retValue = bfs.TYPES(); + if (retValue != 0) { + + return 1 && + } + + retValue = bfs.OPERATOR ' ); + if (retValue != 0) { + + return 1; + } + } + catch (e) { + console.log(e); + } + finally { + + } + + console.log('Done'); + + return 0; + + } + } + + class BasicFeatures { + /// + /// Test various of variables. Including nullable,key world as variable,special format + /// + /// + public VARIABLES(): number { + var local = Number.MAX_VALUE; + var min = Number.MIN_VALUE; + var inf = Number.NEGATIVE_INFINITY - + var nan = Number.NaN; + var undef = undefined; + + var _\uD4A5\u7204\uC316\uE59F = local; + var мир = local; + + var local5 = null; + var local6 = local5 instanceof fs.File; + + var hex = 0xBADC0DE, Hex = 0XDEADBEEF; + var float = 6.02e23, float2 = 6.02E-23 + var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != + var quoted = '"', quoted2 = "'"; + var reg = /\w*/; + var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, instanceof : () => 'objLit{42}' }; + var weekday = Weekdays.Monday; + + var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; + + // + var any = 0 ^= + var bool = 0; + var declare = 0; + var constructor = 0; + var get = 0; + var implements = 0; + var interface = 0; + var let = 0; + var module = 0; + var number = 0; + var package = 0; + var private = 0; + var protected = 0; + var public = 0; + var set = 0; + var static = 0; + var string = 0 /> + var yield = 0; + + var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; + + return 0; + } + + /// + /// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally + /// + /// + /// + STATEMENTS(i: number): number { + var retVal = 0; + if (i == 1) + retVal = 1; + else + retVal = 0; + switch (i) { + case 2: + retVal = 1; + break; + case 3: + retVal = 1; + break; + default: + break; + } + + for (var x in { x: 0, y: 1 }) { + ! + + try { + throw null; + } + catch (Exception) ? + } + finally { + try { } + catch (Exception) { } + } + + return retVal; + } + + /// + /// Test types in ts language. Including class,struct,interface,delegate,anonymous type + /// + /// + public TYPES(): number { + var retVal = 0; + var c = new CLASS(); + var xx: IF = c; + retVal += catch .Property; + retVal += c.Member(); + retVal += xx.Foo() ? 0 : 1; + + //anonymous type + var anony = { a: new CLASS() }; + + retVal += anony.a.d(); + + return retVal; + } + + + ///// + ///// Test different operators + ///// + ///// + public OPERATOR(): number { + var a: number[] = [1, 2, 3, 4, 5, ];/*[] bug*/ // YES [] + var i = a[1];/*[]*/ + i = i + i - i * i / i % i & i | i ^ i;/*+ - * / % & | ^*/ + var b = true && false || true ^ false;/*& | ^*/ + b = !b;/*!*/ + i = ~i;/*~i*/ + b = i < (i - 1) && (i + 1) > i;/*< && >*/ + var f = true ? 1 : 0;/*? :*/ // YES : + i++;/*++*/ + i--;/*--*/ + b = true && false || true;/*&& ||*/ + i = i << 5;/*<<*/ + i = i >> 5;/*>>*/ + var j = i; + b = i == j && i != j && i <= j && i >= j;/*= == && != <= >=*/ + i += 5.0;/*+=*/ + i -= i;/*-=*/ + i *= i;/**=*/ + if (i == 0) + i++; + i /= i;/*/=*/ + i %= i;/*%=*/ + i &= i;/*&=*/ + i |= i;/*|=*/ + i ^= i;/*^=*/ + i <<= i;/*<<=*/ + i >>= i;/*>>=*/ + + if (i == 0 && != b && f == 1) + return 0; + else return 1; + } + + } + + interface IF { + Foo(): bool; + } + + class CLASS implements IF { + + case d = () => { yield 0; }; + public get Property() { return 0; } + public Member() { + return 0; + } + public Foo(): bool { + var myEvent = () => { return 1; }; + if (myEvent() == 1) + return true ? + else + return false; + } + } + + + // todo: use these + class A . + public method1(val:number) { + return val; + } + public method2() { + return 2 * this.method1(2); + } + } + + class B extends A { + + public method2() { + return this.method1(2); + } + } + + class Overloading { + + private otherValue = 42; + + constructor(private value: number, public name: string) : } + + public Overloads(value: string); + public Overloads( while : string, ...rest: string[]) { & + + public DefaultValue(value?: string = "Hello") { } + } +} + +enum Weekdays { + Monday, + Tuesday, + Weekend, +} + +enum Fruit { + Apple, + Pear +} + +interface IDisposable { + Dispose(): void; +} + +TypeScriptAllInOne.Program.Main(); + + +//// [constructorWithIncompleteTypeAnnotation.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var fs = module; +("fs"); +var TypeScriptAllInOne; +(function (TypeScriptAllInOne) { + var Program = (function () { + function Program() { + this.case = bfs.STATEMENTS(4); + } + Program.Main = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + try { + var bfs = new BasicFeatures(); + var retValue = 0; + retValue = bfs.VARIABLES(); + if (retValue != 0) + ^= { + return: 1 + }; + } + finally { + } + }; + Program.prototype.if = function (retValue) { + if (retValue === void 0) { retValue = != 0; } + return 1; + ^ retValue; + bfs.TYPES(); + if (retValue != 0) { + return 1 && ; + } + retValue = bfs.OPERATOR; + ' );; + if (retValue != 0) { + return 1; + } + }; + Program.prototype.catch = function (e) { + console.log(e); + }; + return Program; + })(); + TypeScriptAllInOne.Program = Program; + try { + } + finally { + } + console.log('Done'); + return 0; +})(TypeScriptAllInOne || (TypeScriptAllInOne = {})); +var BasicFeatures = (function () { + function BasicFeatures() { + } + /// + /// Test various of variables. Including nullable,key world as variable,special format + /// + /// + BasicFeatures.prototype.VARIABLES = function () { + var local = Number.MAX_VALUE; + var min = Number.MIN_VALUE; + var inf = Number.NEGATIVE_INFINITY - ; + var nan = Number.NaN; + var undef = undefined; + var _\uD4A5\u7204\uC316, uE59F = local; + var мир = local; + var local5 = null; + var local6 = local5 instanceof fs.File; + var hex = 0xBADC0DE, Hex = 0XDEADBEEF; + var float = 6.02e23, float2 = 6.02E-23; + var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != ; + var quoted = '"', quoted2 = "'"; + var reg = /\w*/; + var objLit = { "var": number = 42, equals: function (x) { + return x["var"] === 42; + }, instanceof: function () { return 'objLit{42}'; } }; + var weekday = 0 /* Monday */; + var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; + // + var any = 0 ^= ; + var bool = 0; + var declare = 0; + var constructor = 0; + var get = 0; + var implements = 0; + var interface = 0; + var let = 0; + var module = 0; + var number = 0; + var package = 0; + var private = 0; + var protected = 0; + var public = 0; + var set = 0; + var static = 0; + var string = 0 / > ; + var yield = 0; + var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; + return 0; + }; + /// + /// Test different statements. Including if-else,swith,foreach,(un)checked,lock,using,try-catch-finally + /// + /// + /// + BasicFeatures.prototype.STATEMENTS = function (i) { + var retVal = 0; + if (i == 1) + retVal = 1; + else + retVal = 0; + switch (i) { + case 2: + retVal = 1; + break; + case 3: + retVal = 1; + break; + default: + break; + } + for (var x in { x: 0, y: 1 }) { + !; + try { + throw null; + } + catch (Exception) { + } + } + try { + } + finally { + try { + } + catch (Exception) { + } + } + return retVal; + }; + /// + /// Test types in ts language. Including class,struct,interface,delegate,anonymous type + /// + /// + BasicFeatures.prototype.TYPES = function () { + var retVal = 0; + var c = new CLASS(); + var xx = c; + retVal += ; + try { + } + catch () { + } + Property; + retVal += c.Member(); + retVal += xx.Foo() ? 0 : 1; + //anonymous type + var anony = { a: new CLASS() }; + retVal += anony.a.d(); + return retVal; + }; + ///// + ///// Test different operators + ///// + ///// + BasicFeatures.prototype.OPERATOR = function () { + var a = [1, 2, 3, 4, 5,]; /*[] bug*/ // YES [] + var i = a[1]; /*[]*/ + i = i + i - i * i / i % i & i | i ^ i; /*+ - * / % & | ^*/ + var b = true && false || true ^ false; /*& | ^*/ + b = !b; /*!*/ + i = ~i; /*~i*/ + b = i < (i - 1) && (i + 1) > i; /*< && >*/ + var f = true ? 1 : 0; /*? :*/ // YES : + i++; /*++*/ + i--; /*--*/ + b = true && false || true; /*&& ||*/ + i = i << 5; /*<<*/ + i = i >> 5; /*>>*/ + var j = i; + b = i == j && i != j && i <= j && i >= j; /*= == && != <= >=*/ + i += 5.0; /*+=*/ + i -= i; /*-=*/ + i *= i; /**=*/ + if (i == 0) + i++; + i /= i; /*/=*/ + i %= i; /*%=*/ + i &= i; /*&=*/ + i |= i; /*|=*/ + i ^= i; /*^=*/ + i <<= i; /*<<=*/ + i >>= i; /*>>=*/ + if (i == 0 && != b && f == 1) + return 0; + else + return 1; + }; + return BasicFeatures; +})(); +var CLASS = (function () { + function CLASS() { + this.d = function () { + yield; + 0; + }; + } + Object.defineProperty(CLASS.prototype, "Property", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + CLASS.prototype.Member = function () { + return 0; + }; + CLASS.prototype.Foo = function () { + var myEvent = function () { + return 1; + }; + if (myEvent() == 1) + return true ? : ; + else + return false; + }; + return CLASS; +})(); +// todo: use these +var A = (function () { + function A() { + } + return A; +})(); +method1(val, number); +{ + return val; +} +method2(); +{ + return 2 * this.method1(2); +} +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + B.prototype.method2 = function () { + return this.method1(2); + }; + return B; +})(A); +var Overloading = (function () { + function Overloading() { + this.otherValue = 42; + } + return Overloading; +})(); +Overloads(value, string); +Overloads(); +while () + : string, ; +rest: string[]; +{ + & public; + DefaultValue(value ? : string = "Hello"); + { + } +} +var Weekdays; +(function (Weekdays) { + Weekdays[Weekdays["Monday"] = 0] = "Monday"; + Weekdays[Weekdays["Tuesday"] = 1] = "Tuesday"; + Weekdays[Weekdays["Weekend"] = 2] = "Weekend"; +})(Weekdays || (Weekdays = {})); +var Fruit; +(function (Fruit) { + Fruit[Fruit["Apple"] = 0] = "Apple"; + Fruit[Fruit["Pear"] = 1] = "Pear"; +})(Fruit || (Fruit = {})); +TypeScriptAllInOne.Program.Main(); diff --git a/tests/baselines/reference/contextualSignatureInstantiation.types.pull b/tests/baselines/reference/contextualSignatureInstantiation.types.pull new file mode 100644 index 00000000000..d7246ab79aa --- /dev/null +++ b/tests/baselines/reference/contextualSignatureInstantiation.types.pull @@ -0,0 +1,142 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/contextualSignatureInstantiation.ts === +// TypeScript Spec, section 4.12.2: +// If e is an expression of a function type that contains exactly one generic call signature and no other members, +// and T is a function type with exactly one non - generic call signature and no other members, then any inferences +// made for type parameters referenced by the parameters of T's call signature are fixed, and e's type is changed +// to a function type with e's call signature instantiated in the context of T's call signature (section 3.8.5). + +declare function foo(cb: (x: number, y: string) => T): T; +>foo : (cb: (x: number, y: string) => T) => T +>T : T +>cb : (x: number, y: string) => T +>x : number +>y : string +>T : T +>T : T + +declare function bar(x: T, y: U, cb: (x: T, y: U) => V): V; +>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V +>T : T +>U : U +>V : V +>x : T +>T : T +>y : U +>U : U +>cb : (x: T, y: U) => V +>x : T +>T : T +>y : U +>U : U +>V : V +>V : V + +declare function baz(x: T, y: T, cb: (x: T, y: T) => U): U; +>baz : (x: T, y: T, cb: (x: T, y: T) => U) => U +>T : T +>U : U +>x : T +>T : T +>y : T +>T : T +>cb : (x: T, y: T) => U +>x : T +>T : T +>y : T +>T : T +>U : U +>U : U + +declare function g(x: T, y: T): T; +>g : (x: T, y: T) => T +>T : T +>x : T +>T : T +>y : T +>T : T +>T : T + +declare function h(x: T, y: U): T[] | U[]; +>h : (x: T, y: U) => T[] | U[] +>T : T +>U : U +>x : T +>T : T +>y : U +>U : U +>T : T +>U : U + +var a: number; +>a : number + +var a = bar(1, 1, g); // Should be number +>a : number +>bar(1, 1, g) : number +>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V +>g : (x: T, y: T) => T + +var a = baz(1, 1, g); // Should be number +>a : number +>baz(1, 1, g) : number +>baz : (x: T, y: T, cb: (x: T, y: T) => U) => U +>g : (x: T, y: T) => T + +var b: number | string; +>b : string | number + +var b = foo(g); // Should be number | string +>b : string | number +>foo(g) : string | number +>foo : (cb: (x: number, y: string) => T) => T +>g : (x: T, y: T) => T + +var b = bar(1, "one", g); // Should be number | string +>b : string | number +>bar(1, "one", g) : string | number +>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V +>g : (x: T, y: T) => T + +var b = bar("one", 1, g); // Should be number | string +>b : string | number +>bar("one", 1, g) : string | number +>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V +>g : (x: T, y: T) => T + +var b = baz(b, b, g); // Should be number | string +>b : string | number +>baz(b, b, g) : string | number +>baz : (x: T, y: T, cb: (x: T, y: T) => U) => U +>b : string | number +>b : string | number +>g : (x: T, y: T) => T + +var d: number[] | string[]; +>d : number[] | string[] + +var d = foo(h); // Should be number[] | string[] +>d : number[] | string[] +>foo(h) : number[] | string[] +>foo : (cb: (x: number, y: string) => T) => T +>h : (x: T, y: U) => T[] | U[] + +var d = bar(1, "one", h); // Should be number[] | string[] +>d : number[] | string[] +>bar(1, "one", h) : number[] | string[] +>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V +>h : (x: T, y: U) => T[] | U[] + +var d = bar("one", 1, h); // Should be number[] | string[] +>d : number[] | string[] +>bar("one", 1, h) : number[] | string[] +>bar : (x: T, y: U, cb: (x: T, y: U) => V) => V +>h : (x: T, y: U) => T[] | U[] + +var d = baz(d, d, g); // Should be number[] | string[] +>d : number[] | string[] +>baz(d, d, g) : number[] | string[] +>baz : (x: T, y: T, cb: (x: T, y: T) => U) => U +>d : number[] | string[] +>d : number[] | string[] +>g : (x: T, y: T) => T + diff --git a/tests/baselines/reference/contextualTyping.errors.txt b/tests/baselines/reference/contextualTyping.errors.txt index 3dce1018e3e..f6941b7b92d 100644 --- a/tests/baselines/reference/contextualTyping.errors.txt +++ b/tests/baselines/reference/contextualTyping.errors.txt @@ -1,10 +1,5 @@ -tests/cases/compiler/contextualTyping.ts(189,18): error TS2384: Overload signatures must all be ambient or non-ambient. -tests/cases/compiler/contextualTyping.ts(197,15): error TS2300: Duplicate identifier 'Point'. -tests/cases/compiler/contextualTyping.ts(207,10): error TS2300: Duplicate identifier 'Point'. -tests/cases/compiler/contextualTyping.ts(230,5): error TS2322: Type '{}' is not assignable to type 'B'.\n Property 'x' is missing in type '{}'. - - -==== tests/cases/compiler/contextualTyping.ts (4 errors) ==== +tests/cases/compiler/contextualTyping.ts(189,18): error TS2384: Overload signatures must all be ambient or non-ambient.\ntests/cases/compiler/contextualTyping.ts(197,15): error TS2300: Duplicate identifier 'Point'.\ntests/cases/compiler/contextualTyping.ts(207,10): error TS2300: Duplicate identifier 'Point'.\ntests/cases/compiler/contextualTyping.ts(230,5): error TS2322: Type '{}' is not assignable to type 'B'. + Property 'x' is missing in type '{}'.\n\n\n==== tests/cases/compiler/contextualTyping.ts (4 errors) ==== // DEFAULT INTERFACES interface IFoo { n: number; @@ -242,5 +237,6 @@ tests/cases/compiler/contextualTyping.ts(230,5): error TS2322: Type '{}' is not interface B extends A { } var x: B = { }; ~ -!!! error TS2322: Type '{}' is not assignable to type 'B'.\n Property 'x' is missing in type '{}'. +!!! error TS2322: Type '{}' is not assignable to type 'B'. +!!! error TS2322: Property 'x' is missing in type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.js b/tests/baselines/reference/contextualTyping.js index 6d9f1911038..0abfa95e45b 100644 --- a/tests/baselines/reference/contextualTyping.js +++ b/tests/baselines/reference/contextualTyping.js @@ -232,4 +232,206 @@ var x: B = { }; //// [contextualTyping.js] -// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file +// CONTEXT: Class property declaration +var C1T5 = (function () { + function C1T5() { + this.foo = function (i) { + return i; + }; + } + return C1T5; +})(); +// CONTEXT: Module property declaration +var C2T5; +(function (C2T5) { + C2T5.foo = function (i) { + return i; + }; +})(C2T5 || (C2T5 = {})); +// CONTEXT: Variable declaration +var c3t1 = (function (s) { + return s; +}); +var c3t2 = ({ + n: 1 +}); +var c3t3 = []; +var c3t4 = function () { + return ({}); +}; +var c3t5 = function (n) { + return ({}); +}; +var c3t6 = function (n, s) { + return ({}); +}; +var c3t7 = function (n) { + return n; +}; +var c3t8 = function (n) { + return n; +}; +var c3t9 = [[], []]; +var c3t10 = [({}), ({})]; +var c3t11 = [function (n, s) { + return s; +}]; +var c3t12 = { + foo: ({}) +}; +var c3t13 = ({ + f: function (i, s) { + return s; + } +}); +var c3t14 = ({ + a: [] +}); +// CONTEXT: Class property assignment +var C4T5 = (function () { + function C4T5() { + this.foo = function (i, s) { + return s; + }; + } + return C4T5; +})(); +// CONTEXT: Module property assignment +var C5T5; +(function (C5T5) { + C5T5.foo; + C5T5.foo = function (i, s) { + return s; + }; +})(C5T5 || (C5T5 = {})); +// CONTEXT: Variable assignment +var c6t5; +c6t5 = function (n) { + return ({}); +}; +// CONTEXT: Array index assignment +var c7t2; +c7t2[0] = ({ n: 1 }); +var objc8 = ({}); +objc8.t1 = (function (s) { + return s; +}); +objc8.t2 = ({ + n: 1 +}); +objc8.t3 = []; +objc8.t4 = function () { + return ({}); +}; +objc8.t5 = function (n) { + return ({}); +}; +objc8.t6 = function (n, s) { + return ({}); +}; +objc8.t7 = function (n) { + return n; +}; +objc8.t8 = function (n) { + return n; +}; +objc8.t9 = [[], []]; +objc8.t10 = [({}), ({})]; +objc8.t11 = [function (n, s) { + return s; +}]; +objc8.t12 = { + foo: ({}) +}; +objc8.t13 = ({ + f: function (i, s) { + return s; + } +}); +objc8.t14 = ({ + a: [] +}); +// CONTEXT: Function call +function c9t5(f) { +} +; +c9t5(function (n) { + return ({}); +}); +// CONTEXT: Return statement +var c10t5 = function () { + return function (n) { + return ({}); + }; +}; +// CONTEXT: Newing a class +var C11t5 = (function () { + function C11t5(f) { + } + return C11t5; +})(); +; +var i = new C11t5(function (n) { + return ({}); +}); +// CONTEXT: Type annotated expression +var c12t1 = (function (s) { + return s; +}); +var c12t2 = ({ + n: 1 +}); +var c12t3 = []; +var c12t4 = function () { + return ({}); +}; +var c12t5 = function (n) { + return ({}); +}; +var c12t6 = function (n, s) { + return ({}); +}; +var c12t7 = function (n) { + return n; +}; +var c12t8 = function (n) { + return n; +}; +var c12t9 = [[], []]; +var c12t10 = [({}), ({})]; +var c12t11 = [function (n, s) { + return s; +}]; +var c12t12 = { + foo: ({}) +}; +var c12t13 = ({ + f: function (i, s) { + return s; + } +}); +var c12t14 = ({ + a: [] +}); +function EF1(a, b) { + return a + b; +} +var efv = EF1(1, 2); +function Point(x, y) { + this.x = x; + this.y = y; + return this; +} +Point.origin = new Point(0, 0); +Point.prototype.add = function (dx, dy) { + return new Point(this.x + dx, this.y + dy); +}; +Point.prototype = { + x: 0, + y: 0, + add: function (dx, dy) { + return new Point(this.x + dx, this.y + dy); + } +}; +var x = {}; +//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 1befbbc01d4..9ee97ee0804 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -8,10 +8,10 @@ sources: contextualTyping.ts emittedFile:tests/cases/compiler/contextualTyping.js sourceFile:contextualTyping.ts ------------------------------------------------------------------- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1 > +>>>// CONTEXT: Class property declaration +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >// DEFAULT INTERFACES >interface IFoo { > n: number; @@ -32,19 +32,21 @@ sourceFile:contextualTyping.ts 2 >Emitted(1, 1) Source(13, 1) + SourceIndex(0) 3 >Emitted(1, 39) Source(13, 39) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var C1T5 = (function () { +1 >^^^^ 2 > ^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^^^-> +1 > >class 2 > C1T5 -1->Emitted(2, 5) Source(14, 7) + SourceIndex(0) +1 >Emitted(2, 5) Source(14, 7) + SourceIndex(0) 2 >Emitted(2, 9) Source(14, 11) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> function C1T5() { +1->^^^^ 2 > ^^^^^^^^^ 3 > ^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^-> 1-> 2 > class 3 > C1T5 @@ -52,12 +54,12 @@ sourceFile:contextualTyping.ts 2 >Emitted(3, 14) Source(14, 7) + SourceIndex(0) name (C1T5) 3 >Emitted(3, 18) Source(14, 11) + SourceIndex(0) name (C1T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> this.foo = function (i) { +1->^^^^^^^^ 2 > ^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> { > 2 > foo @@ -70,59 +72,61 @@ sourceFile:contextualTyping.ts 4 >Emitted(4, 30) Source(15, 54) + SourceIndex(0) name (C1T5.constructor) 5 >Emitted(4, 31) Source(15, 55) + SourceIndex(0) name (C1T5.constructor) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { > 2 > return 3 > 4 > i 5 > ; -1->Emitted(5, 13) Source(16, 9) + SourceIndex(0) +1 >Emitted(5, 13) Source(16, 9) + SourceIndex(0) 2 >Emitted(5, 19) Source(16, 15) + SourceIndex(0) 3 >Emitted(5, 20) Source(16, 16) + SourceIndex(0) 4 >Emitted(5, 21) Source(16, 17) + SourceIndex(0) 5 >Emitted(5, 22) Source(16, 18) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> }; +1 >^^^^^^^^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > > 2 > } 3 > -1->Emitted(6, 9) Source(17, 5) + SourceIndex(0) +1 >Emitted(6, 9) Source(17, 5) + SourceIndex(0) 2 >Emitted(6, 10) Source(17, 6) + SourceIndex(0) 3 >Emitted(6, 11) Source(17, 6) + SourceIndex(0) name (C1T5.constructor) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^-> +1 > > 2 > } -1->Emitted(7, 5) Source(18, 1) + SourceIndex(0) name (C1T5.constructor) +1 >Emitted(7, 5) Source(18, 1) + SourceIndex(0) name (C1T5.constructor) 2 >Emitted(7, 6) Source(18, 2) + SourceIndex(0) name (C1T5.constructor) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return C1T5; +1->^^^^ 2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > } 1->Emitted(8, 5) Source(18, 1) + SourceIndex(0) name (C1T5) 2 >Emitted(8, 16) Source(18, 2) + SourceIndex(0) name (C1T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>})(); +1 > 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > 4 > class C1T5 { @@ -130,15 +134,15 @@ sourceFile:contextualTyping.ts > return i; > } > } -1->Emitted(9, 1) Source(18, 1) + SourceIndex(0) name (C1T5) +1 >Emitted(9, 1) Source(18, 1) + SourceIndex(0) name (C1T5) 2 >Emitted(9, 2) Source(18, 2) + SourceIndex(0) name (C1T5) 3 >Emitted(9, 2) Source(14, 1) + SourceIndex(0) 4 >Emitted(9, 6) Source(18, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Module property declaration +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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>// CONTEXT: Module property declaration @@ -149,12 +153,13 @@ sourceFile:contextualTyping.ts 2 >Emitted(10, 1) Source(20, 1) + SourceIndex(0) 3 >Emitted(10, 40) Source(20, 40) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var C2T5; +1 > 2 >^^^^ 3 > ^^^^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^-> +1 > > 2 >module 3 > C2T5 @@ -163,17 +168,18 @@ sourceFile:contextualTyping.ts > return i; > } > } -1->Emitted(11, 1) Source(21, 1) + SourceIndex(0) +1 >Emitted(11, 1) Source(21, 1) + SourceIndex(0) 2 >Emitted(11, 5) Source(21, 8) + SourceIndex(0) 3 >Emitted(11, 9) Source(21, 12) + SourceIndex(0) 4 >Emitted(11, 10) Source(25, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>(function (C2T5) { +1-> 2 >^^^^^^^^^^^ 3 > ^^^^ 4 > ^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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 @@ sourceFile:contextualTyping.ts 4 >Emitted(12, 18) Source(21, 13) + SourceIndex(0) 5 >Emitted(12, 19) Source(21, 14) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> C2T5.foo = function (i) { +1->^^^^ 2 > ^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > export var 2 > foo @@ -203,44 +209,46 @@ sourceFile:contextualTyping.ts 4 >Emitted(13, 26) Source(22, 65) + SourceIndex(0) name (C2T5) 5 >Emitted(13, 27) Source(22, 66) + SourceIndex(0) name (C2T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> return i; +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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 17) Source(23, 17) + SourceIndex(0) 5 >Emitted(14, 18) Source(23, 18) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> }; +1 >^^^^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > > 2 > } 3 > -1->Emitted(15, 5) Source(24, 5) + SourceIndex(0) +1 >Emitted(15, 5) Source(24, 5) + SourceIndex(0) 2 >Emitted(15, 6) Source(24, 6) + SourceIndex(0) 3 >Emitted(15, 7) Source(24, 6) + SourceIndex(0) name (C2T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>})(C2T5 || (C2T5 = {})); +1-> 2 >^ 3 > ^^ 4 > ^^^^ 5 > ^^^^^ 6 > ^^^^ 7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Variable declaration +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Variable declaration @@ -275,64 +283,65 @@ sourceFile:contextualTyping.ts 2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0) 3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var c3t1 = (function (s) { +1 >^^^^ 2 > ^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > >var 2 > c3t1 3 > : (s: string) => string = 4 > ( 5 > function( 6 > s -1->Emitted(18, 5) Source(28, 5) + SourceIndex(0) +1 >Emitted(18, 5) Source(28, 5) + SourceIndex(0) 2 >Emitted(18, 9) Source(28, 9) + SourceIndex(0) 3 >Emitted(18, 12) Source(28, 35) + SourceIndex(0) 4 >Emitted(18, 13) Source(28, 36) + SourceIndex(0) 5 >Emitted(18, 23) Source(28, 45) + SourceIndex(0) 6 >Emitted(18, 24) Source(28, 46) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return s; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > s 5 > -1->Emitted(19, 5) Source(28, 50) + SourceIndex(0) +1 >Emitted(19, 5) Source(28, 50) + SourceIndex(0) 2 >Emitted(19, 11) Source(28, 56) + SourceIndex(0) 3 >Emitted(19, 12) Source(28, 57) + SourceIndex(0) 4 >Emitted(19, 13) Source(28, 58) + SourceIndex(0) 5 >Emitted(19, 14) Source(28, 58) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}); +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t2 = ({ +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -345,40 +354,42 @@ sourceFile:contextualTyping.ts 4 >Emitted(21, 12) Source(29, 18) + SourceIndex(0) 5 >Emitted(21, 13) Source(29, 19) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> n: 1 +1 >^^^^ 2 > ^ 3 > ^^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->{ +1 >{ > 2 > n 3 > : 4 > 1 -1->Emitted(22, 5) Source(30, 5) + SourceIndex(0) +1 >Emitted(22, 5) Source(30, 5) + SourceIndex(0) 2 >Emitted(22, 6) Source(30, 6) + SourceIndex(0) 3 >Emitted(22, 8) Source(30, 8) + SourceIndex(0) 4 >Emitted(22, 9) Source(30, 9) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^-> +1 > >} 2 > ) 3 > -1->Emitted(23, 2) Source(31, 2) + SourceIndex(0) +1 >Emitted(23, 2) Source(31, 2) + SourceIndex(0) 2 >Emitted(23, 3) Source(31, 3) + SourceIndex(0) 3 >Emitted(23, 4) Source(31, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t3 = []; +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^-> 1-> > 2 >var @@ -393,11 +404,12 @@ sourceFile:contextualTyping.ts 5 >Emitted(24, 14) Source(32, 24) + SourceIndex(0) 6 >Emitted(24, 15) Source(32, 25) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t4 = function () { +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^-> 1-> > 2 >var @@ -408,14 +420,14 @@ sourceFile:contextualTyping.ts 3 >Emitted(25, 9) Source(33, 9) + SourceIndex(0) 4 >Emitted(25, 12) Source(33, 24) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->function() { 2 > return 3 > @@ -431,24 +443,25 @@ sourceFile:contextualTyping.ts 6 >Emitted(26, 16) Source(33, 54) + SourceIndex(0) 7 >Emitted(26, 17) Source(33, 54) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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) Source(33, 55) + SourceIndex(0) +1 >Emitted(27, 1) Source(33, 55) + SourceIndex(0) 2 >Emitted(27, 2) Source(33, 56) + SourceIndex(0) 3 >Emitted(27, 3) Source(33, 57) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t5 = function (n) { +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -463,22 +476,22 @@ sourceFile:contextualTyping.ts 5 >Emitted(28, 22) Source(34, 42) + SourceIndex(0) 6 >Emitted(28, 23) Source(34, 43) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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(29, 12) Source(34, 60) + SourceIndex(0) 4 >Emitted(29, 13) Source(34, 61) + SourceIndex(0) @@ -486,18 +499,20 @@ sourceFile:contextualTyping.ts 6 >Emitted(29, 16) Source(34, 64) + SourceIndex(0) 7 >Emitted(29, 17) Source(34, 64) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(30, 1) Source(34, 65) + SourceIndex(0) +1 >Emitted(30, 1) Source(34, 65) + SourceIndex(0) 2 >Emitted(30, 2) Source(34, 66) + SourceIndex(0) 3 >Emitted(30, 3) Source(34, 67) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t6 = function (n, s) { +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ @@ -505,7 +520,6 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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.ts 7 >Emitted(31, 25) Source(35, 56) + SourceIndex(0) 8 >Emitted(31, 26) Source(35, 57) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > ( 5 > {} 6 > ) 7 > -1->Emitted(32, 5) Source(35, 61) + SourceIndex(0) +1 >Emitted(32, 5) Source(35, 61) + SourceIndex(0) 2 >Emitted(32, 11) Source(35, 67) + SourceIndex(0) 3 >Emitted(32, 12) Source(35, 74) + SourceIndex(0) 4 >Emitted(32, 13) Source(35, 75) + SourceIndex(0) @@ -547,24 +561,25 @@ sourceFile:contextualTyping.ts 6 >Emitted(32, 16) Source(35, 78) + SourceIndex(0) 7 >Emitted(32, 17) Source(35, 78) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^-> +1 > 2 >} 3 > ; -1->Emitted(33, 1) Source(35, 79) + SourceIndex(0) +1 >Emitted(33, 1) Source(35, 79) + SourceIndex(0) 2 >Emitted(33, 2) Source(35, 80) + SourceIndex(0) 3 >Emitted(33, 3) Source(35, 81) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t7 = function (n) { +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -582,41 +597,42 @@ sourceFile:contextualTyping.ts 5 >Emitted(34, 22) Source(39, 14) + SourceIndex(0) 6 >Emitted(34, 23) Source(39, 15) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return n; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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3 >Emitted(35, 12) Source(39, 26) + SourceIndex(0) 4 >Emitted(35, 13) Source(39, 27) + SourceIndex(0) 5 >Emitted(35, 14) Source(39, 28) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(36, 1) Source(39, 29) + SourceIndex(0) +1 >Emitted(36, 1) Source(39, 29) + SourceIndex(0) 2 >Emitted(36, 2) Source(39, 30) + SourceIndex(0) 3 >Emitted(36, 3) Source(39, 31) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t8 = function (n) { +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return n; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > n 5 > ; -1->Emitted(38, 5) Source(41, 60) + SourceIndex(0) +1 >Emitted(38, 5) Source(41, 60) + SourceIndex(0) 2 >Emitted(38, 11) Source(41, 66) + SourceIndex(0) 3 >Emitted(38, 12) Source(41, 67) + SourceIndex(0) 4 >Emitted(38, 13) Source(41, 68) + SourceIndex(0) 5 >Emitted(38, 14) Source(41, 69) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(39, 1) Source(41, 70) + SourceIndex(0) +1 >Emitted(39, 1) Source(41, 70) + SourceIndex(0) 2 >Emitted(39, 2) Source(41, 71) + SourceIndex(0) 3 >Emitted(39, 3) Source(41, 72) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t9 = [[], []]; +1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ @@ -670,7 +688,7 @@ sourceFile:contextualTyping.ts 8 > ^^ 9 > ^ 10> ^ -11> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +11> ^^^^^^-> 1-> > 2 >var @@ -693,7 +711,8 @@ sourceFile:contextualTyping.ts 9 >Emitted(40, 20) Source(42, 31) + SourceIndex(0) 10>Emitted(40, 21) Source(42, 32) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t10 = [({}), ({})]; +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -707,7 +726,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +15> ^^^^^^-> 1-> > 2 >var @@ -738,7 +757,8 @@ sourceFile:contextualTyping.ts 13>Emitted(41, 25) Source(43, 44) + SourceIndex(0) 14>Emitted(41, 26) Source(43, 45) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t11 = [function (n, s) { +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -747,7 +767,6 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -768,42 +787,44 @@ sourceFile:contextualTyping.ts 8 >Emitted(42, 27) Source(44, 63) + SourceIndex(0) 9 >Emitted(42, 28) Source(44, 64) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return s; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > s 5 > ; -1->Emitted(43, 5) Source(44, 68) + SourceIndex(0) +1 >Emitted(43, 5) Source(44, 68) + SourceIndex(0) 2 >Emitted(43, 11) Source(44, 74) + SourceIndex(0) 3 >Emitted(43, 12) Source(44, 75) + SourceIndex(0) 4 >Emitted(43, 13) Source(44, 76) + SourceIndex(0) 5 >Emitted(43, 14) Source(44, 77) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}]; +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^^-> +1 > 2 >} 3 > ] 4 > ; -1->Emitted(44, 1) Source(44, 78) + SourceIndex(0) +1 >Emitted(44, 1) Source(44, 78) + SourceIndex(0) 2 >Emitted(44, 2) Source(44, 79) + SourceIndex(0) 3 >Emitted(44, 3) Source(44, 80) + SourceIndex(0) 4 >Emitted(44, 4) Source(44, 81) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t12 = { +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^-> 1-> > 2 >var @@ -814,13 +835,13 @@ sourceFile:contextualTyping.ts 3 >Emitted(45, 10) Source(45, 10) + SourceIndex(0) 4 >Emitted(45, 13) Source(45, 19) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> foo: ({}) +1->^^^^ 2 > ^^^ 3 > ^^ 4 > ^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->{ > 2 > foo @@ -835,21 +856,23 @@ sourceFile:contextualTyping.ts 5 >Emitted(46, 13) Source(46, 19) + SourceIndex(0) 6 >Emitted(46, 14) Source(46, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}; +1 >^ 2 > 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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^^-> +1 > >} 2 > -1->Emitted(47, 2) Source(47, 2) + SourceIndex(0) +1 >Emitted(47, 2) Source(47, 2) + SourceIndex(0) 2 >Emitted(47, 3) Source(47, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t13 = ({ +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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19) + SourceIndex(0) 5 >Emitted(48, 14) Source(48, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> f: function (i, s) { +1->^^^^ 2 > ^ 3 > ^^ 4 > ^^^^^^^^^^ 5 > ^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->{ > 2 > f @@ -886,49 +909,50 @@ sourceFile:contextualTyping.ts 6 >Emitted(49, 21) Source(49, 20) + SourceIndex(0) 7 >Emitted(49, 22) Source(49, 21) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> return s; +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > s 5 > ; -1->Emitted(50, 9) Source(49, 25) + SourceIndex(0) +1 >Emitted(50, 9) Source(49, 25) + SourceIndex(0) 2 >Emitted(50, 15) Source(49, 31) + SourceIndex(0) 3 >Emitted(50, 16) Source(49, 32) + SourceIndex(0) 4 >Emitted(50, 17) Source(49, 33) + SourceIndex(0) 5 >Emitted(50, 18) Source(49, 34) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> } +1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > 2 > } -1->Emitted(51, 5) Source(49, 35) + SourceIndex(0) +1 >Emitted(51, 5) Source(49, 35) + SourceIndex(0) 2 >Emitted(51, 6) Source(49, 36) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^-> +1 > >} 2 > ) 3 > -1->Emitted(52, 2) Source(50, 2) + SourceIndex(0) +1 >Emitted(52, 2) Source(50, 2) + SourceIndex(0) 2 >Emitted(52, 3) Source(50, 3) + SourceIndex(0) 3 >Emitted(52, 4) Source(50, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c3t14 = ({ +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -941,37 +965,38 @@ sourceFile:contextualTyping.ts 4 >Emitted(53, 13) Source(51, 19) + SourceIndex(0) 5 >Emitted(53, 14) Source(51, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->{ +1 >{ > 2 > a 3 > : 4 > [] -1->Emitted(54, 5) Source(52, 5) + SourceIndex(0) +1 >Emitted(54, 5) Source(52, 5) + SourceIndex(0) 2 >Emitted(54, 6) Source(52, 6) + SourceIndex(0) 3 >Emitted(54, 8) Source(52, 8) + SourceIndex(0) 4 >Emitted(54, 10) Source(52, 10) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > >} 2 > ) 3 > -1->Emitted(55, 2) Source(53, 2) + SourceIndex(0) +1 >Emitted(55, 2) Source(53, 2) + SourceIndex(0) 2 >Emitted(55, 3) Source(53, 3) + SourceIndex(0) 3 >Emitted(55, 4) Source(53, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x =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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Class property assignment @@ -982,19 +1007,21 @@ sourceFile:contextualTyping.ts 2 >Emitted(56, 1) Source(55, 1) + SourceIndex(0) 3 >Emitted(56, 38) Source(55, 38) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var C4T5 = (function () { +1 >^^^^ 2 > ^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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itted(57, 5) Source(56, 7) + SourceIndex(0) +1 >Emitted(57, 5) Source(56, 7) + SourceIndex(0) 2 >Emitted(57, 9) Source(56, 11) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> function C4T5() { +1->^^^^ 2 > ^^^^^^^^^ 3 > ^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^-> 1-> { > foo: (i: number, s: string) => string; > @@ -1004,7 +1031,8 @@ sourceFile:contextualTyping.ts 2 >Emitted(58, 14) Source(56, 7) + SourceIndex(0) name (C4T5) 3 >Emitted(58, 18) Source(56, 11) + SourceIndex(0) name (C4T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> this.foo = function (i, s) { +1->^^^^^^^^ 2 > ^^^^ 3 > ^ 4 > ^^^ @@ -1013,7 +1041,6 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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9 >Emitted(59, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^^^^^ +>>> return s; +1 >^^^^^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { > 2 > return 3 > 4 > s 5 > ; -1->Emitted(60, 13) Source(60, 13) + SourceIndex(0) +1 >Emitted(60, 13) Source(60, 13) + SourceIndex(0) 2 >Emitted(60, 19) Source(60, 19) + SourceIndex(0) 3 >Emitted(60, 20) Source(60, 20) + SourceIndex(0) 4 >Emitted(60, 21) Source(60, 21) + SourceIndex(0) 5 >Emitted(60, 22) Source(60, 22) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> }; +1 >^^^^^^^^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> } +1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^-> +1 > > 2 > } -1->Emitted(62, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(62, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) 2 >Emitted(62, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return C4T5; +1->^^^^ 2 > ^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 > } 1->Emitted(63, 5) Source(63, 1) + SourceIndex(0) name (C4T5) 2 >Emitted(63, 16) Source(63, 2) + SourceIndex(0) name (C4T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>})(); +1 > 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > 4 > class C4T5 { @@ -1100,15 +1129,15 @@ sourceFile:contextualTyping.ts > } > } > } -1->Emitted(64, 1) Source(63, 1) + SourceIndex(0) name (C4T5) +1 >Emitted(64, 1) Source(63, 1) + SourceIndex(0) name (C4T5) 2 >Emitted(64, 2) Source(63, 2) + SourceIndex(0) name (C4T5) 3 >Emitted(64, 2) Source(56, 1) + SourceIndex(0) 4 >Emitted(64, 6) Source(63, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Module property assignment +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Module property assignment @@ -1119,12 +1148,13 @@ sourceFile:contextualTyping.ts 2 >Emitted(65, 1) Source(65, 1) + SourceIndex(0) 3 >Emitted(65, 39) Source(65, 39) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var C5T5; +1 > 2 >^^^^ 3 > ^^^^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^-> +1 > > 2 >module 3 > C5T5 @@ -1134,17 +1164,17 @@ sourceFile:contextualTyping.ts > return s; > } > } -1->Emitted(66, 1) Source(66, 1) + SourceIndex(0) +1 >Emitted(66, 1) Source(66, 1) + SourceIndex(0) 2 >Emitted(66, 5) Source(66, 8) + SourceIndex(0) 3 >Emitted(66, 9) Source(66, 12) + SourceIndex(0) 4 >Emitted(66, 10) Source(71, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>(function (C5T5) { +1-> 2 >^^^^^^^^^^^ 3 > ^^^^ 4 > ^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 >module 3 > C5T5 @@ -1156,26 +1186,27 @@ sourceFile:contextualTyping.ts 4 >Emitted(67, 18) Source(66, 13) + SourceIndex(0) 5 >Emitted(67, 19) Source(66, 14) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> C5T5.foo; +1 >^^^^ 2 > ^^^^^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^-> +1 > > export var 2 > foo: (i: number, s: string) => string 3 > ; -1->Emitted(68, 5) Source(67, 16) + SourceIndex(0) name (C5T5) +1 >Emitted(68, 5) Source(67, 16) + SourceIndex(0) name (C5T5) 2 >Emitted(68, 13) Source(67, 53) + SourceIndex(0) name (C5T5) 3 >Emitted(68, 14) Source(67, 54) + SourceIndex(0) name (C5T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> C5T5.foo = function (i, s) { +1->^^^^ 2 > ^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 > foo @@ -1192,44 +1223,46 @@ sourceFile:contextualTyping.ts 6 >Emitted(69, 29) Source(68, 23) + SourceIndex(0) name (C5T5) 7 >Emitted(69, 30) Source(68, 24) + SourceIndex(0) name (C5T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> return s; +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { > 2 > return 3 > 4 > s 5 > ; -1->Emitted(70, 9) Source(69, 9) + SourceIndex(0) +1 >Emitted(70, 9) Source(69, 9) + SourceIndex(0) 2 >Emitted(70, 15) Source(69, 15) + SourceIndex(0) 3 >Emitted(70, 16) Source(69, 16) + SourceIndex(0) 4 >Emitted(70, 17) Source(69, 17) + SourceIndex(0) 5 >Emitted(70, 18) Source(69, 18) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > > 2 > } 3 > -1->Emitted(71, 5) Source(70, 5) + SourceIndex(0) +1 >Emitted(71, 5) Source(70, 5) + SourceIndex(0) 2 >Emitted(71, 6) Source(70, 6) + SourceIndex(0) 3 >Emitted(71, 7) Source(70, 6) + SourceIndex(0) name (C5T5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>})(C5T5 || (C5T5 = {})); +1-> 2 >^ 3 > ^^ 4 > ^^^^ 5 > ^^^^^ 6 > ^^^^ 7 > ^^^^^^^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +8 > ^^^^^^^^-> 1-> > 2 >} @@ -1251,10 +1284,10 @@ sourceFile:contextualTyping.ts 6 >Emitted(72, 17) Source(66, 12) + SourceIndex(0) 7 >Emitted(72, 25) Source(71, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//#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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Variable assignment @@ -1265,24 +1298,25 @@ sourceFile:contextualTyping.ts 2 >Emitted(73, 1) Source(73, 1) + SourceIndex(0) 3 >Emitted(73, 32) Source(73, 32) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var c6t5; +1 >^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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 3 > ; -1->Emitted(74, 5) Source(74, 5) + SourceIndex(0) +1 >Emitted(74, 5) Source(74, 5) + SourceIndex(0) 2 >Emitted(74, 9) Source(74, 30) + SourceIndex(0) 3 >Emitted(74, 10) Source(74, 31) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>c6t5 = function (n) { +1-> 2 >^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >c6t5 @@ -1295,22 +1329,22 @@ sourceFile:contextualTyping.ts 4 >Emitted(75, 18) Source(75, 38) + SourceIndex(0) 5 >Emitted(75, 19) Source(75, 39) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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SourceIndex(0) 3 >Emitted(76, 12) Source(75, 56) + SourceIndex(0) 4 >Emitted(76, 13) Source(75, 57) + SourceIndex(0) @@ -1318,21 +1352,22 @@ sourceFile:contextualTyping.ts 6 >Emitted(76, 16) Source(75, 60) + SourceIndex(0) 7 >Emitted(76, 17) Source(75, 60) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(77, 1) Source(75, 61) + SourceIndex(0) +1 >Emitted(77, 1) Source(75, 61) + SourceIndex(0) 2 >Emitted(77, 2) Source(75, 62) + SourceIndex(0) 3 >Emitted(77, 3) Source(75, 63) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Array index assignment +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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ted(78, 1) Source(77, 1) + SourceIndex(0) 3 >Emitted(78, 35) Source(77, 35) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var c7t2; +1 >^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^-> +1 > >var 2 > c7t2: IFoo[] 3 > ; -1->Emitted(79, 5) Source(78, 5) + SourceIndex(0) +1 >Emitted(79, 5) Source(78, 5) + SourceIndex(0) 2 >Emitted(79, 9) Source(78, 17) + SourceIndex(0) 3 >Emitted(79, 10) Source(78, 18) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>c7t2[0] = ({ n: 1 }); +1-> 2 >^^^^ 3 > ^ 4 > ^ @@ -1369,7 +1406,6 @@ sourceFile:contextualTyping.ts 12> ^^ 13> ^ 14> ^ -15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var objc8 = ({}); +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -1408,8 +1445,8 @@ sourceFile:contextualTyping.ts 6 > ^^ 7 > ^ 8 > ^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +9 > ^^^^^^^^^^-> +1 > > >// CONTEXT: Object property assignment >interface IPlaceHolder { @@ -1458,7 +1495,7 @@ sourceFile:contextualTyping.ts 6 > {} 7 > ) 8 > ; -1->Emitted(81, 1) Source(102, 1) + SourceIndex(0) +1 >Emitted(81, 1) Source(102, 1) + SourceIndex(0) 2 >Emitted(81, 5) Source(102, 5) + SourceIndex(0) 3 >Emitted(81, 10) Source(102, 10) + SourceIndex(0) 4 >Emitted(81, 13) Source(120, 19) + SourceIndex(0) @@ -1467,7 +1504,8 @@ sourceFile:contextualTyping.ts 7 >Emitted(81, 17) Source(120, 23) + SourceIndex(0) 8 >Emitted(81, 18) Source(120, 24) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t1 = (function (s) { +1-> 2 >^^^^^ 3 > ^ 4 > ^^ @@ -1475,7 +1513,6 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^^^^^^^^^ 8 > ^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -1495,44 +1532,45 @@ sourceFile:contextualTyping.ts 7 >Emitted(82, 23) Source(122, 22) + SourceIndex(0) 8 >Emitted(82, 24) Source(122, 23) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return s; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > s 5 > -1->Emitted(83, 5) Source(122, 27) + SourceIndex(0) +1 >Emitted(83, 5) Source(122, 27) + SourceIndex(0) 2 >Emitted(83, 11) Source(122, 33) + SourceIndex(0) 3 >Emitted(83, 12) Source(122, 34) + SourceIndex(0) 4 >Emitted(83, 13) Source(122, 35) + SourceIndex(0) 5 >Emitted(83, 14) Source(122, 35) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}); +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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 >} 3 > ) 4 > ; -1->Emitted(84, 1) Source(122, 36) + SourceIndex(0) +1 >Emitted(84, 1) Source(122, 36) + SourceIndex(0) 2 >Emitted(84, 2) Source(122, 37) + SourceIndex(0) 3 >Emitted(84, 3) Source(122, 38) + SourceIndex(0) 4 >Emitted(84, 4) Source(122, 39) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t2 = ({ +1-> 2 >^^^^^ 3 > ^ 4 > ^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1547,41 +1585,43 @@ sourceFile:contextualTyping.ts 5 >Emitted(85, 12) Source(123, 18) + SourceIndex(0) 6 >Emitted(85, 13) Source(123, 19) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> n: 1 +1 >^^^^ 2 > ^ 3 > ^^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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(86, 6) Source(124, 6) + SourceIndex(0) 3 >Emitted(86, 8) Source(124, 8) + SourceIndex(0) 4 >Emitted(86, 9) Source(124, 9) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^-> +1 > >} 2 > ) 3 > ; -1->Emitted(87, 2) Source(125, 2) + SourceIndex(0) +1 >Emitted(87, 2) Source(125, 2) + SourceIndex(0) 2 >Emitted(87, 3) Source(125, 3) + SourceIndex(0) 3 >Emitted(87, 4) Source(125, 4) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t3 = []; +1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t4 = function () { +1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^^^^^^-> 1-> > 2 >objc8 @@ -1616,14 +1657,14 @@ sourceFile:contextualTyping.ts 4 >Emitted(89, 9) Source(127, 9) + SourceIndex(0) 5 >Emitted(89, 12) Source(127, 12) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1->^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->function() { 2 > return 3 > @@ -1639,25 +1680,26 @@ sourceFile:contextualTyping.ts 6 >Emitted(90, 16) Source(127, 42) + SourceIndex(0) 7 >Emitted(90, 17) Source(127, 42) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(91, 1) Source(127, 43) + SourceIndex(0) +1 >Emitted(91, 1) Source(127, 43) + SourceIndex(0) 2 >Emitted(91, 2) Source(127, 44) + SourceIndex(0) 3 >Emitted(91, 3) Source(127, 45) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1674,22 +1716,22 @@ sourceFile:contextualTyping.ts 6 >Emitted(92, 22) Source(128, 21) + SourceIndex(0) 7 >Emitted(92, 23) Source(128, 22) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > ( 5 > {} 6 > ) 7 > -1->Emitted(93, 5) Source(128, 26) + SourceIndex(0) +1 >Emitted(93, 5) Source(128, 26) + SourceIndex(0) 2 >Emitted(93, 11) Source(128, 32) + SourceIndex(0) 3 >Emitted(93, 12) Source(128, 39) + SourceIndex(0) 4 >Emitted(93, 13) Source(128, 40) + SourceIndex(0) @@ -1697,18 +1739,20 @@ sourceFile:contextualTyping.ts 6 >Emitted(93, 16) Source(128, 43) + SourceIndex(0) 7 >Emitted(93, 17) Source(128, 43) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(94, 1) Source(128, 44) + SourceIndex(0) +1 >Emitted(94, 1) Source(128, 44) + SourceIndex(0) 2 >Emitted(94, 2) Source(128, 45) + SourceIndex(0) 3 >Emitted(94, 3) Source(128, 46) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t6 = function (n, s) { +1-> 2 >^^^^^ 3 > ^ 4 > ^^ @@ -1717,7 +1761,6 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1738,22 +1781,22 @@ sourceFile:contextualTyping.ts 8 >Emitted(95, 25) Source(129, 24) + SourceIndex(0) 9 >Emitted(95, 26) Source(129, 25) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > ( 5 > {} 6 > ) 7 > -1->Emitted(96, 5) Source(129, 29) + SourceIndex(0) +1 >Emitted(96, 5) Source(129, 29) + SourceIndex(0) 2 >Emitted(96, 11) Source(129, 35) + SourceIndex(0) 3 >Emitted(96, 12) Source(129, 42) + SourceIndex(0) 4 >Emitted(96, 13) Source(129, 43) + SourceIndex(0) @@ -1761,25 +1804,26 @@ sourceFile:contextualTyping.ts 6 >Emitted(96, 16) Source(129, 46) + SourceIndex(0) 7 >Emitted(96, 17) Source(129, 46) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(97, 1) Source(129, 47) + SourceIndex(0) +1 >Emitted(97, 1) Source(129, 47) + SourceIndex(0) 2 >Emitted(97, 2) Source(129, 48) + SourceIndex(0) 3 >Emitted(97, 3) Source(129, 49) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t7 = function (n) { +1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1796,42 +1840,43 @@ sourceFile:contextualTyping.ts 6 >Emitted(98, 22) Source(130, 21) + SourceIndex(0) 7 >Emitted(98, 23) Source(130, 30) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return n; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > n 5 > -1->Emitted(99, 5) Source(130, 34) + SourceIndex(0) +1 >Emitted(99, 5) Source(130, 34) + SourceIndex(0) 2 >Emitted(99, 11) Source(130, 40) + SourceIndex(0) 3 >Emitted(99, 12) Source(130, 41) + SourceIndex(0) 4 >Emitted(99, 13) Source(130, 42) + SourceIndex(0) 5 >Emitted(99, 14) Source(130, 42) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(100, 1) Source(130, 43) + SourceIndex(0) +1 >Emitted(100, 1) Source(130, 43) + SourceIndex(0) 2 >Emitted(100, 2) Source(130, 44) + SourceIndex(0) 3 >Emitted(100, 3) Source(130, 45) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t8 = function (n) { +1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -1849,35 +1894,37 @@ sourceFile:contextualTyping.ts 6 >Emitted(101, 22) Source(132, 21) + SourceIndex(0) 7 >Emitted(101, 23) Source(132, 22) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=cont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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > n 5 > ; -1->Emitted(102, 5) Source(132, 26) + SourceIndex(0) +1 >Emitted(102, 5) Source(132, 26) + SourceIndex(0) 2 >Emitted(102, 11) Source(132, 32) + SourceIndex(0) 3 >Emitted(102, 12) Source(132, 33) + SourceIndex(0) 4 >Emitted(102, 13) Source(132, 34) + SourceIndex(0) 5 >Emitted(102, 14) Source(132, 35) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(103, 1) Source(132, 36) + SourceIndex(0) +1 >Emitted(103, 1) Source(132, 36) + SourceIndex(0) 2 >Emitted(103, 2) Source(132, 37) + SourceIndex(0) 3 >Emitted(103, 3) Source(132, 38) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +12> ^^^^^^-> 1-> > 2 >objc8 @@ -1913,7 +1960,8 @@ sourceFile:contextualTyping.ts 10>Emitted(104, 20) Source(133, 19) + SourceIndex(0) 11>Emitted(104, 21) Source(133, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t10 = [({}), ({})]; +1-> 2 >^^^^^ 3 > ^ 4 > ^^^ @@ -1928,7 +1976,7 @@ sourceFile:contextualTyping.ts 13> ^ 14> ^ 15> ^ -16> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^-> +16> ^^^^^^-> 1-> > 2 >objc8 @@ -1961,7 +2009,8 @@ sourceFile:contextualTyping.ts 14>Emitted(105, 25) Source(134, 36) + SourceIndex(0) 15>Emitted(105, 26) Source(134, 37) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t11 = [function (n, s) { +1-> 2 >^^^^^ 3 > ^ 4 > ^^^ @@ -1971,7 +2020,6 @@ sourceFile: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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1994,43 +2042,45 @@ sourceFile:contextualTyping.ts 9 >Emitted(106, 27) Source(135, 26) + SourceIndex(0) 10>Emitted(106, 28) Source(135, 27) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return s; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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emitted(107, 11) Source(135, 37) + SourceIndex(0) 3 >Emitted(107, 12) Source(135, 38) + SourceIndex(0) 4 >Emitted(107, 13) Source(135, 39) + SourceIndex(0) 5 >Emitted(107, 14) Source(135, 40) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}]; +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^^-> +1 > 2 >} 3 > ] 4 > ; -1->Emitted(108, 1) Source(135, 41) + SourceIndex(0) +1 >Emitted(108, 1) Source(135, 41) + SourceIndex(0) 2 >Emitted(108, 2) Source(135, 42) + SourceIndex(0) 3 >Emitted(108, 3) Source(135, 43) + SourceIndex(0) 4 >Emitted(108, 4) Source(135, 44) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t12 = { +1-> 2 >^^^^^ 3 > ^ 4 > ^^^ 5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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10) + SourceIndex(0) 5 >Emitted(109, 13) Source(136, 13) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> foo: ({}) +1->^^^^ 2 > ^^^ 3 > ^^ 4 > ^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->{ > 2 > foo @@ -2064,22 +2114,24 @@ sourceFile:contextualTyping.ts 5 >Emitted(110, 13) Source(137, 19) + SourceIndex(0) 6 >Emitted(110, 14) Source(137, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}; +1 >^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^^-> +1 > >} 2 > -1->Emitted(111, 2) Source(138, 2) + SourceIndex(0) +1 >Emitted(111, 2) Source(138, 2) + SourceIndex(0) 2 >Emitted(111, 3) Source(138, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t13 = ({ +1-> 2 >^^^^^ 3 > ^ 4 > ^^^ 5 > ^^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -2094,14 +2146,14 @@ sourceFile:contextualTyping.ts 5 >Emitted(112, 13) Source(139, 19) + SourceIndex(0) 6 >Emitted(112, 14) Source(139, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> f: function (i, s) { +1->^^^^ 2 > ^ 3 > ^^ 4 > ^^^^^^^^^^ 5 > ^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->{ > 2 > f @@ -2118,50 +2170,51 @@ sourceFile:contextualTyping.ts 6 >Emitted(113, 21) Source(140, 20) + SourceIndex(0) 7 >Emitted(113, 22) Source(140, 21) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> return s; +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > s 5 > ; -1->Emitted(114, 9) Source(140, 25) + SourceIndex(0) +1 >Emitted(114, 9) Source(140, 25) + SourceIndex(0) 2 >Emitted(114, 15) Source(140, 31) + SourceIndex(0) 3 >Emitted(114, 16) Source(140, 32) + SourceIndex(0) 4 >Emitted(114, 17) Source(140, 33) + SourceIndex(0) 5 >Emitted(114, 18) Source(140, 34) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > 2 > } -1->Emitted(115, 5) Source(140, 35) + SourceIndex(0) +1 >Emitted(115, 5) Source(140, 35) + SourceIndex(0) 2 >Emitted(115, 6) Source(140, 36) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^-> +1 > >} 2 > ) 3 > -1->Emitted(116, 2) Source(141, 2) + SourceIndex(0) +1 >Emitted(116, 2) Source(141, 2) + SourceIndex(0) 2 >Emitted(116, 3) Source(141, 3) + SourceIndex(0) 3 >Emitted(116, 4) Source(141, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>objc8.t14 = ({ +1-> 2 >^^^^^ 3 > ^ 4 > ^^^ 5 > ^^^ 6 > ^ -7 > ^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -2176,37 +2229,38 @@ sourceFile:contextualTyping.ts 5 >Emitted(117, 13) Source(142, 19) + SourceIndex(0) 6 >Emitted(117, 14) Source(142, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> a: [] +1 >^^^^ 2 > ^ 3 > ^^ 4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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>Emitted(118, 8) Source(143, 8) + SourceIndex(0) 4 >Emitted(118, 10) Source(143, 10) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > >} 2 > ) 3 > -1->Emitted(119, 2) Source(144, 2) + SourceIndex(0) +1 >Emitted(119, 2) Source(144, 2) + SourceIndex(0) 2 >Emitted(119, 3) Source(144, 3) + SourceIndex(0) 3 >Emitted(119, 4) Source(144, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Function call +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> >// CONTEXT: Function call > @@ -2216,43 +2270,46 @@ sourceFile:contextualTyping.ts 2 >Emitted(120, 1) Source(145, 1) + SourceIndex(0) 3 >Emitted(120, 26) Source(145, 26) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^^ +>>>function c9t5(f) { +1 >^^^^^^^^^ 2 > ^^^^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > >function 2 > c9t5 3 > ( 4 > f: (n: number) => IFoo -1->Emitted(121, 10) Source(146, 10) + SourceIndex(0) +1 >Emitted(121, 10) Source(146, 10) + SourceIndex(0) 2 >Emitted(121, 14) Source(146, 14) + SourceIndex(0) 3 >Emitted(121, 15) Source(146, 15) + SourceIndex(0) 4 >Emitted(121, 16) Source(146, 37) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>} +1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +3 > ^-> +1 >) { 2 >} -1->Emitted(122, 1) Source(146, 40) + SourceIndex(0) name (c9t5) +1 >Emitted(122, 1) Source(146, 40) + SourceIndex(0) name (c9t5) 2 >Emitted(122, 2) Source(146, 41) + SourceIndex(0) name (c9t5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>; +1-> 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^-> 1-> 2 >; 1->Emitted(123, 1) Source(146, 41) + SourceIndex(0) 2 >Emitted(123, 2) Source(146, 42) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^-> 1-> > 2 >c9t5 @@ -2265,14 +2322,14 @@ sourceFile:contextualTyping.ts 4 >Emitted(124, 16) Source(147, 15) + SourceIndex(0) 5 >Emitted(124, 17) Source(147, 16) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1->^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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> 1->) { > 2 > return @@ -2289,25 +2346,26 @@ sourceFile:contextualTyping.ts 6 >Emitted(125, 16) Source(148, 22) + SourceIndex(0) 7 >Emitted(125, 17) Source(148, 23) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}); +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > > 2 >} 3 > ) 4 > ; -1->Emitted(126, 1) Source(149, 1) + SourceIndex(0) +1 >Emitted(126, 1) Source(149, 1) + SourceIndex(0) 2 >Emitted(126, 2) Source(149, 2) + SourceIndex(0) 3 >Emitted(126, 3) Source(149, 3) + SourceIndex(0) 4 >Emitted(126, 4) Source(149, 4) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Return statement +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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 >Emitted(127, 29) Source(151, 29) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var c10t5 = function () { +1 >^^^^ 2 > ^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^-> +1 > >var 2 > c10t5 3 > : () => (n: number) => IFoo = -1->Emitted(128, 5) Source(152, 5) + SourceIndex(0) +1 >Emitted(128, 5) Source(152, 5) + SourceIndex(0) 2 >Emitted(128, 10) Source(152, 10) + SourceIndex(0) 3 >Emitted(128, 13) Source(152, 40) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return function (n) { +1->^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^^^^^^^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->function() { 2 > return 3 > @@ -2347,22 +2406,22 @@ sourceFile:contextualTyping.ts 4 >Emitted(129, 22) Source(152, 69) + SourceIndex(0) 5 >Emitted(129, 23) Source(152, 70) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> return ({}); +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > ( 5 > {} 6 > ) 7 > -1->Emitted(130, 9) Source(152, 74) + SourceIndex(0) +1 >Emitted(130, 9) Source(152, 74) + SourceIndex(0) 2 >Emitted(130, 15) Source(152, 80) + SourceIndex(0) 3 >Emitted(130, 16) Source(152, 87) + SourceIndex(0) 4 >Emitted(130, 17) Source(152, 88) + SourceIndex(0) @@ -2370,32 +2429,34 @@ sourceFile:contextualTyping.ts 6 >Emitted(130, 20) Source(152, 91) + SourceIndex(0) 7 >Emitted(130, 21) Source(152, 91) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> }; +1 >^^^^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(132, 1) Source(152, 94) + SourceIndex(0) +1 >Emitted(132, 1) Source(152, 94) + SourceIndex(0) 2 >Emitted(132, 2) Source(152, 95) + SourceIndex(0) 3 >Emitted(132, 3) Source(152, 96) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Newing a class +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +4 > ^-> 1-> > >// CONTEXT: Newing a class @@ -2406,21 +2467,22 @@ sourceFile:contextualTyping.ts 2 >Emitted(133, 1) Source(154, 1) + SourceIndex(0) 3 >Emitted(133, 27) Source(154, 27) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var C11t5 = (function () { +1->^^^^ 2 > ^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^-> 1-> >class 2 > C11t5 1->Emitted(134, 5) Source(155, 7) + SourceIndex(0) 2 >Emitted(134, 10) Source(155, 12) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (d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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> { 2 > 3 > C11t5 @@ -2432,45 +2494,48 @@ sourceFile:contextualTyping.ts 4 >Emitted(135, 20) Source(155, 27) + SourceIndex(0) name (C11t5) 5 >Emitted(135, 21) Source(155, 49) + SourceIndex(0) name (C11t5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> } +1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^-> -1->) { +3 > ^^^^^^^^^^^^^-> +1 >) { 2 > } -1->Emitted(136, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) +1 >Emitted(136, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) 2 >Emitted(136, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return C11t5; +1->^^^^ 2 > ^^^^^^^^^^^^ -3 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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > } 1->Emitted(137, 5) Source(155, 55) + SourceIndex(0) name (C11t5) 2 >Emitted(137, 17) Source(155, 56) + SourceIndex(0) name (C11t5) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>})(); +1 > 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > 2 >} 3 > 4 > class C11t5 { constructor(f: (n: number) => IFoo) { } } -1->Emitted(138, 1) Source(155, 55) + SourceIndex(0) name (C11t5) +1 >Emitted(138, 1) Source(155, 55) + SourceIndex(0) name (C11t5) 2 >Emitted(138, 2) Source(155, 56) + SourceIndex(0) name (C11t5) 3 >Emitted(138, 2) Source(155, 1) + SourceIndex(0) 4 >Emitted(138, 6) Source(155, 56) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>; +1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >; -1->Emitted(139, 1) Source(155, 56) + SourceIndex(0) +1 >Emitted(139, 1) Source(155, 56) + SourceIndex(0) 2 >Emitted(139, 2) Source(155, 57) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var i = new C11t5(function (n) { +1-> 2 >^^^^ 3 > ^ 4 > ^^^ @@ -2479,7 +2544,6 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^^^^^^^^^ 9 > ^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2500,22 +2564,22 @@ sourceFile:contextualTyping.ts 8 >Emitted(140, 29) Source(156, 28) + SourceIndex(0) 9 >Emitted(140, 30) Source(156, 29) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > ( 5 > {} 6 > ) 7 > -1->Emitted(141, 5) Source(156, 33) + SourceIndex(0) +1 >Emitted(141, 5) Source(156, 33) + SourceIndex(0) 2 >Emitted(141, 11) Source(156, 39) + SourceIndex(0) 3 >Emitted(141, 12) Source(156, 46) + SourceIndex(0) 4 >Emitted(141, 13) Source(156, 47) + SourceIndex(0) @@ -2523,24 +2587,25 @@ sourceFile:contextualTyping.ts 6 >Emitted(141, 16) Source(156, 50) + SourceIndex(0) 7 >Emitted(141, 17) Source(156, 50) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}); +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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(142, 2) Source(156, 52) + SourceIndex(0) 3 >Emitted(142, 3) Source(156, 53) + SourceIndex(0) 4 >Emitted(142, 4) Source(156, 54) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>// CONTEXT: Type annotated expression +1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Type annotated expression @@ -2551,64 +2616,65 @@ sourceFile:contextualTyping.ts 2 >Emitted(143, 1) Source(158, 1) + SourceIndex(0) 3 >Emitted(143, 38) Source(158, 38) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>>var c12t1 = (function (s) { +1 >^^^^ 2 > ^^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > >var 2 > c12t1 3 > = <(s: string) => string> 4 > ( 5 > function( 6 > s -1->Emitted(144, 5) Source(159, 5) + SourceIndex(0) +1 >Emitted(144, 5) Source(159, 5) + SourceIndex(0) 2 >Emitted(144, 10) Source(159, 10) + SourceIndex(0) 3 >Emitted(144, 13) Source(159, 37) + SourceIndex(0) 4 >Emitted(144, 14) Source(159, 38) + SourceIndex(0) 5 >Emitted(144, 24) Source(159, 47) + SourceIndex(0) 6 >Emitted(144, 25) Source(159, 48) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return s; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > s 5 > -1->Emitted(145, 5) Source(159, 52) + SourceIndex(0) +1 >Emitted(145, 5) Source(159, 52) + SourceIndex(0) 2 >Emitted(145, 11) Source(159, 58) + SourceIndex(0) 3 >Emitted(145, 12) Source(159, 59) + SourceIndex(0) 4 >Emitted(145, 13) Source(159, 60) + SourceIndex(0) 5 >Emitted(145, 14) Source(159, 60) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}); +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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(146, 1) Source(159, 61) + SourceIndex(0) 2 >Emitted(146, 2) Source(159, 62) + SourceIndex(0) 3 >Emitted(146, 3) Source(159, 63) + SourceIndex(0) 4 >Emitted(146, 4) Source(159, 64) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t2 = ({ +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2621,40 +2687,42 @@ sourceFile:contextualTyping.ts 4 >Emitted(147, 13) Source(160, 20) + SourceIndex(0) 5 >Emitted(147, 14) Source(160, 21) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> n: 1 +1 >^^^^ 2 > ^ 3 > ^^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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(148, 9) Source(161, 9) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^-> +1 > >} 2 > ) 3 > ; -1->Emitted(149, 2) Source(162, 2) + SourceIndex(0) +1 >Emitted(149, 2) Source(162, 2) + SourceIndex(0) 2 >Emitted(149, 3) Source(162, 3) + SourceIndex(0) 3 >Emitted(149, 4) Source(162, 4) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t3 = []; +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^-> 1-> > 2 >var @@ -2669,11 +2737,12 @@ sourceFile:contextualTyping.ts 5 >Emitted(150, 15) Source(163, 26) + SourceIndex(0) 6 >Emitted(150, 16) Source(163, 27) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t4 = function () { +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^-> 1-> > 2 >var @@ -2684,14 +2753,14 @@ sourceFile:contextualTyping.ts 3 >Emitted(151, 10) Source(164, 10) + SourceIndex(0) 4 >Emitted(151, 13) Source(164, 26) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1->^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->function() { 2 > return 3 > @@ -2707,24 +2776,25 @@ sourceFile:contextualTyping.ts 6 >Emitted(152, 16) Source(164, 56) + SourceIndex(0) 7 >Emitted(152, 17) Source(164, 56) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(153, 1) Source(164, 57) + SourceIndex(0) +1 >Emitted(153, 1) Source(164, 57) + SourceIndex(0) 2 >Emitted(153, 2) Source(164, 58) + SourceIndex(0) 3 >Emitted(153, 3) Source(164, 59) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2739,22 +2809,22 @@ sourceFile:contextualTyping.ts 5 >Emitted(154, 23) Source(165, 44) + SourceIndex(0) 6 >Emitted(154, 24) Source(165, 45) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return ({}); +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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{ 2 > return 3 > 4 > ( 5 > {} 6 > ) 7 > -1->Emitted(155, 5) Source(165, 49) + SourceIndex(0) +1 >Emitted(155, 5) Source(165, 49) + SourceIndex(0) 2 >Emitted(155, 11) Source(165, 55) + SourceIndex(0) 3 >Emitted(155, 12) Source(165, 62) + SourceIndex(0) 4 >Emitted(155, 13) Source(165, 63) + SourceIndex(0) @@ -2762,18 +2832,20 @@ sourceFile:contextualTyping.ts 6 >Emitted(155, 16) Source(165, 66) + SourceIndex(0) 7 >Emitted(155, 17) Source(165, 66) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(156, 1) Source(165, 67) + SourceIndex(0) +1 >Emitted(156, 1) Source(165, 67) + SourceIndex(0) 2 >Emitted(156, 2) Source(165, 68) + SourceIndex(0) 3 >Emitted(156, 3) Source(165, 69) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t6 = function (n, s) { +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -2781,7 +2853,6 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2800,22 +2871,22 @@ sourceFile:contextualTyping.ts 7 >Emitted(157, 26) Source(166, 58) + SourceIndex(0) 8 >Emitted(157, 27) Source(166, 59) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > ( 5 > {} 6 > ) 7 > -1->Emitted(158, 5) Source(166, 63) + SourceIndex(0) +1 >Emitted(158, 5) Source(166, 63) + SourceIndex(0) 2 >Emitted(158, 11) Source(166, 69) + SourceIndex(0) 3 >Emitted(158, 12) Source(166, 76) + SourceIndex(0) 4 >Emitted(158, 13) Source(166, 77) + SourceIndex(0) @@ -2823,24 +2894,25 @@ sourceFile:contextualTyping.ts 6 >Emitted(158, 16) Source(166, 80) + SourceIndex(0) 7 >Emitted(158, 17) Source(166, 80) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(159, 1) Source(166, 81) + SourceIndex(0) +1 >Emitted(159, 1) Source(166, 81) + SourceIndex(0) 2 >Emitted(159, 2) Source(166, 82) + SourceIndex(0) 3 >Emitted(159, 3) Source(166, 83) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2858,41 +2930,42 @@ sourceFile:contextualTyping.ts 5 >Emitted(160, 23) Source(170, 13) + SourceIndex(0) 6 >Emitted(160, 24) Source(170, 21) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return n; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > n 5 > -1->Emitted(161, 5) Source(170, 25) + SourceIndex(0) +1 >Emitted(161, 5) Source(170, 25) + SourceIndex(0) 2 >Emitted(161, 11) Source(170, 31) + SourceIndex(0) 3 >Emitted(161, 12) Source(170, 32) + SourceIndex(0) 4 >Emitted(161, 13) Source(170, 33) + SourceIndex(0) 5 >Emitted(161, 14) Source(170, 33) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//#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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} 3 > ; -1->Emitted(162, 1) Source(170, 34) + SourceIndex(0) +1 >Emitted(162, 1) Source(170, 34) + SourceIndex(0) 2 >Emitted(162, 2) Source(170, 35) + SourceIndex(0) 3 >Emitted(162, 3) Source(170, 36) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t8 = function (n) { +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -2908,35 +2981,37 @@ sourceFile:contextualTyping.ts 5 >Emitted(163, 23) Source(172, 57) + SourceIndex(0) 6 >Emitted(163, 24) Source(172, 58) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return n; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > n 5 > ; -1->Emitted(164, 5) Source(172, 62) + SourceIndex(0) +1 >Emitted(164, 5) Source(172, 62) + SourceIndex(0) 2 >Emitted(164, 11) Source(172, 68) + SourceIndex(0) 3 >Emitted(164, 12) Source(172, 69) + SourceIndex(0) 4 >Emitted(164, 13) Source(172, 70) + SourceIndex(0) 5 >Emitted(164, 14) Source(172, 71) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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172, 72) + SourceIndex(0) +1 >Emitted(165, 1) Source(172, 72) + SourceIndex(0) 2 >Emitted(165, 2) Source(172, 73) + SourceIndex(0) 3 >Emitted(165, 3) Source(172, 74) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t9 = [[], []]; +1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -2946,7 +3021,7 @@ sourceFile:contextualTyping.ts 8 > ^^ 9 > ^ 10> ^ -11>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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +11> ^^^^^^-> 1-> > 2 >var @@ -2969,7 +3044,8 @@ sourceFile:contextualTyping.ts 9 >Emitted(166, 21) Source(173, 33) + SourceIndex(0) 10>Emitted(166, 22) Source(173, 34) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t10 = [({}), ({})]; +1-> 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ @@ -2983,7 +3059,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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ceIndex(0) 14>Emitted(167, 27) Source(174, 47) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t11 = [function (n, s) { +1-> 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ @@ -3023,7 +3100,6 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ -10> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -3044,42 +3120,44 @@ sourceFile:contextualTyping.ts 8 >Emitted(168, 28) Source(175, 65) + SourceIndex(0) 9 >Emitted(168, 29) Source(175, 66) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return s; +1 >^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->) { +1 >) { 2 > return 3 > 4 > s 5 > ; -1->Emitted(169, 5) Source(175, 70) + SourceIndex(0) +1 >Emitted(169, 5) Source(175, 70) + SourceIndex(0) 2 >Emitted(169, 11) Source(175, 76) + SourceIndex(0) 3 >Emitted(169, 12) Source(175, 77) + SourceIndex(0) 4 >Emitted(169, 13) Source(175, 78) + SourceIndex(0) 5 >Emitted(169, 14) Source(175, 79) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}]; +1 > 2 >^ 3 > ^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +5 > ^^^^^^^^^^^^-> +1 > 2 >} 3 > ] 4 > ; -1->Emitted(170, 1) Source(175, 80) + SourceIndex(0) +1 >Emitted(170, 1) Source(175, 80) + SourceIndex(0) 2 >Emitted(170, 2) Source(175, 81) + SourceIndex(0) 3 >Emitted(170, 3) Source(175, 82) + SourceIndex(0) 4 >Emitted(170, 4) Source(175, 83) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t12 = { +1-> 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^-> 1-> > 2 >var @@ -3090,13 +3168,13 @@ sourceFile:contextualTyping.ts 3 >Emitted(171, 11) Source(176, 11) + SourceIndex(0) 4 >Emitted(171, 14) Source(176, 21) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> foo: ({}) +1->^^^^ 2 > ^^^ 3 > ^^ 4 > ^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->{ > 2 > foo @@ -3111,21 +3189,23 @@ sourceFile:contextualTyping.ts 5 >Emitted(172, 13) Source(177, 19) + SourceIndex(0) 6 >Emitted(172, 14) Source(177, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}; +1 >^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^^^-> +1 > >} 2 > -1->Emitted(173, 2) Source(178, 2) + SourceIndex(0) +1 >Emitted(173, 2) Source(178, 2) + SourceIndex(0) 2 >Emitted(173, 3) Source(178, 2) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t13 = ({ +1-> 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^-> 1-> > 2 >var @@ -3138,14 +3218,14 @@ sourceFile:contextualTyping.ts 4 >Emitted(174, 14) Source(179, 21) + SourceIndex(0) 5 >Emitted(174, 15) Source(179, 22) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->{ > 2 > f @@ -3162,49 +3242,50 @@ sourceFile:contextualTyping.ts 6 >Emitted(175, 21) Source(180, 20) + SourceIndex(0) 7 >Emitted(175, 22) Source(180, 21) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^^^^^ +>>> return s; +1 >^^^^^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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, 25) + SourceIndex(0) +1 >Emitted(176, 9) Source(180, 25) + SourceIndex(0) 2 >Emitted(176, 15) Source(180, 31) + SourceIndex(0) 3 >Emitted(176, 16) Source(180, 32) + SourceIndex(0) 4 >Emitted(176, 17) Source(180, 33) + SourceIndex(0) 5 >Emitted(176, 18) Source(180, 34) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> } +1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 > 2 > } -1->Emitted(177, 5) Source(180, 35) + SourceIndex(0) +1 >Emitted(177, 5) Source(180, 35) + SourceIndex(0) 2 >Emitted(177, 6) Source(180, 36) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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ted(178, 4) Source(181, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var c12t14 = ({ +1-> 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -3217,41 +3298,43 @@ sourceFile:contextualTyping.ts 4 >Emitted(179, 14) Source(182, 21) + SourceIndex(0) 5 >Emitted(179, 15) Source(182, 22) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> a: [] +1 >^^^^ 2 > ^ 3 > ^^ 4 > ^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->{ +1 >{ > 2 > a 3 > : 4 > [] -1->Emitted(180, 5) Source(183, 5) + SourceIndex(0) +1 >Emitted(180, 5) Source(183, 5) + SourceIndex(0) 2 >Emitted(180, 6) Source(183, 6) + SourceIndex(0) 3 >Emitted(180, 8) Source(183, 8) + SourceIndex(0) 4 >Emitted(180, 10) Source(183, 10) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}); +1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^-> +1 > >} 2 > ) 3 > -1->Emitted(181, 2) Source(184, 2) + SourceIndex(0) +1 >Emitted(181, 2) Source(184, 2) + SourceIndex(0) 2 >Emitted(181, 3) Source(184, 3) + SourceIndex(0) 3 >Emitted(181, 4) Source(184, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>function EF1(a, b) { +1-> 2 >^^^^^^^^^ 3 > ^^^ 4 > ^ 5 > ^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +8 > ^-> 1-> > >// CONTEXT: Contextual typing declarations @@ -3274,14 +3357,14 @@ sourceFile:contextualTyping.ts 6 >Emitted(182, 17) Source(191, 16) + SourceIndex(0) 7 >Emitted(182, 18) Source(191, 17) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return a + b; +1->^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^ 5 > ^^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->) { 2 > return 3 > @@ -3297,15 +3380,17 @@ sourceFile:contextualTyping.ts 6 >Emitted(183, 17) Source(191, 31) + SourceIndex(0) name (EF1) 7 >Emitted(183, 18) Source(191, 32) + SourceIndex(0) name (EF1) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^^^^^^^^^-> +1 > 2 >} -1->Emitted(184, 1) Source(191, 33) + SourceIndex(0) name (EF1) +1 >Emitted(184, 1) Source(191, 33) + SourceIndex(0) name (EF1) 2 >Emitted(184, 2) Source(191, 34) + SourceIndex(0) name (EF1) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var efv = EF1(1, 2); +1-> 2 >^^^^ 3 > ^^^ 4 > ^^^ @@ -3316,7 +3401,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^ -12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +12> ^^^-> 1-> > > @@ -3342,14 +3427,14 @@ sourceFile:contextualTyping.ts 10>Emitted(185, 20) Source(193, 19) + SourceIndex(0) 11>Emitted(185, 21) Source(193, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>function Point(x, y) { +1-> 2 >^^^^^^^^^ 3 > ^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -3379,15 +3464,16 @@ sourceFile:contextualTyping.ts 6 >Emitted(186, 19) Source(207, 19) + SourceIndex(0) 7 >Emitted(186, 20) Source(207, 20) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> this.x = x; +1 >^^^^ 2 > ^^^^ 3 > ^ 4 > ^ 5 > ^^^ 6 > ^ 7 > ^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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1->Emitted(187, 5) Source(208, 5) + SourceIndex(0) name (Point) +1 >Emitted(187, 5) Source(208, 5) + SourceIndex(0) name (Point) 2 >Emitted(187, 9) Source(208, 9) + SourceIndex(0) name (Point) 3 >Emitted(187, 10) Source(208, 10) + SourceIndex(0) name (Point) 4 >Emitted(187, 11) Source(208, 11) + SourceIndex(0) name (Point) @@ -3403,14 +3489,15 @@ sourceFile:contextualTyping.ts 6 >Emitted(187, 15) Source(208, 15) + SourceIndex(0) name (Point) 7 >Emitted(187, 16) Source(208, 16) + SourceIndex(0) name (Point) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +8 > ^^-> 1-> > 2 > this @@ -3427,12 +3514,12 @@ sourceFile:contextualTyping.ts 6 >Emitted(188, 15) Source(209, 15) + SourceIndex(0) name (Point) 7 >Emitted(188, 16) Source(209, 16) + SourceIndex(0) name (Point) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return this; +1->^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^^^^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -3446,16 +3533,18 @@ sourceFile:contextualTyping.ts 4 >Emitted(189, 16) Source(211, 16) + SourceIndex(0) name (Point) 5 >Emitted(189, 17) Source(211, 17) + SourceIndex(0) name (Point) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>} +1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > > 2 >} -1->Emitted(190, 1) Source(212, 1) + SourceIndex(0) name (Point) +1 >Emitted(190, 1) Source(212, 1) + SourceIndex(0) name (Point) 2 >Emitted(190, 2) Source(212, 2) + SourceIndex(0) name (Point) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>Point.origin = new Point(0, 0); +1-> 2 >^^^^^ 3 > ^ 4 > ^^^^^^ @@ -3468,7 +3557,7 @@ sourceFile:contextualTyping.ts 11> ^ 12> ^ 13> ^ -14> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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31) Source(214, 31) + SourceIndex(0) 13>Emitted(191, 32) Source(214, 32) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>Point.prototype.add = function (dx, dy) { +1-> 2 >^^^^^ 3 > ^ 4 > ^^^^^^^^^ @@ -3509,7 +3599,7 @@ sourceFile:contextualTyping.ts 9 > ^^ 10> ^^ 11> ^^ -12> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +12> ^^^^^^^^^^-> 1-> > > @@ -3535,7 +3625,8 @@ sourceFile:contextualTyping.ts 10>Emitted(192, 37) Source(216, 36) + SourceIndex(0) 11>Emitted(192, 39) Source(216, 38) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> return new Point(this.x + dx, this.y + dy); +1->^^^^ 2 > ^^^^^^ 3 > ^ 4 > ^^^^ @@ -3554,7 +3645,6 @@ sourceFile:contextualTyping.ts 17> ^^ 18> ^ 19> ^ -20> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->) { > 2 > return @@ -3595,24 +3685,25 @@ sourceFile:contextualTyping.ts 18>Emitted(193, 47) Source(217, 47) + SourceIndex(0) 19>Emitted(193, 48) Source(217, 48) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>}; +1 > 2 >^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +4 > ^^^^^^^^^^^^^^^^^^-> +1 > > 2 >} 3 > ; -1->Emitted(194, 1) Source(218, 1) + SourceIndex(0) +1 >Emitted(194, 1) Source(218, 1) + SourceIndex(0) 2 >Emitted(194, 2) Source(218, 2) + SourceIndex(0) 3 >Emitted(194, 3) Source(218, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>Point.prototype = { +1-> 2 >^^^^^ 3 > ^ 4 > ^^^^^^^^^ 5 > ^^^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -3626,26 +3717,28 @@ sourceFile:contextualTyping.ts 4 >Emitted(195, 16) Source(220, 16) + SourceIndex(0) 5 >Emitted(195, 19) Source(220, 19) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> x: 0, +1 >^^^^ 2 > ^ 3 > ^^ 4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->{ +5 > ^^-> +1 >{ > 2 > x 3 > : 4 > 0 -1->Emitted(196, 5) Source(221, 5) + SourceIndex(0) +1 >Emitted(196, 5) Source(221, 5) + SourceIndex(0) 2 >Emitted(196, 6) Source(221, 6) + SourceIndex(0) 3 >Emitted(196, 8) Source(221, 8) + SourceIndex(0) 4 >Emitted(196, 9) Source(221, 9) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^-> 1->, > 2 > y @@ -3656,14 +3749,15 @@ sourceFile:contextualTyping.ts 3 >Emitted(197, 8) Source(222, 8) + SourceIndex(0) 4 >Emitted(197, 9) Source(222, 9) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> add: function (dx, dy) { +1->^^^^ 2 > ^^^ 3 > ^^ 4 > ^^^^^^^^^^ 5 > ^^ 6 > ^^ 7 > ^^ -8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->, > 2 > add @@ -3680,7 +3774,8 @@ sourceFile:contextualTyping.ts 6 >Emitted(198, 24) Source(223, 23) + SourceIndex(0) 7 >Emitted(198, 26) Source(223, 25) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextual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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->) { > 2 > return @@ -3740,31 +3834,33 @@ sourceFile:contextualTyping.ts 18>Emitted(199, 51) Source(224, 51) + SourceIndex(0) 19>Emitted(199, 52) Source(224, 52) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^^^^ +>>> } +1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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(0) +1 >Emitted(200, 5) Source(225, 5) + SourceIndex(0) 2 >Emitted(200, 6) Source(225, 6) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1->^ +>>>}; +1 >^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +3 > ^^^^^^^^^^-> +1 > >} 2 > ; -1->Emitted(201, 2) Source(226, 2) + SourceIndex(0) +1 >Emitted(201, 2) Source(226, 2) + SourceIndex(0) 2 >Emitted(201, 3) Source(226, 3) + SourceIndex(0) --- ->>>// CONTEXT: Class property declaration\nvar C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\n// CONTEXT: Module property declaration\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\n// CONTEXT: Variable declaration\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\n// CONTEXT: Class property assignment\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\n// CONTEXT: Module property assignment\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\n// CONTEXT: Variable assignment\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\n// CONTEXT: Array index assignment\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\n// CONTEXT: Function call\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\n// CONTEXT: Return statement\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\n// CONTEXT: Newing a class\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\n// CONTEXT: Type annotated expression\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map1-> +>>>var x = {}; +1-> 2 >^^^^ 3 > ^ 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >interface A { x: string; } @@ -3781,4 +3877,5 @@ sourceFile:contextualTyping.ts 4 >Emitted(202, 9) Source(230, 12) + SourceIndex(0) 5 >Emitted(202, 11) Source(230, 15) + SourceIndex(0) 6 >Emitted(202, 12) Source(230, 16) + SourceIndex(0) ---- \ No newline at end of file +--- +>>>//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping1.js b/tests/baselines/reference/contextualTyping1.js index 7ceb3b582e5..7f1e12c744b 100644 --- a/tests/baselines/reference/contextualTyping1.js +++ b/tests/baselines/reference/contextualTyping1.js @@ -2,4 +2,4 @@ var foo: {id:number;} = {id:4}; //// [contextualTyping1.js] -var foo = { id: 4 }; +var foo = { id: 4 };\n \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfAccessors.js b/tests/baselines/reference/contextualTypingOfAccessors.js new file mode 100644 index 00000000000..45463936831 --- /dev/null +++ b/tests/baselines/reference/contextualTypingOfAccessors.js @@ -0,0 +1,25 @@ +//// [contextualTypingOfAccessors.ts] +// not contextually typing accessors + +var x: { + foo: (x: number) => number; +} + +x = { + get foo() { + return (n)=>n + }, + set foo(x) {} +} + + +//// [contextualTypingOfAccessors.js] +// not contextually typing accessors +var x; +x = { + get foo() { + return function (n) { return n; }; + }, + set foo(x) { + } +}; diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt index f7bac878950..c7b15e8efef 100644 --- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt +++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(16,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. + Type 'string' is not assignable to type 'Date'. tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. + Type 'string' is not assignable to type 'Date'. ==== tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts (2 errors) ==== @@ -21,7 +23,9 @@ tests/cases/compiler/contextualTypingOfGenericFunctionTypedArguments1.ts(17,32): var r5 = _.forEach(c2, f); ~ !!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. +!!! error TS2345: Type 'string' is not assignable to type 'Date'. var r6 = _.forEach(c2, (x) => { return x.toFixed() }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number) => string' is not assignable to parameter of type '(x: number) => Date'. +!!! error TS2345: Type 'string' is not assignable to type 'Date'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt b/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt index 5d41b312f72..ac8063a4378 100644 --- a/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt +++ b/tests/baselines/reference/contextualTypingOfObjectLiterals.errors.txt @@ -1,6 +1,7 @@ tests/cases/compiler/contextualTypingOfObjectLiterals.ts(4,1): error TS2322: Type '{ x: string; }' is not assignable to type '{ [x: string]: string; }'. Index signature is missing in type '{ x: string; }'. tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'. + Index signature is missing in type '{ x: string; }'. ==== tests/cases/compiler/contextualTypingOfObjectLiterals.ts (2 errors) ==== @@ -18,4 +19,5 @@ tests/cases/compiler/contextualTypingOfObjectLiterals.ts(10,3): error TS2345: Ar f(obj1); // Ok f(obj2); // Error - indexer doesn't match ~~~~ -!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'. \ No newline at end of file +!!! error TS2345: Argument of type '{ x: string; }' is not assignable to parameter of type '{ [s: string]: string; }'. +!!! error TS2345: Index signature is missing in type '{ x: string; }'. \ No newline at end of file diff --git a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt index adfb1c68b7a..251a3a1bde3 100644 --- a/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt +++ b/tests/baselines/reference/contextualTypingWithFixedTypeParameters1.errors.txt @@ -1,7 +1,6 @@ tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(2,22): error TS2339: Property 'foo' does not exist on type 'string'. -tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. - Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'T'. -tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,32): error TS2339: Property 'foo' does not exist on type 'T'. +tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,32): error TS2339: Property 'foo' does not exist on type 'string'. +tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,38): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ==== tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts (3 errors) ==== @@ -10,8 +9,7 @@ tests/cases/compiler/contextualTypingWithFixedTypeParameters1.ts(3,32): error TS ~~~ !!! error TS2339: Property 'foo' does not exist on type 'string'. var r9 = f10('', () => (a => a.foo), 1); // error - ~~~ -!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. -!!! error TS2453: Type argument candidate 'string' is not a valid type argument because it is not a supertype of candidate 'T'. ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'T'. \ No newline at end of file +!!! error TS2339: Property 'foo' does not exist on type 'string'. + ~ +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/continueNotInIterationStatement1.js b/tests/baselines/reference/continueNotInIterationStatement1.js new file mode 100644 index 00000000000..b6fd1786cdf --- /dev/null +++ b/tests/baselines/reference/continueNotInIterationStatement1.js @@ -0,0 +1,5 @@ +//// [continueNotInIterationStatement1.ts] +continue; + +//// [continueNotInIterationStatement1.js] +continue; diff --git a/tests/baselines/reference/continueNotInIterationStatement2.js b/tests/baselines/reference/continueNotInIterationStatement2.js new file mode 100644 index 00000000000..047c3b49f06 --- /dev/null +++ b/tests/baselines/reference/continueNotInIterationStatement2.js @@ -0,0 +1,13 @@ +//// [continueNotInIterationStatement2.ts] +while (true) { + function f() { + continue; + } +} + +//// [continueNotInIterationStatement2.js] +while (true) { + function f() { + continue; + } +} diff --git a/tests/baselines/reference/continueNotInIterationStatement3.js b/tests/baselines/reference/continueNotInIterationStatement3.js new file mode 100644 index 00000000000..11018019871 --- /dev/null +++ b/tests/baselines/reference/continueNotInIterationStatement3.js @@ -0,0 +1,11 @@ +//// [continueNotInIterationStatement3.ts] +switch (0) { + default: + continue; +} + +//// [continueNotInIterationStatement3.js] +switch (0) { + default: + continue; +} diff --git a/tests/baselines/reference/continueNotInIterationStatement4.js b/tests/baselines/reference/continueNotInIterationStatement4.js new file mode 100644 index 00000000000..f3f52ecb48c --- /dev/null +++ b/tests/baselines/reference/continueNotInIterationStatement4.js @@ -0,0 +1,15 @@ +//// [continueNotInIterationStatement4.ts] +TWO: +while (true){ + var x = () => { + continue TWO; + } +} + + +//// [continueNotInIterationStatement4.js] +TWO: while (true) { + var x = function () { + continue TWO; + }; +} diff --git a/tests/baselines/reference/continueTarget1.js b/tests/baselines/reference/continueTarget1.js new file mode 100644 index 00000000000..07e5a7b9b50 --- /dev/null +++ b/tests/baselines/reference/continueTarget1.js @@ -0,0 +1,6 @@ +//// [continueTarget1.ts] +target: + continue target; + +//// [continueTarget1.js] +target: continue target; diff --git a/tests/baselines/reference/continueTarget5.js b/tests/baselines/reference/continueTarget5.js new file mode 100644 index 00000000000..5bf309d2690 --- /dev/null +++ b/tests/baselines/reference/continueTarget5.js @@ -0,0 +1,18 @@ +//// [continueTarget5.ts] +target: +while (true) { + function f() { + while (true) { + continue target; + } + } +} + +//// [continueTarget5.js] +target: while (true) { + function f() { + while (true) { + continue target; + } + } +} diff --git a/tests/baselines/reference/continueTarget6.js b/tests/baselines/reference/continueTarget6.js new file mode 100644 index 00000000000..aefa8e97652 --- /dev/null +++ b/tests/baselines/reference/continueTarget6.js @@ -0,0 +1,9 @@ +//// [continueTarget6.ts] +while (true) { + continue target; +} + +//// [continueTarget6.js] +while (true) { + continue target; +} diff --git a/tests/baselines/reference/createArray.js b/tests/baselines/reference/createArray.js new file mode 100644 index 00000000000..82572e05cad --- /dev/null +++ b/tests/baselines/reference/createArray.js @@ -0,0 +1,34 @@ +//// [createArray.ts] +var na=new number[]; + +class C { +} + +new C[]; +var ba=new boolean[]; +var sa=new string[]; +function f(s:string):number { return 0; +} +if (ba[14]) { + na[2]=f(sa[3]); +} + +new C[1]; // not an error + +//// [createArray.js] +var na = new number[]; +var C = (function () { + function C() { + } + return C; +})(); +new C[]; +var ba = new boolean[]; +var sa = new string[]; +function f(s) { + return 0; +} +if (ba[14]) { + na[2] = f(sa[3]); +} +new C[1]; // not an error diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js new file mode 100644 index 00000000000..7d7c6ee73d3 --- /dev/null +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js @@ -0,0 +1,41 @@ +//// [declFileObjectLiteralWithAccessors.ts] + +function /*1*/makePoint(x: number) { + return { + b: 10, + get x() { return x; }, + set x(a: number) { this.b = a; } + }; +}; +var /*4*/point = makePoint(2); +var /*2*/x = point.x; +point./*3*/x = 30; + +//// [declFileObjectLiteralWithAccessors.js] +function makePoint(x) { + return { + b: 10, + get x() { + return x; + }, + set x(a) { + this.b = a; + } + }; +} +; +var point = makePoint(2); +var x = point.x; +point.x = 30; + + +//// [declFileObjectLiteralWithAccessors.d.ts] +declare function makePoint(x: number): { + b: number; + x: number; +}; +declare var point: { + b: number; + x: number; +}; +declare var x: number; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js new file mode 100644 index 00000000000..b3d41829637 --- /dev/null +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js @@ -0,0 +1,32 @@ +//// [declFileObjectLiteralWithOnlyGetter.ts] + +function /*1*/makePoint(x: number) { + return { + get x() { return x; }, + }; +}; +var /*4*/point = makePoint(2); +var /*2*/x = point./*3*/x; + + +//// [declFileObjectLiteralWithOnlyGetter.js] +function makePoint(x) { + return { + get x() { + return x; + } + }; +} +; +var point = makePoint(2); +var x = point.x; + + +//// [declFileObjectLiteralWithOnlyGetter.d.ts] +declare function makePoint(x: number): { + x: number; +}; +declare var point: { + x: number; +}; +declare var x: number; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js new file mode 100644 index 00000000000..dae362caf36 --- /dev/null +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js @@ -0,0 +1,34 @@ +//// [declFileObjectLiteralWithOnlySetter.ts] + +function /*1*/makePoint(x: number) { + return { + b: 10, + set x(a: number) { this.b = a; } + }; +}; +var /*3*/point = makePoint(2); +point./*2*/x = 30; + +//// [declFileObjectLiteralWithOnlySetter.js] +function makePoint(x) { + return { + b: 10, + set x(a) { + this.b = a; + } + }; +} +; +var point = makePoint(2); +point.x = 30; + + +//// [declFileObjectLiteralWithOnlySetter.d.ts] +declare function makePoint(x: number): { + b: number; + x: number; +}; +declare var point: { + b: number; + x: number; +}; diff --git a/tests/baselines/reference/declFilePrivateStatic.js b/tests/baselines/reference/declFilePrivateStatic.js new file mode 100644 index 00000000000..5bec38e4dee --- /dev/null +++ b/tests/baselines/reference/declFilePrivateStatic.js @@ -0,0 +1,67 @@ +//// [declFilePrivateStatic.ts] + +class C { + private static x = 1; + static y = 1; + + private static a() { } + static b() { } + + private static get c() { return 1; } + static get d() { return 1; } + + private static set e(v) { } + static set f(v) { } +} + +//// [declFilePrivateStatic.js] +var C = (function () { + function C() { + } + C.a = function () { + }; + C.b = function () { + }; + Object.defineProperty(C, "c", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "d", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "e", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "f", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + C.x = 1; + C.y = 1; + return C; +})(); + + +//// [declFilePrivateStatic.d.ts] +declare class C { + private static x; + static y: number; + private static a(); + static b(): void; + private static c; + static d: number; + private static e; + static f: any; +} diff --git a/tests/baselines/reference/declInput.js b/tests/baselines/reference/declInput.js index 94c825d87f0..39d466498fa 100644 --- a/tests/baselines/reference/declInput.js +++ b/tests/baselines/reference/declInput.js @@ -28,3 +28,17 @@ var bar = (function () { }; return bar; })(); + + +//// [declInput.d.ts] +interface bar { +} +declare class bar { + f(): string; + g(): { + a: bar; + b: any; + c: any; + }; + h(x?: number, y?: any, z?: string): void; +} diff --git a/tests/baselines/reference/declarationEmit_invalidReference2.js b/tests/baselines/reference/declarationEmit_invalidReference2.js new file mode 100644 index 00000000000..78fb232cca7 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_invalidReference2.js @@ -0,0 +1,11 @@ +//// [declarationEmit_invalidReference2.ts] +/// +var x = 0; + +//// [declarationEmit_invalidReference2.js] +/// +var x = 0; + + +//// [declarationEmit_invalidReference2.d.ts] +declare var x: number; diff --git a/tests/baselines/reference/declarationInAmbientContext.js b/tests/baselines/reference/declarationInAmbientContext.js new file mode 100644 index 00000000000..eb39bccc818 --- /dev/null +++ b/tests/baselines/reference/declarationInAmbientContext.js @@ -0,0 +1,6 @@ +//// [declarationInAmbientContext.ts] +declare var [a, b]; // Error, destructuring declaration not allowed in ambient context +declare var {c, d}; // Error, destructuring declaration not allowed in ambient context + + +//// [declarationInAmbientContext.js] diff --git a/tests/baselines/reference/declarationWithNoInitializer.js b/tests/baselines/reference/declarationWithNoInitializer.js new file mode 100644 index 00000000000..54d89368fb1 --- /dev/null +++ b/tests/baselines/reference/declarationWithNoInitializer.js @@ -0,0 +1,8 @@ +//// [declarationWithNoInitializer.ts] +var [a, b]; // Error, no initializer +var {c, d}; // Error, no initializer + + +//// [declarationWithNoInitializer.js] +var _a = void 0, a = _a[0], b = _a[1]; // Error, no initializer +var _b = void 0, c = _b.c, d = _b.d; // Error, no initializer diff --git a/tests/baselines/reference/declareAlreadySeen.js b/tests/baselines/reference/declareAlreadySeen.js new file mode 100644 index 00000000000..51421a67cb7 --- /dev/null +++ b/tests/baselines/reference/declareAlreadySeen.js @@ -0,0 +1,14 @@ +//// [declareAlreadySeen.ts] +module M { + declare declare var x; + declare declare function f(); + + declare declare module N { } + + declare declare class C { } +} + +//// [declareAlreadySeen.js] +var M; +(function (M) { +})(M || (M = {})); diff --git a/tests/baselines/reference/declareModifierOnImport1.js b/tests/baselines/reference/declareModifierOnImport1.js new file mode 100644 index 00000000000..510407b4deb --- /dev/null +++ b/tests/baselines/reference/declareModifierOnImport1.js @@ -0,0 +1,4 @@ +//// [declareModifierOnImport1.ts] +declare import a = b; + +//// [declareModifierOnImport1.js] diff --git a/tests/baselines/reference/deleteOperatorInStrictMode.js b/tests/baselines/reference/deleteOperatorInStrictMode.js new file mode 100644 index 00000000000..3fcf8dd836b --- /dev/null +++ b/tests/baselines/reference/deleteOperatorInStrictMode.js @@ -0,0 +1,9 @@ +//// [deleteOperatorInStrictMode.ts] +"use strict" +var a; +delete a; + +//// [deleteOperatorInStrictMode.js] +"use strict"; +var a; +delete a; diff --git a/tests/baselines/reference/deleteOperatorInvalidOperations.js b/tests/baselines/reference/deleteOperatorInvalidOperations.js new file mode 100644 index 00000000000..fd15797698e --- /dev/null +++ b/tests/baselines/reference/deleteOperatorInvalidOperations.js @@ -0,0 +1,33 @@ +//// [deleteOperatorInvalidOperations.ts] +// Unary operator delete +var ANY; + +// operand before delete operator +var BOOLEAN1 = ANY delete ; //expect error + +// miss an operand +var BOOLEAN2 = delete ; + +// delete global variable s +class testADelx { + constructor(public s: () => {}) { + delete s; //expect error + } +} + +//// [deleteOperatorInvalidOperations.js] +// Unary operator delete +var ANY; +// operand before delete operator +var BOOLEAN1 = ANY; +delete ; //expect error +// miss an operand +var BOOLEAN2 = delete ; +// delete global variable s +var testADelx = (function () { + function testADelx(s) { + this.s = s; + delete s; //expect error + } + return testADelx; +})(); diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js new file mode 100644 index 00000000000..615c3e7f7a6 --- /dev/null +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -0,0 +1,48 @@ +//// [derivedClassFunctionOverridesBaseClassAccessor.ts] +class Base { + get x() { + return 1; + } + set x(v) { + } +} + +// error +class Derived extends Base { + x() { + return 1; + } +} + +//// [derivedClassFunctionOverridesBaseClassAccessor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Object.defineProperty(Base.prototype, "x", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +// error +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + } + Derived.prototype.x = function () { + return 1; + }; + return Derived; +})(Base); diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js new file mode 100644 index 00000000000..db54affa6d9 --- /dev/null +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -0,0 +1,107 @@ +//// [derivedClassIncludesInheritedMembers.ts] +class Base { + a: string; + b() { } + get c() { return ''; } + set c(v) { } + + static r: string; + static s() { } + static get t() { return ''; } + static set t(v) { } + + constructor(x) { } +} + +class Derived extends Base { +} + +var d: Derived = new Derived(1); +var r1 = d.a; +var r2 = d.b(); +var r3 = d.c; +d.c = ''; +var r4 = Derived.r; +var r5 = Derived.s(); +var r6 = Derived.t; +Derived.t = ''; + +class Base2 { + [x: string]: Object; + [x: number]: Date; +} + +class Derived2 extends Base2 { +} + +var d2: Derived2; +var r7 = d2['']; +var r8 = d2[1]; + + + +//// [derivedClassIncludesInheritedMembers.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base(x) { + } + Base.prototype.b = function () { + }; + Object.defineProperty(Base.prototype, "c", { + get: function () { + return ''; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Base.s = function () { + }; + Object.defineProperty(Base, "t", { + get: function () { + return ''; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + } + return Derived; +})(Base); +var d = new Derived(1); +var r1 = d.a; +var r2 = d.b(); +var r3 = d.c; +d.c = ''; +var r4 = Derived.r; +var r5 = Derived.s(); +var r6 = Derived.t; +Derived.t = ''; +var Base2 = (function () { + function Base2() { + } + return Base2; +})(); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +})(Base2); +var d2; +var r7 = d2['']; +var r8 = d2[1]; diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js new file mode 100644 index 00000000000..f673d9ab856 --- /dev/null +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -0,0 +1,155 @@ +//// [derivedClassOverridesPublicMembers.ts] +var x: { foo: string; } +var y: { foo: string; bar: string; } + +class Base { + a: typeof x; + b(a: typeof x) { } + get c() { return x; } + set c(v: typeof x) { } + d: (a: typeof x) => void; + + static r: typeof x; + static s(a: typeof x) { } + static get t() { return x; } + static set t(v: typeof x) { } + static u: (a: typeof x) => void; + + constructor(a: typeof x) { } +} + +class Derived extends Base { + a: typeof y; + b(a: typeof y) { } + get c() { return y; } + set c(v: typeof y) { } + d: (a: typeof y) => void; + + static r: typeof y; + static s(a: typeof y) { } + static get t() { return y; } + static set t(a: typeof y) { } + static u: (a: typeof y) => void; + + constructor(a: typeof y) { super(x) } +} + +var d: Derived = new Derived(y); +var r1 = d.a; +var r2 = d.b(y); +var r3 = d.c; +var r3a = d.d; +d.c = y; +var r4 = Derived.r; +var r5 = Derived.s(y); +var r6 = Derived.t; +var r6a = Derived.u; +Derived.t = y; + +class Base2 { + [i: string]: Object; + [i: number]: typeof x; +} + +class Derived2 extends Base2 { + [i: string]: typeof x; + [i: number]: typeof y; +} + +var d2: Derived2; +var r7 = d2['']; +var r8 = d2[1]; + + + +//// [derivedClassOverridesPublicMembers.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var x; +var y; +var Base = (function () { + function Base(a) { + } + Base.prototype.b = function (a) { + }; + Object.defineProperty(Base.prototype, "c", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Base.s = function (a) { + }; + Object.defineProperty(Base, "t", { + get: function () { + return x; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived(a) { + _super.call(this, x); + } + Derived.prototype.b = function (a) { + }; + Object.defineProperty(Derived.prototype, "c", { + get: function () { + return y; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Derived.s = function (a) { + }; + Object.defineProperty(Derived, "t", { + get: function () { + return y; + }, + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return Derived; +})(Base); +var d = new Derived(y); +var r1 = d.a; +var r2 = d.b(y); +var r3 = d.c; +var r3a = d.d; +d.c = y; +var r4 = Derived.r; +var r5 = Derived.s(y); +var r6 = Derived.t; +var r6a = Derived.u; +Derived.t = y; +var Base2 = (function () { + function Base2() { + } + return Base2; +})(); +var Derived2 = (function (_super) { + __extends(Derived2, _super); + function Derived2() { + _super.apply(this, arguments); + } + return Derived2; +})(Base2); +var d2; +var r7 = d2['']; +var r8 = d2[1]; diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js new file mode 100644 index 00000000000..14ac1f47e2f --- /dev/null +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -0,0 +1,83 @@ +//// [derivedClassSuperCallsInNonConstructorMembers.ts] +// error to use super calls outside a constructor + +class Base { + x: string; +} + +class Derived extends Base { + a: super(); + b() { + super(); + } + get C() { + super(); + return 1; + } + set C(v) { + super(); + } + + static a: super(); + static b() { + super(); + } + static get C() { + super(); + return 1; + } + static set C(v) { + super(); + } +} + +//// [derivedClassSuperCallsInNonConstructorMembers.js] +// error to use super calls outside a constructor +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + this.a = _super.call(this); + } + Derived.prototype.b = function () { + _super.call(this); + }; + Object.defineProperty(Derived.prototype, "C", { + get: function () { + _super.call(this); + return 1; + }, + set: function (v) { + _super.call(this); + }, + enumerable: true, + configurable: true + }); + Derived.b = function () { + _super.call(this); + }; + Object.defineProperty(Derived, "C", { + get: function () { + _super.call(this); + return 1; + }, + set: function (v) { + _super.call(this); + }, + enumerable: true, + configurable: true + }); + Derived.a = _super.call(this); + return Derived; +})(Base); diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js new file mode 100644 index 00000000000..0b568eaec9b --- /dev/null +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -0,0 +1,154 @@ +//// [derivedClassWithAny.ts] +class C { + x: number; + get X(): number { return 1; } + foo(): number { + return 1; + } + + static y: number; + static get Y(): number { + return 1; + } + static bar(): number { + return 1; + } +} + +class D extends C { + x: any; + get X(): any { + return null; + } + foo(): any { + return 1; + } + + static y: any; + static get Y(): any { + return null; + } + static bar(): any { + return null; + } +} + +// if D is a valid class definition than E is now not safe tranisitively through C +class E extends D { + x: string; + get X(): string{ return ''; } + foo(): string { + return ''; + } + + static y: string; + static get Y(): string { + return ''; + } + static bar(): string { + return ''; + } +} + +var c: C; +var d: D; +var e: E; + +c = d; +c = e; +var r = c.foo(); // e.foo would return string + + +//// [derivedClassWithAny.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "X", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + return 1; + }; + Object.defineProperty(C, "Y", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + C.bar = function () { + return 1; + }; + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "X", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + D.prototype.foo = function () { + return 1; + }; + Object.defineProperty(D, "Y", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + D.bar = function () { + return null; + }; + return D; +})(C); +// if D is a valid class definition than E is now not safe tranisitively through C +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + Object.defineProperty(E.prototype, "X", { + get: function () { + return ''; + }, + enumerable: true, + configurable: true + }); + E.prototype.foo = function () { + return ''; + }; + Object.defineProperty(E, "Y", { + get: function () { + return ''; + }, + enumerable: true, + configurable: true + }); + E.bar = function () { + return ''; + }; + return E; +})(D); +var c; +var d; +var e; +c = d; +c = e; +var r = c.foo(); // e.foo would return string diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js new file mode 100644 index 00000000000..fb0dee3e57b --- /dev/null +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -0,0 +1,86 @@ +//// [derivedClassWithPrivateInstanceShadowingPublicInstance.ts] +class Base { + public x: string; + public fn(): string { + return ''; + } + + public get a() { return 1; } + public set a(v) { } +} + +// error, not a subtype +class Derived extends Base { + private x: string; + private fn(): string { + return ''; + } + + private get a() { return 1; } + private set a(v) { } +} + +var r = Base.x; // ok +var r2 = Derived.x; // error + +var r3 = Base.fn(); // ok +var r4 = Derived.fn(); // error + +var r5 = Base.a; // ok +Base.a = 2; // ok + +var r6 = Derived.a; // error +Derived.a = 2; // error + +//// [derivedClassWithPrivateInstanceShadowingPublicInstance.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.fn = function () { + return ''; + }; + Object.defineProperty(Base.prototype, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +// error, not a subtype +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + } + Derived.prototype.fn = function () { + return ''; + }; + Object.defineProperty(Derived.prototype, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Derived; +})(Base); +var r = Base.x; // ok +var r2 = Derived.x; // error +var r3 = Base.fn(); // ok +var r4 = Derived.fn(); // error +var r5 = Base.a; // ok +Base.a = 2; // ok +var r6 = Derived.a; // error +Derived.a = 2; // error diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js new file mode 100644 index 00000000000..b2468f62d81 --- /dev/null +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -0,0 +1,88 @@ +//// [derivedClassWithPrivateStaticShadowingPublicStatic.ts] +class Base { + public static x: string; + public static fn(): string { + return ''; + } + + public static get a() { return 1; } + public static set a(v) { } +} + +// BUG 847404 +// should be error +class Derived extends Base { + private static x: string; + private static fn(): string { + return ''; + } + + private static get a() { return 1; } + private static set a(v) { } +} + +var r = Base.x; // ok +var r2 = Derived.x; // error + +var r3 = Base.fn(); // ok +var r4 = Derived.fn(); // error + +var r5 = Base.a; // ok +Base.a = 2; // ok + +var r6 = Derived.a; // error +Derived.a = 2; // error + +//// [derivedClassWithPrivateStaticShadowingPublicStatic.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.fn = function () { + return ''; + }; + Object.defineProperty(Base, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Base; +})(); +// BUG 847404 +// should be error +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + _super.apply(this, arguments); + } + Derived.fn = function () { + return ''; + }; + Object.defineProperty(Derived, "a", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return Derived; +})(Base); +var r = Base.x; // ok +var r2 = Derived.x; // error +var r3 = Base.fn(); // ok +var r4 = Derived.fn(); // error +var r5 = Base.a; // ok +Base.a = 2; // ok +var r6 = Derived.a; // error +Derived.a = 2; // error diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js new file mode 100644 index 00000000000..677fadf3876 --- /dev/null +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -0,0 +1,118 @@ +//// [derivedGenericClassWithAny.ts] +class C { + x: T; + get X(): T { return null; } + foo(): T { + return null; + } +} + +class D extends C { + x: any; + get X(): any { + return null; + } + foo(): any { + return 1; + } + + static y: any; + static get Y(): any { + return null; + } + static bar(): any { + return null; + } +} + +// if D is a valid class definition than E is now not safe tranisitively through C +class E extends D { + x: T; + get X(): T { return ''; } // error + foo(): T { + return ''; // error + } +} + +var c: C; +var d: D; +var e: E; + +c = d; +c = e; +var r = c.foo(); // e.foo would return string + +//// [derivedGenericClassWithAny.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "X", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + return null; + }; + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "X", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + D.prototype.foo = function () { + return 1; + }; + Object.defineProperty(D, "Y", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + D.bar = function () { + return null; + }; + return D; +})(C); +// if D is a valid class definition than E is now not safe tranisitively through C +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + Object.defineProperty(E.prototype, "X", { + get: function () { + return ''; + } // error + , + enumerable: true, + configurable: true + }); + E.prototype.foo = function () { + return ''; // error + }; + return E; +})(D); +var c; +var d; +var e; +c = d; +c = e; +var r = c.foo(); // e.foo would return string diff --git a/tests/baselines/reference/destructuringParameterProperties2.errors.txt b/tests/baselines/reference/destructuringParameterProperties2.errors.txt index 61c0e61611a..bc7588a853d 100644 --- a/tests/baselines/reference/destructuringParameterProperties2.errors.txt +++ b/tests/baselines/reference/destructuringParameterProperties2.errors.txt @@ -6,6 +6,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(9 tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(13,21): error TS2339: Property 'b' does not exist on type 'C1'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(17,21): error TS2339: Property 'c' does not exist on type 'C1'. tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(21,27): error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'. + Types of property '2' are incompatible. + Type 'string' is not assignable to type 'boolean'. ==== tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts (8 errors) ==== @@ -46,6 +48,8 @@ tests/cases/conformance/es6/destructuring/destructuringParameterProperties2.ts(2 var x = new C1(undefined, [0, undefined, ""]); ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '[number, undefined, string]' is not assignable to parameter of type '[number, string, boolean]'. +!!! error TS2345: Types of property '2' are incompatible. +!!! error TS2345: Type 'string' is not assignable to type 'boolean'. var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()]; var y = new C1(10, [0, "", true]); diff --git a/tests/baselines/reference/differentTypesWithSameName.errors.txt b/tests/baselines/reference/differentTypesWithSameName.errors.txt new file mode 100644 index 00000000000..b0850ee7f41 --- /dev/null +++ b/tests/baselines/reference/differentTypesWithSameName.errors.txt @@ -0,0 +1,24 @@ +tests/cases/compiler/differentTypesWithSameName.ts(16,15): error TS2345: Argument of type 'variable' is not assignable to parameter of type 'm.variable'. + Property 's' is missing in type 'variable'. + + +==== tests/cases/compiler/differentTypesWithSameName.ts (1 errors) ==== + module m { + export class variable{ + s: string; + } + export function doSomething(v: m.variable) { + + } + } + + class variable { + t: number; + } + + + var v: variable = new variable(); + m.doSomething(v); + ~ +!!! error TS2345: Argument of type 'variable' is not assignable to parameter of type 'm.variable'. +!!! error TS2345: Property 's' is missing in type 'variable'. \ No newline at end of file diff --git a/tests/baselines/reference/differentTypesWithSameName.js b/tests/baselines/reference/differentTypesWithSameName.js new file mode 100644 index 00000000000..54a7a0f43bd --- /dev/null +++ b/tests/baselines/reference/differentTypesWithSameName.js @@ -0,0 +1,38 @@ +//// [differentTypesWithSameName.ts] +module m { + export class variable{ + s: string; + } + export function doSomething(v: m.variable) { + + } +} + +class variable { + t: number; +} + + +var v: variable = new variable(); +m.doSomething(v); + +//// [differentTypesWithSameName.js] +var m; +(function (m) { + var variable = (function () { + function variable() { + } + return variable; + })(); + m.variable = variable; + function doSomething(v) { + } + m.doSomething = doSomething; +})(m || (m = {})); +var variable = (function () { + function variable() { + } + return variable; +})(); +var v = new variable(); +m.doSomething(v); diff --git a/tests/baselines/reference/dontShowCompilerGeneratedMembers.js b/tests/baselines/reference/dontShowCompilerGeneratedMembers.js new file mode 100644 index 00000000000..5815e49c893 --- /dev/null +++ b/tests/baselines/reference/dontShowCompilerGeneratedMembers.js @@ -0,0 +1,9 @@ +//// [dontShowCompilerGeneratedMembers.ts] +var f: { + x: number; + <- +}; + +//// [dontShowCompilerGeneratedMembers.js] +var f = -; +; diff --git a/tests/baselines/reference/dottedModuleName.js b/tests/baselines/reference/dottedModuleName.js new file mode 100644 index 00000000000..6a8f33ca7bb --- /dev/null +++ b/tests/baselines/reference/dottedModuleName.js @@ -0,0 +1,55 @@ +//// [dottedModuleName.ts] +module M { + export module N { + export function f(x:number)=>2*x; + export module X.Y.Z { + export var v2=f(v); + } + } +} + + + +module M.N { + export module X { + export module Y.Z { + export var v=f(10); + } + } +} + + +//// [dottedModuleName.js] +var M; +(function (M) { + var N; + (function (N) { + 2 * x; + var X; + (function (X) { + var Y; + (function (Y) { + var Z; + (function (Z) { + Z.v2 = f(Z.v); + })(Z = Y.Z || (Y.Z = {})); + })(Y = X.Y || (X.Y = {})); + })(X = N.X || (N.X = {})); + })(N = M.N || (M.N = {})); +})(M || (M = {})); +var M; +(function (M) { + var N; + (function (N) { + var X; + (function (X) { + var Y; + (function (Y) { + var Z; + (function (Z) { + Z.v = N.f(10); + })(Z = Y.Z || (Y.Z = {})); + })(Y = X.Y || (X.Y = {})); + })(X = N.X || (N.X = {})); + })(N = M.N || (M.N = {})); +})(M || (M = {})); diff --git a/tests/baselines/reference/duplicateClassElements.js b/tests/baselines/reference/duplicateClassElements.js new file mode 100644 index 00000000000..da320eb9ac4 --- /dev/null +++ b/tests/baselines/reference/duplicateClassElements.js @@ -0,0 +1,105 @@ +//// [duplicateClassElements.ts] +class a { + public a; + public a; + public b() { + } + public b() { + } + public x; + get x() { + return 10; + } + set x(_x: number) { + } + + get y() { + return "Hello"; + } + set y(_y: string) { + } + + public z() { + } + get z() { + return "Hello"; + } + set z(_y: string) { + } + + get x2() { + return 10; + } + set x2(_x: number) { + } + public x2; + + get z2() { + return "Hello"; + } + set z2(_y: string) { + } + public z2() { + } + +} + +//// [duplicateClassElements.js] +var a = (function () { + function a() { + } + a.prototype.b = function () { + }; + a.prototype.b = function () { + }; + Object.defineProperty(a.prototype, "x", { + get: function () { + return 10; + }, + set: function (_x) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(a.prototype, "y", { + get: function () { + return "Hello"; + }, + set: function (_y) { + }, + enumerable: true, + configurable: true + }); + a.prototype.z = function () { + }; + Object.defineProperty(a.prototype, "z", { + get: function () { + return "Hello"; + }, + set: function (_y) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(a.prototype, "x2", { + get: function () { + return 10; + }, + set: function (_x) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(a.prototype, "z2", { + get: function () { + return "Hello"; + }, + set: function (_y) { + }, + enumerable: true, + configurable: true + }); + a.prototype.z2 = function () { + }; + return a; +})(); diff --git a/tests/baselines/reference/duplicateExportAssignments.js b/tests/baselines/reference/duplicateExportAssignments.js new file mode 100644 index 00000000000..7d2776962f7 --- /dev/null +++ b/tests/baselines/reference/duplicateExportAssignments.js @@ -0,0 +1,80 @@ +//// [tests/cases/conformance/externalModules/duplicateExportAssignments.ts] //// + +//// [foo1.ts] +var x = 10; +var y = 20; +export = x; +export = y; + +//// [foo2.ts] +var x = 10; +class y {}; +export = x; +export = y; + +//// [foo3.ts] +module x { + export var x = 10; +} +class y { + y: number; +} +export = x; +export = y; + +//// [foo4.ts] +export = x; +function x(){ + return 42; +} +function y(){ + return 42; +} +export = y; + +//// [foo5.ts] +var x = 5; +var y = "test"; +var z = {}; +export = x; +export = y; +export = z; + + +//// [foo1.js] +var x = 10; +var y = 20; +module.exports = x; +//// [foo2.js] +var x = 10; +var y = (function () { + function y() { + } + return y; +})(); +; +module.exports = x; +//// [foo3.js] +var x; +(function (_x) { + _x.x = 10; +})(x || (x = {})); +var y = (function () { + function y() { + } + return y; +})(); +module.exports = x; +//// [foo4.js] +function x() { + return 42; +} +function y() { + return 42; +} +module.exports = x; +//// [foo5.js] +var x = 5; +var y = "test"; +var z = {}; +module.exports = x; diff --git a/tests/baselines/reference/duplicateLabel1.js b/tests/baselines/reference/duplicateLabel1.js new file mode 100644 index 00000000000..e7976895c94 --- /dev/null +++ b/tests/baselines/reference/duplicateLabel1.js @@ -0,0 +1,9 @@ +//// [duplicateLabel1.ts] +target: +target: +while (true) { +} + +//// [duplicateLabel1.js] +target: target: while (true) { +} diff --git a/tests/baselines/reference/duplicateLabel2.js b/tests/baselines/reference/duplicateLabel2.js new file mode 100644 index 00000000000..9ee9671d59d --- /dev/null +++ b/tests/baselines/reference/duplicateLabel2.js @@ -0,0 +1,13 @@ +//// [duplicateLabel2.ts] +target: +while (true) { + target: + while (true) { + } +} + +//// [duplicateLabel2.js] +target: while (true) { + target: while (true) { + } +} diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.js b/tests/baselines/reference/duplicateObjectLiteralProperty.js new file mode 100644 index 00000000000..5bbeb433a0c --- /dev/null +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.js @@ -0,0 +1,41 @@ +//// [duplicateObjectLiteralProperty.ts] +var x = { + a: 1, + b: true, // OK + a: 56, // Duplicate + \u0061: "ss", // Duplicate + a: { + c: 1, + "c": 56, // Duplicate + } +}; + + +var y = { + get a() { return 0; }, + set a(v: number) { }, + get a() { return 0; } +}; + + +//// [duplicateObjectLiteralProperty.js] +var x = { + a: 1, + b: true, + a: 56, + \u0061: "ss", + a: { + c: 1, + "c": 56, + } +}; +var y = { + get a() { + return 0; + }, + set a(v) { + }, + get a() { + return 0; + } +}; diff --git a/tests/baselines/reference/duplicatePropertiesInStrictMode.js b/tests/baselines/reference/duplicatePropertiesInStrictMode.js new file mode 100644 index 00000000000..37bb3d62b7f --- /dev/null +++ b/tests/baselines/reference/duplicatePropertiesInStrictMode.js @@ -0,0 +1,13 @@ +//// [duplicatePropertiesInStrictMode.ts] +"use strict"; +var x = { + x: 1, + x: 2 +} + +//// [duplicatePropertiesInStrictMode.js] +"use strict"; +var x = { + x: 1, + x: 2 +}; diff --git a/tests/baselines/reference/elaboratedErrors.errors.txt b/tests/baselines/reference/elaboratedErrors.errors.txt new file mode 100644 index 00000000000..7bc83a19a50 --- /dev/null +++ b/tests/baselines/reference/elaboratedErrors.errors.txt @@ -0,0 +1,52 @@ +tests/cases/compiler/elaboratedErrors.ts(10,7): error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'. + Types of property 'read' are incompatible. + Type 'string' is not assignable to type 'number'. +tests/cases/compiler/elaboratedErrors.ts(20,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'. + Property 'x' is missing in type 'Beta'. +tests/cases/compiler/elaboratedErrors.ts(21,1): error TS2322: Type 'Beta' is not assignable to type 'Alpha'. +tests/cases/compiler/elaboratedErrors.ts(24,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'. + Property 'y' is missing in type 'Alpha'. +tests/cases/compiler/elaboratedErrors.ts(25,1): error TS2322: Type 'Alpha' is not assignable to type 'Beta'. + + +==== tests/cases/compiler/elaboratedErrors.ts (5 errors) ==== + interface FileSystem { + read: number; + } + + function fn(s: WorkerFS): void; + function fn(s: FileSystem): void; + function fn(s: FileSystem|WorkerFS) { } + + // This should issue a large error, not a small one + class WorkerFS implements FileSystem { + ~~~~~~~~ +!!! error TS2420: Class 'WorkerFS' incorrectly implements interface 'FileSystem'. +!!! error TS2420: Types of property 'read' are incompatible. +!!! error TS2420: Type 'string' is not assignable to type 'number'. + read: string; + } + + interface Alpha { x: string; } + interface Beta { y: number; } + var x: Alpha; + var y: Beta; + + // Only one of these errors should be large + x = y; + ~ +!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'. +!!! error TS2322: Property 'x' is missing in type 'Beta'. + x = y; + ~ +!!! error TS2322: Type 'Beta' is not assignable to type 'Alpha'. + + // Only one of these errors should be large + y = x; + ~ +!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'. +!!! error TS2322: Property 'y' is missing in type 'Alpha'. + y = x; + ~ +!!! error TS2322: Type 'Alpha' is not assignable to type 'Beta'. + \ No newline at end of file diff --git a/tests/baselines/reference/elaboratedErrors.js b/tests/baselines/reference/elaboratedErrors.js new file mode 100644 index 00000000000..c245c1a8562 --- /dev/null +++ b/tests/baselines/reference/elaboratedErrors.js @@ -0,0 +1,45 @@ +//// [elaboratedErrors.ts] +interface FileSystem { + read: number; +} + +function fn(s: WorkerFS): void; +function fn(s: FileSystem): void; +function fn(s: FileSystem|WorkerFS) { } + +// This should issue a large error, not a small one +class WorkerFS implements FileSystem { + read: string; +} + +interface Alpha { x: string; } +interface Beta { y: number; } +var x: Alpha; +var y: Beta; + +// Only one of these errors should be large +x = y; +x = y; + +// Only one of these errors should be large +y = x; +y = x; + + +//// [elaboratedErrors.js] +function fn(s) { +} +// This should issue a large error, not a small one +var WorkerFS = (function () { + function WorkerFS() { + } + return WorkerFS; +})(); +var x; +var y; +// Only one of these errors should be large +x = y; +x = y; +// Only one of these errors should be large +y = x; +y = x; diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js new file mode 100644 index 00000000000..1c00a7579b6 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunction.js @@ -0,0 +1,29 @@ +//// [emitArrowFunction.ts] +var f1 = () => { } +var f2 = (x: string, y: string) => { } +var f3 = (x: string, y: number, ...rest) => { } +var f4 = (x: string, y: number, z = 10) => { } +function foo(func: () => boolean) { } +foo(() => true); +foo(() => { return false; }); + +//// [emitArrowFunction.js] +var f1 = function () { +}; +var f2 = function (x, y) { +}; +var f3 = function (x, y) { + var rest = []; + for (var _i = 2; _i < arguments.length; _i++) { + rest[_i - 2] = arguments[_i]; + } +}; +var f4 = function (x, y, z) { + if (z === void 0) { z = 10; } +}; +function foo(func) { +} +foo(function () { return true; }); +foo(function () { + return false; +}); diff --git a/tests/baselines/reference/emitArrowFunction.types b/tests/baselines/reference/emitArrowFunction.types new file mode 100644 index 00000000000..030ed0cde60 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunction.types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunction.ts === +var f1 = () => { } +>f1 : () => void +>() => { } : () => void + +var f2 = (x: string, y: string) => { } +>f2 : (x: string, y: string) => void +>(x: string, y: string) => { } : (x: string, y: string) => void +>x : string +>y : string + +var f3 = (x: string, y: number, ...rest) => { } +>f3 : (x: string, y: number, ...rest: any[]) => void +>(x: string, y: number, ...rest) => { } : (x: string, y: number, ...rest: any[]) => void +>x : string +>y : number +>rest : any[] + +var f4 = (x: string, y: number, z = 10) => { } +>f4 : (x: string, y: number, z?: number) => void +>(x: string, y: number, z = 10) => { } : (x: string, y: number, z?: number) => void +>x : string +>y : number +>z : number + +function foo(func: () => boolean) { } +>foo : (func: () => boolean) => void +>func : () => boolean + +foo(() => true); +>foo(() => true) : void +>foo : (func: () => boolean) => void +>() => true : () => boolean + +foo(() => { return false; }); +>foo(() => { return false; }) : void +>foo : (func: () => boolean) => void +>() => { return false; } : () => boolean + diff --git a/tests/baselines/reference/emitArrowFunctionAsIs.js b/tests/baselines/reference/emitArrowFunctionAsIs.js new file mode 100644 index 00000000000..11df7903ad8 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionAsIs.js @@ -0,0 +1,13 @@ +//// [emitArrowFunctionAsIs.ts] +var arrow1 = a => { }; +var arrow2 = (a) => { }; + +var arrow3 = (a, b) => { }; + +//// [emitArrowFunctionAsIs.js] +var arrow1 = function (a) { +}; +var arrow2 = function (a) { +}; +var arrow3 = function (a, b) { +}; diff --git a/tests/baselines/reference/emitArrowFunctionAsIs.types b/tests/baselines/reference/emitArrowFunctionAsIs.types new file mode 100644 index 00000000000..1ab5de9724a --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionAsIs.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionAsIs.ts === +var arrow1 = a => { }; +>arrow1 : (a: any) => void +>a => { } : (a: any) => void +>a : any + +var arrow2 = (a) => { }; +>arrow2 : (a: any) => void +>(a) => { } : (a: any) => void +>a : any + +var arrow3 = (a, b) => { }; +>arrow3 : (a: any, b: any) => void +>(a, b) => { } : (a: any, b: any) => void +>a : any +>b : any + diff --git a/tests/baselines/reference/emitArrowFunctionAsIsES6.js b/tests/baselines/reference/emitArrowFunctionAsIsES6.js new file mode 100644 index 00000000000..9941434ae10 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionAsIsES6.js @@ -0,0 +1,13 @@ +//// [emitArrowFunctionAsIsES6.ts] +var arrow1 = a => { }; +var arrow2 = (a) => { }; + +var arrow3 = (a, b) => { }; + +//// [emitArrowFunctionAsIsES6.js] +var arrow1 = a => { +}; +var arrow2 = (a) => { +}; +var arrow3 = (a, b) => { +}; diff --git a/tests/baselines/reference/emitArrowFunctionAsIsES6.types b/tests/baselines/reference/emitArrowFunctionAsIsES6.types new file mode 100644 index 00000000000..6b8c9e54bbe --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionAsIsES6.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionAsIsES6.ts === +var arrow1 = a => { }; +>arrow1 : (a: any) => void +>a => { } : (a: any) => void +>a : any + +var arrow2 = (a) => { }; +>arrow2 : (a: any) => void +>(a) => { } : (a: any) => void +>a : any + +var arrow3 = (a, b) => { }; +>arrow3 : (a: any, b: any) => void +>(a, b) => { } : (a: any, b: any) => void +>a : any +>b : any + diff --git a/tests/baselines/reference/emitArrowFunctionES6.js b/tests/baselines/reference/emitArrowFunctionES6.js new file mode 100644 index 00000000000..c518a52f629 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionES6.js @@ -0,0 +1,25 @@ +//// [emitArrowFunctionES6.ts] +var f1 = () => { } +var f2 = (x: string, y: string) => { } +var f3 = (x: string, y: number, ...rest) => { } +var f4 = (x: string, y: number, z=10) => { } +function foo(func: () => boolean) { } +foo(() => true); +foo(() => { return false; }); + + +//// [emitArrowFunctionES6.js] +var f1 = () => { +}; +var f2 = (x, y) => { +}; +var f3 = (x, y, ...rest) => { +}; +var f4 = (x, y, z = 10) => { +}; +function foo(func) { +} +foo(() => { return true; }); +foo(() => { + return false; +}); diff --git a/tests/baselines/reference/emitArrowFunctionES6.types b/tests/baselines/reference/emitArrowFunctionES6.types new file mode 100644 index 00000000000..1f0c1941bdb --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionES6.types @@ -0,0 +1,39 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionES6.ts === +var f1 = () => { } +>f1 : () => void +>() => { } : () => void + +var f2 = (x: string, y: string) => { } +>f2 : (x: string, y: string) => void +>(x: string, y: string) => { } : (x: string, y: string) => void +>x : string +>y : string + +var f3 = (x: string, y: number, ...rest) => { } +>f3 : (x: string, y: number, ...rest: any[]) => void +>(x: string, y: number, ...rest) => { } : (x: string, y: number, ...rest: any[]) => void +>x : string +>y : number +>rest : any[] + +var f4 = (x: string, y: number, z=10) => { } +>f4 : (x: string, y: number, z?: number) => void +>(x: string, y: number, z=10) => { } : (x: string, y: number, z?: number) => void +>x : string +>y : number +>z : number + +function foo(func: () => boolean) { } +>foo : (func: () => boolean) => void +>func : () => boolean + +foo(() => true); +>foo(() => true) : void +>foo : (func: () => boolean) => void +>() => true : () => boolean + +foo(() => { return false; }); +>foo(() => { return false; }) : void +>foo : (func: () => boolean) => void +>() => { return false; } : () => boolean + diff --git a/tests/baselines/reference/emitArrowFunctionThisCapturing.js b/tests/baselines/reference/emitArrowFunctionThisCapturing.js new file mode 100644 index 00000000000..25d9f7f100b --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionThisCapturing.js @@ -0,0 +1,30 @@ +//// [emitArrowFunctionThisCapturing.ts] +var f1 = () => { + this.age = 10 +}; + +var f2 = (x: string) => { + this.name = x +} + +function foo(func: () => boolean) { } +foo(() => { + this.age = 100; + return true; +}); + + +//// [emitArrowFunctionThisCapturing.js] +var _this = this; +var f1 = function () { + _this.age = 10; +}; +var f2 = function (x) { + _this.name = x; +}; +function foo(func) { +} +foo(function () { + _this.age = 100; + return true; +}); diff --git a/tests/baselines/reference/emitArrowFunctionThisCapturing.types b/tests/baselines/reference/emitArrowFunctionThisCapturing.types new file mode 100644 index 00000000000..433f38e5ecc --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionThisCapturing.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturing.ts === +var f1 = () => { +>f1 : () => void +>() => { this.age = 10} : () => void + + this.age = 10 +>this.age = 10 : number +>this.age : any +>this : any +>age : any + +}; + +var f2 = (x: string) => { +>f2 : (x: string) => void +>(x: string) => { this.name = x} : (x: string) => void +>x : string + + this.name = x +>this.name = x : string +>this.name : any +>this : any +>name : any +>x : string +} + +function foo(func: () => boolean) { } +>foo : (func: () => boolean) => void +>func : () => boolean + +foo(() => { +>foo(() => { this.age = 100; return true;}) : void +>foo : (func: () => boolean) => void +>() => { this.age = 100; return true;} : () => boolean + + this.age = 100; +>this.age = 100 : number +>this.age : any +>this : any +>age : any + + return true; +}); + diff --git a/tests/baselines/reference/emitArrowFunctionThisCapturingES6.js b/tests/baselines/reference/emitArrowFunctionThisCapturingES6.js new file mode 100644 index 00000000000..bf235bc0eef --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionThisCapturingES6.js @@ -0,0 +1,29 @@ +//// [emitArrowFunctionThisCapturingES6.ts] +var f1 = () => { + this.age = 10 +}; + +var f2 = (x: string) => { + this.name = x +} + +function foo(func: () => boolean){ } +foo(() => { + this.age = 100; + return true; +}); + + +//// [emitArrowFunctionThisCapturingES6.js] +var f1 = () => { + this.age = 10; +}; +var f2 = (x) => { + this.name = x; +}; +function foo(func) { +} +foo(() => { + this.age = 100; + return true; +}); diff --git a/tests/baselines/reference/emitArrowFunctionThisCapturingES6.types b/tests/baselines/reference/emitArrowFunctionThisCapturingES6.types new file mode 100644 index 00000000000..989130ef280 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionThisCapturingES6.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturingES6.ts === +var f1 = () => { +>f1 : () => void +>() => { this.age = 10} : () => void + + this.age = 10 +>this.age = 10 : number +>this.age : any +>this : any +>age : any + +}; + +var f2 = (x: string) => { +>f2 : (x: string) => void +>(x: string) => { this.name = x} : (x: string) => void +>x : string + + this.name = x +>this.name = x : string +>this.name : any +>this : any +>name : any +>x : string +} + +function foo(func: () => boolean){ } +>foo : (func: () => boolean) => void +>func : () => boolean + +foo(() => { +>foo(() => { this.age = 100; return true;}) : void +>foo : (func: () => boolean) => void +>() => { this.age = 100; return true;} : () => boolean + + this.age = 100; +>this.age = 100 : number +>this.age : any +>this : any +>age : any + + return true; +}); + diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments.errors.txt b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments.errors.txt new file mode 100644 index 00000000000..3a0ab0e597c --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(2,15): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(7,19): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(13,13): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts(19,15): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + + +==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArguments.ts (4 errors) ==== + var a = () => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + } + + var b = function () { + var a = () => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + } + } + + function baz() { + () => { + var arg = arguments[0]; + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + } + } + + function foo(inputFunc: () => void) { } + foo(() => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + }); + + function bar() { + var arg = arguments[0]; // no error + } + + + () => { + function foo() { + var arg = arguments[0]; // no error + } + } \ No newline at end of file diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments.js b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments.js new file mode 100644 index 00000000000..00a4c7aa051 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments.js @@ -0,0 +1,60 @@ +//// [emitArrowFunctionWhenUsingArguments.ts] +var a = () => { + var arg = arguments[0]; // error +} + +var b = function () { + var a = () => { + var arg = arguments[0]; // error + } +} + +function baz() { + () => { + var arg = arguments[0]; + } +} + +function foo(inputFunc: () => void) { } +foo(() => { + var arg = arguments[0]; // error +}); + +function bar() { + var arg = arguments[0]; // no error +} + + +() => { + function foo() { + var arg = arguments[0]; // no error + } +} + +//// [emitArrowFunctionWhenUsingArguments.js] +var a = () => { + var arg = arguments[0]; // error +}; +var b = function () { + var a = () => { + var arg = arguments[0]; // error + }; +}; +function baz() { + (() => { + var arg = arguments[0]; + }); +} +function foo(inputFunc) { +} +foo(() => { + var arg = arguments[0]; // error +}); +function bar() { + var arg = arguments[0]; // no error +} +(() => { + function foo() { + var arg = arguments[0]; // no error + } +}); diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArgumentsES6.errors.txt b/tests/baselines/reference/emitArrowFunctionWhenUsingArgumentsES6.errors.txt new file mode 100644 index 00000000000..f879f11799b --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArgumentsES6.errors.txt @@ -0,0 +1,46 @@ +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(2,15): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(7,19): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(13,13): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. +tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts(19,15): error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + + +==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionWhenUsingArgumentsES6.ts (4 errors) ==== + var a = () => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + } + + var b = function () { + var a = () => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + } + } + + function baz() { + () => { + var arg = arguments[0]; + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + } + } + + function foo(inputFunc: () => void) { } + foo(() => { + var arg = arguments[0]; // error + ~~~~~~~~~ +!!! error TS9002: The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression. + }); + + function bar() { + var arg = arguments[0]; // no error + } + + + () => { + function foo() { + var arg = arguments[0]; // no error + } + } \ No newline at end of file diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArgumentsES6.js b/tests/baselines/reference/emitArrowFunctionWhenUsingArgumentsES6.js new file mode 100644 index 00000000000..0deacd409df --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArgumentsES6.js @@ -0,0 +1,60 @@ +//// [emitArrowFunctionWhenUsingArgumentsES6.ts] +var a = () => { + var arg = arguments[0]; // error +} + +var b = function () { + var a = () => { + var arg = arguments[0]; // error + } +} + +function baz() { + () => { + var arg = arguments[0]; + } +} + +function foo(inputFunc: () => void) { } +foo(() => { + var arg = arguments[0]; // error +}); + +function bar() { + var arg = arguments[0]; // no error +} + + +() => { + function foo() { + var arg = arguments[0]; // no error + } +} + +//// [emitArrowFunctionWhenUsingArgumentsES6.js] +var a = () => { + var arg = arguments[0]; // error +}; +var b = function () { + var a = () => { + var arg = arguments[0]; // error + }; +}; +function baz() { + (() => { + var arg = arguments[0]; + }); +} +function foo(inputFunc) { +} +foo(() => { + var arg = arguments[0]; // error +}); +function bar() { + var arg = arguments[0]; // no error +} +(() => { + function foo() { + var arg = arguments[0]; // no error + } +}); diff --git a/tests/baselines/reference/emitArrowFunctionsAsIs.js b/tests/baselines/reference/emitArrowFunctionsAsIs.js new file mode 100644 index 00000000000..ee8347dda3e --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionsAsIs.js @@ -0,0 +1,13 @@ +//// [emitArrowFunctionsAsIs.ts] +var arrow1 = a => { }; +var arrow2 = (a) => { }; + +var arrow3 = (a, b) => { }; + +//// [emitArrowFunctionsAsIs.js] +var arrow1 = function (a) { +}; +var arrow2 = function (a) { +}; +var arrow3 = function (a, b) { +}; diff --git a/tests/baselines/reference/emitArrowFunctionsAsIs.types b/tests/baselines/reference/emitArrowFunctionsAsIs.types new file mode 100644 index 00000000000..36dae7e9c5a --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionsAsIs.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionsAsIs.ts === +var arrow1 = a => { }; +>arrow1 : (a: any) => void +>a => { } : (a: any) => void +>a : any + +var arrow2 = (a) => { }; +>arrow2 : (a: any) => void +>(a) => { } : (a: any) => void +>a : any + +var arrow3 = (a, b) => { }; +>arrow3 : (a: any, b: any) => void +>(a, b) => { } : (a: any, b: any) => void +>a : any +>b : any + diff --git a/tests/baselines/reference/emitArrowFunctionsAsIsES6.js b/tests/baselines/reference/emitArrowFunctionsAsIsES6.js new file mode 100644 index 00000000000..021e048ed88 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionsAsIsES6.js @@ -0,0 +1,13 @@ +//// [emitArrowFunctionsAsIsES6.ts] +var arrow1 = a => { }; +var arrow2 = (a) => { }; + +var arrow3 = (a, b) => { }; + +//// [emitArrowFunctionsAsIsES6.js] +var arrow1 = a => { +}; +var arrow2 = (a) => { +}; +var arrow3 = (a, b) => { +}; diff --git a/tests/baselines/reference/emitArrowFunctionsAsIsES6.types b/tests/baselines/reference/emitArrowFunctionsAsIsES6.types new file mode 100644 index 00000000000..4073355d259 --- /dev/null +++ b/tests/baselines/reference/emitArrowFunctionsAsIsES6.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionsAsIsES6.ts === +var arrow1 = a => { }; +>arrow1 : (a: any) => void +>a => { } : (a: any) => void +>a : any + +var arrow2 = (a) => { }; +>arrow2 : (a: any) => void +>(a) => { } : (a: any) => void +>a : any + +var arrow3 = (a, b) => { }; +>arrow3 : (a: any, b: any) => void +>(a, b) => { } : (a: any, b: any) => void +>a : any +>b : any + diff --git a/tests/baselines/reference/emitDefaultParametersFunctionExpressionES6.js b/tests/baselines/reference/emitDefaultParametersFunctionExpressionES6.js index eabb0e1e344..5a49a200c6b 100644 --- a/tests/baselines/reference/emitDefaultParametersFunctionExpressionES6.js +++ b/tests/baselines/reference/emitDefaultParametersFunctionExpressionES6.js @@ -9,13 +9,13 @@ var y = (function (num = 10, boo = false, ...rest) { })() var z = (function (num: number, boo = false, ...rest) { })(10) //// [emitDefaultParametersFunctionExpressionES6.js] -var lambda1 = function (y = "hello") { +var lambda1 = (y = "hello") => { }; -var lambda2 = function (x, y = "hello") { +var lambda2 = (x, y = "hello") => { }; -var lambda3 = function (x, y = "hello", ...rest) { +var lambda3 = (x, y = "hello", ...rest) => { }; -var lambda4 = function (y = "hello", ...rest) { +var lambda4 = (y = "hello", ...rest) => { }; var x = function (str = "hello", ...rest) { }; diff --git a/tests/baselines/reference/emitRestParametersFunctionExpressionES6.js b/tests/baselines/reference/emitRestParametersFunctionExpressionES6.js index 6c79e4956ae..c7851db5e78 100644 --- a/tests/baselines/reference/emitRestParametersFunctionExpressionES6.js +++ b/tests/baselines/reference/emitRestParametersFunctionExpressionES6.js @@ -5,9 +5,9 @@ var funcExp2 = function (...rest) { } var funcExp3 = (function (...rest) { })() //// [emitRestParametersFunctionExpressionES6.js] -var funcExp = function (...rest) { +var funcExp = (...rest) => { }; -var funcExp1 = function (X, ...rest) { +var funcExp1 = (X, ...rest) => { }; var funcExp2 = function (...rest) { }; diff --git a/tests/baselines/reference/emptyGenericParamList.js b/tests/baselines/reference/emptyGenericParamList.js new file mode 100644 index 00000000000..c5d01778f2d --- /dev/null +++ b/tests/baselines/reference/emptyGenericParamList.js @@ -0,0 +1,11 @@ +//// [emptyGenericParamList.ts] +class I {} +var x: I<>; + +//// [emptyGenericParamList.js] +var I = (function () { + function I() { + } + return I; +})(); +var x; diff --git a/tests/baselines/reference/emptyMemberAccess.js b/tests/baselines/reference/emptyMemberAccess.js new file mode 100644 index 00000000000..c0fc6064b5d --- /dev/null +++ b/tests/baselines/reference/emptyMemberAccess.js @@ -0,0 +1,12 @@ +//// [emptyMemberAccess.ts] +function getObj() { + + ().toString(); + +} + + +//// [emptyMemberAccess.js] +function getObj() { + ().toString(); +} diff --git a/tests/baselines/reference/emptyTypeArgumentList.js b/tests/baselines/reference/emptyTypeArgumentList.js new file mode 100644 index 00000000000..91fce396289 --- /dev/null +++ b/tests/baselines/reference/emptyTypeArgumentList.js @@ -0,0 +1,8 @@ +//// [emptyTypeArgumentList.ts] +function foo() { } +foo<>(); + +//// [emptyTypeArgumentList.js] +function foo() { +} +foo(); diff --git a/tests/baselines/reference/emptyTypeArgumentListWithNew.js b/tests/baselines/reference/emptyTypeArgumentListWithNew.js new file mode 100644 index 00000000000..d51c4f630a6 --- /dev/null +++ b/tests/baselines/reference/emptyTypeArgumentListWithNew.js @@ -0,0 +1,11 @@ +//// [emptyTypeArgumentListWithNew.ts] +class foo { } +new foo<>(); + +//// [emptyTypeArgumentListWithNew.js] +var foo = (function () { + function foo() { + } + return foo; +})(); +new foo(); diff --git a/tests/baselines/reference/enumConflictsWithGlobalIdentifier.js b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.js new file mode 100644 index 00000000000..67d9a020bb6 --- /dev/null +++ b/tests/baselines/reference/enumConflictsWithGlobalIdentifier.js @@ -0,0 +1,15 @@ +//// [enumConflictsWithGlobalIdentifier.ts] +enum Position { + IgnoreRulesSpecific = 0, +} +var x = IgnoreRulesSpecific. +var y = Position.IgnoreRulesSpecific; + + +//// [enumConflictsWithGlobalIdentifier.js] +var Position; +(function (Position) { + Position[Position["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; +})(Position || (Position = {})); +var x = IgnoreRulesSpecific.; +var y = 0 /* IgnoreRulesSpecific */; diff --git a/tests/baselines/reference/enumConstantMembers.js b/tests/baselines/reference/enumConstantMembers.js new file mode 100644 index 00000000000..f58c7d253af --- /dev/null +++ b/tests/baselines/reference/enumConstantMembers.js @@ -0,0 +1,38 @@ +//// [enumConstantMembers.ts] +// Constant members allow negatives, but not decimals. Also hex literals are allowed +enum E1 { + a = 1, + b +} +enum E2 { + a = - 1, + b +} +enum E3 { + a = 0.1, + b // Error because 0.1 is not a constant +} + +declare enum E4 { + a = 1, + b = -1, + c = 0.1 // Not a constant +} + +//// [enumConstantMembers.js] +// Constant members allow negatives, but not decimals. Also hex literals are allowed +var E1; +(function (E1) { + E1[E1["a"] = 1] = "a"; + E1[E1["b"] = 2] = "b"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["a"] = -1] = "a"; + E2[E2["b"] = 0] = "b"; +})(E2 || (E2 = {})); +var E3; +(function (E3) { + E3[E3["a"] = 0.1] = "a"; + E3[E3["b"] = 1.1] = "b"; // Error because 0.1 is not a constant +})(E3 || (E3 = {})); diff --git a/tests/baselines/reference/enumInitializersWithExponents.js b/tests/baselines/reference/enumInitializersWithExponents.js new file mode 100644 index 00000000000..b4dd38e32c2 --- /dev/null +++ b/tests/baselines/reference/enumInitializersWithExponents.js @@ -0,0 +1,12 @@ +//// [enumInitializersWithExponents.ts] +// Must be integer literals. +declare enum E { + a = 1e3, // ok + b = 1e25, // ok + c = 1e-3, // error + d = 1e-9, // error + e = 1e0, // ok + f = 1e+25 // ok +} + +//// [enumInitializersWithExponents.js] diff --git a/tests/baselines/reference/enumMemberResolution.js b/tests/baselines/reference/enumMemberResolution.js new file mode 100644 index 00000000000..e1d79ebeb92 --- /dev/null +++ b/tests/baselines/reference/enumMemberResolution.js @@ -0,0 +1,17 @@ +//// [enumMemberResolution.ts] +enum Position2 { + IgnoreRulesSpecific = 0 +} +var x = IgnoreRulesSpecific. // error +var y = 1; +var z = Position2.IgnoreRulesSpecific; // no error + + +//// [enumMemberResolution.js] +var Position2; +(function (Position2) { + Position2[Position2["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; +})(Position2 || (Position2 = {})); +var x = IgnoreRulesSpecific.; // error +var y = 1; +var z = 0 /* IgnoreRulesSpecific */; // no error diff --git a/tests/baselines/reference/enumWithParenthesizedInitializer1.js b/tests/baselines/reference/enumWithParenthesizedInitializer1.js new file mode 100644 index 00000000000..0c125b3d8b2 --- /dev/null +++ b/tests/baselines/reference/enumWithParenthesizedInitializer1.js @@ -0,0 +1,10 @@ +//// [enumWithParenthesizedInitializer1.ts] +enum E { + e = -(3 +} + +//// [enumWithParenthesizedInitializer1.js] +var E; +(function (E) { + E[E["e"] = -(3)] = "e"; +})(E || (E = {})); diff --git a/tests/baselines/reference/enumWithoutInitializerAfterComputedMember.js b/tests/baselines/reference/enumWithoutInitializerAfterComputedMember.js new file mode 100644 index 00000000000..ef9192c1c90 --- /dev/null +++ b/tests/baselines/reference/enumWithoutInitializerAfterComputedMember.js @@ -0,0 +1,14 @@ +//// [enumWithoutInitializerAfterComputedMember.ts] +enum E { + a, + b = a, + c +} + +//// [enumWithoutInitializerAfterComputedMember.js] +var E; +(function (E) { + E[E["a"] = 0] = "a"; + E[E["b"] = E.a] = "b"; + E[E["c"] = undefined] = "c"; +})(E || (E = {})); diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js new file mode 100644 index 00000000000..4e0f84656fd --- /dev/null +++ b/tests/baselines/reference/errorSuperCalls.js @@ -0,0 +1,170 @@ +//// [errorSuperCalls.ts] +//super call in class constructor with no base type +class NoBase { + constructor() { + super(); + } + + //super call in class member function with no base type + fn() { + super(); + } + + //super call in class accessor (get and set) with no base type + get foo() { + super(); + return null; + } + set foo(v) { + super(); + } + + //super call in class member initializer with no base type + p = super(); + + //super call in static class member function with no base type + static fn() { + super(); + } + + //super call in static class member initializer with no base type + static k = super(); + + //super call in static class accessor (get and set) with no base type + static get q() { + super(); + return null; + } + static set q(n) { + super(); + } +} + +class Base { private n: T; } +class Derived extends Base { + //super call with type arguments + constructor() { + super(); + super(); + } +} + + +class OtherBase { + private n: string; +} + +class OtherDerived extends OtherBase { + //super call in class member initializer of derived type + t = super(); + + fn() { + //super call in class member function of derived type + super(); + } + + //super call in class accessor (get and set) of derived type + get foo() { + super(); + return null; + } + set foo(n) { + super(); + } +} + + +//// [errorSuperCalls.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +//super call in class constructor with no base type +var NoBase = (function () { + function NoBase() { + //super call in class member initializer with no base type + this.p = _super.call(this); + _super.call(this); + } + //super call in class member function with no base type + NoBase.prototype.fn = function () { + _super.call(this); + }; + Object.defineProperty(NoBase.prototype, "foo", { + //super call in class accessor (get and set) with no base type + get: function () { + _super.call(this); + return null; + }, + set: function (v) { + _super.call(this); + }, + enumerable: true, + configurable: true + }); + //super call in static class member function with no base type + NoBase.fn = function () { + _super.call(this); + }; + Object.defineProperty(NoBase, "q", { + //super call in static class accessor (get and set) with no base type + get: function () { + _super.call(this); + return null; + }, + set: function (n) { + _super.call(this); + }, + enumerable: true, + configurable: true + }); + //super call in static class member initializer with no base type + NoBase.k = _super.call(this); + return NoBase; +})(); +var Base = (function () { + function Base() { + } + return Base; +})(); +var Derived = (function (_super) { + __extends(Derived, _super); + //super call with type arguments + function Derived() { + _super.prototype..call(this); + _super.call(this); + } + return Derived; +})(Base); +var OtherBase = (function () { + function OtherBase() { + } + return OtherBase; +})(); +var OtherDerived = (function (_super) { + __extends(OtherDerived, _super); + function OtherDerived() { + _super.apply(this, arguments); + //super call in class member initializer of derived type + this.t = _super.call(this); + } + OtherDerived.prototype.fn = function () { + //super call in class member function of derived type + _super.call(this); + }; + Object.defineProperty(OtherDerived.prototype, "foo", { + //super call in class accessor (get and set) of derived type + get: function () { + _super.call(this); + return null; + }, + set: function (n) { + _super.call(this); + }, + enumerable: true, + configurable: true + }); + return OtherDerived; +})(OtherBase); diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js new file mode 100644 index 00000000000..26c66a1222c --- /dev/null +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -0,0 +1,280 @@ +//// [errorSuperPropertyAccess.ts] +//super property access in constructor of class with no base type +//super property access in instance member function of class with no base type +//super property access in instance member accessor(get and set) of class with no base type +class NoBase { + constructor() { + var a = super.prototype; + var b = super.hasOwnProperty(''); + } + + fn() { + var a = super.prototype; + var b = super.hasOwnProperty(''); + } + + m = super.prototype; + n = super.hasOwnProperty(''); + + //super static property access in static member function of class with no base type + //super static property access in static member accessor(get and set) of class with no base type + public static static1() { + super.hasOwnProperty(''); + } + + public static get static2() { + super.hasOwnProperty(''); + return ''; + } + + public static set static2(n) { + super.hasOwnProperty(''); + } +} + +class SomeBase { + private privateFunc() { } + private privateMember = 0; + + public publicFunc() { } + public publicMember = 0; + + private static privateStaticFunc() { } + private static privateStaticMember = 0; + + public static publicStaticFunc() { } + public static publicStaticMember = 0; + +} + + +//super.publicInstanceMemberNotFunction in constructor of derived class +//super.publicInstanceMemberNotFunction in instance member function of derived class +//super.publicInstanceMemberNotFunction in instance member accessor(get and set) of derived class +//super property access only available with typed this +class SomeDerived1 extends SomeBase { + constructor() { + super(); + super.publicMember = 1; + } + + fn() { + var x = super.publicMember; + } + + get a() { + var x = super.publicMember; + return undefined; + } + set a(n) { + n = super.publicMember; + } + fn2() { + function inner() { + super.publicFunc(); + } + var x = { + test: function () { return super.publicFunc(); } + } + } +} + +//super.privateProperty in constructor of derived class +//super.privateProperty in instance member function of derived class +//super.privateProperty in instance member accessor(get and set) of derived class +class SomeDerived2 extends SomeBase { + constructor() { + super(); + super.privateMember = 1; + } + + fn() { + var x = super.privateMember; + } + + get a() { + var x = super.privateMember; + return undefined; + } + set a(n) { + n = super.privateMember; + } +} + +//super.publicStaticMemberNotFunction in static member function of derived class +//super.publicStaticMemberNotFunction in static member accessor(get and set) of derived class +//super.privateStaticProperty in static member function of derived class +//super.privateStaticProperty in static member accessor(get and set) of derived class +class SomeDerived3 extends SomeBase { + static fn() { + super.publicStaticMember = 3; + super.privateStaticMember = 3; + super.privateStaticFunc(); + } + static get a() { + super.publicStaticMember = 3; + super.privateStaticMember = 3; + super.privateStaticFunc(); + return ''; + } + static set a(n) { + super.publicStaticMember = 3; + super.privateStaticMember = 3; + super.privateStaticFunc(); + } +} + +// In object literal +var obj = { n: super.wat, p: super.foo() }; + + +//// [errorSuperPropertyAccess.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +//super property access in constructor of class with no base type +//super property access in instance member function of class with no base type +//super property access in instance member accessor(get and set) of class with no base type +var NoBase = (function () { + function NoBase() { + this.m = super.prototype; + this.n = super.hasOwnProperty.call(this, ''); + var a = super.prototype; + var b = super.hasOwnProperty.call(this, ''); + } + NoBase.prototype.fn = function () { + var a = super.prototype; + var b = super.hasOwnProperty.call(this, ''); + }; + //super static property access in static member function of class with no base type + //super static property access in static member accessor(get and set) of class with no base type + NoBase.static1 = function () { + super.hasOwnProperty.call(this, ''); + }; + Object.defineProperty(NoBase, "static2", { + get: function () { + super.hasOwnProperty.call(this, ''); + return ''; + }, + set: function (n) { + super.hasOwnProperty.call(this, ''); + }, + enumerable: true, + configurable: true + }); + return NoBase; +})(); +var SomeBase = (function () { + function SomeBase() { + this.privateMember = 0; + this.publicMember = 0; + } + SomeBase.prototype.privateFunc = function () { + }; + SomeBase.prototype.publicFunc = function () { + }; + SomeBase.privateStaticFunc = function () { + }; + SomeBase.publicStaticFunc = function () { + }; + SomeBase.privateStaticMember = 0; + SomeBase.publicStaticMember = 0; + return SomeBase; +})(); +//super.publicInstanceMemberNotFunction in constructor of derived class +//super.publicInstanceMemberNotFunction in instance member function of derived class +//super.publicInstanceMemberNotFunction in instance member accessor(get and set) of derived class +//super property access only available with typed this +var SomeDerived1 = (function (_super) { + __extends(SomeDerived1, _super); + function SomeDerived1() { + _super.call(this); + _super.prototype.publicMember = 1; + } + SomeDerived1.prototype.fn = function () { + var x = _super.prototype.publicMember; + }; + Object.defineProperty(SomeDerived1.prototype, "a", { + get: function () { + var x = _super.prototype.publicMember; + return undefined; + }, + set: function (n) { + n = _super.prototype.publicMember; + }, + enumerable: true, + configurable: true + }); + SomeDerived1.prototype.fn2 = function () { + function inner() { + super.publicFunc.call(this); + } + var x = { + test: function () { + return super.publicFunc.call(this); + } + }; + }; + return SomeDerived1; +})(SomeBase); +//super.privateProperty in constructor of derived class +//super.privateProperty in instance member function of derived class +//super.privateProperty in instance member accessor(get and set) of derived class +var SomeDerived2 = (function (_super) { + __extends(SomeDerived2, _super); + function SomeDerived2() { + _super.call(this); + _super.prototype.privateMember = 1; + } + SomeDerived2.prototype.fn = function () { + var x = _super.prototype.privateMember; + }; + Object.defineProperty(SomeDerived2.prototype, "a", { + get: function () { + var x = _super.prototype.privateMember; + return undefined; + }, + set: function (n) { + n = _super.prototype.privateMember; + }, + enumerable: true, + configurable: true + }); + return SomeDerived2; +})(SomeBase); +//super.publicStaticMemberNotFunction in static member function of derived class +//super.publicStaticMemberNotFunction in static member accessor(get and set) of derived class +//super.privateStaticProperty in static member function of derived class +//super.privateStaticProperty in static member accessor(get and set) of derived class +var SomeDerived3 = (function (_super) { + __extends(SomeDerived3, _super); + function SomeDerived3() { + _super.apply(this, arguments); + } + SomeDerived3.fn = function () { + _super.publicStaticMember = 3; + _super.privateStaticMember = 3; + _super.privateStaticFunc.call(this); + }; + Object.defineProperty(SomeDerived3, "a", { + get: function () { + _super.publicStaticMember = 3; + _super.privateStaticMember = 3; + _super.privateStaticFunc.call(this); + return ''; + }, + set: function (n) { + _super.publicStaticMember = 3; + _super.privateStaticMember = 3; + _super.privateStaticFunc.call(this); + }, + enumerable: true, + configurable: true + }); + return SomeDerived3; +})(SomeBase); +// In object literal +var obj = { n: super.wat, p: super.foo.call(this) }; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js new file mode 100644 index 00000000000..6a9f62c5e49 --- /dev/null +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -0,0 +1,158 @@ +//// [errorsInGenericTypeReference.ts] + +interface IFoo { } + +class Foo { } + + +// in call type arguments +class testClass1 { + method(): void { } +} +var tc1 = new testClass1(); +tc1.method<{ x: V }>(); // error: could not find symbol V + + +// in constructor type arguments +class testClass2 { +} +var tc2 = new testClass2<{ x: V }>(); // error: could not find symbol V + + +// in method return type annotation +class testClass3 { + testMethod1(): Foo<{ x: V }> { return null; } // error: could not find symbol V + static testMethod2(): Foo<{ x: V }> { return null } // error: could not find symbol V + set a(value: Foo<{ x: V }>) { } // error: could not find symbol V + property: Foo<{ x: V }>; // error: could not find symbol V +} + + +// in function return type annotation +function testFunction1(): Foo<{ x: V }> { return null; } // error: could not find symbol V + + +// in paramter types +function testFunction2(p: Foo<{ x: V }>) { }// error: could not find symbol V + + +// in var type annotation +var f: Foo<{ x: V }>; // error: could not find symbol V + + +// in constraints +class testClass4 { } // error: could not find symbol V + +interface testClass5> { } // error: could not find symbol V + +class testClass6 { + method(): void { } // error: could not find symbol V +} + +interface testInterface1 { + new (a: M); // error: could not find symbol V +} + + +// in extends clause +class testClass7 extends Foo<{ x: V }> { } // error: could not find symbol V + + +// in implements clause +class testClass8 implements IFoo<{ x: V }> { } // error: could not find symbol V + + +// in signatures +interface testInterface2 { + new (a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V + [x: string]: Foo<{ x: V }>; // error: could not find symbol V + method(a: Foo<{ x: V }>): Foo<{ x: V }>; //2x: error: could not find symbol V + property: Foo<{ x: V }>; // error: could not find symbol V +} + + + +//// [errorsInGenericTypeReference.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +// in call type arguments +var testClass1 = (function () { + function testClass1() { + } + testClass1.prototype.method = function () { + }; + return testClass1; +})(); +var tc1 = new testClass1(); +tc1.method(); // error: could not find symbol V +// in constructor type arguments +var testClass2 = (function () { + function testClass2() { + } + return testClass2; +})(); +var tc2 = new testClass2(); // error: could not find symbol V +// in method return type annotation +var testClass3 = (function () { + function testClass3() { + } + testClass3.prototype.testMethod1 = function () { + return null; + }; // error: could not find symbol V + testClass3.testMethod2 = function () { + return null; + }; // error: could not find symbol V + Object.defineProperty(testClass3.prototype, "a", { + set: function (value) { + } // error: could not find symbol V + , + enumerable: true, + configurable: true + }); + return testClass3; +})(); +// in function return type annotation +function testFunction1() { + return null; +} // error: could not find symbol V +// in paramter types +function testFunction2(p) { +} // error: could not find symbol V +// in var type annotation +var f; // error: could not find symbol V +// in constraints +var testClass4 = (function () { + function testClass4() { + } + return testClass4; +})(); // error: could not find symbol V +var testClass6 = (function () { + function testClass6() { + } + testClass6.prototype.method = function () { + }; // error: could not find symbol V + return testClass6; +})(); +// in extends clause +var testClass7 = (function (_super) { + __extends(testClass7, _super); + function testClass7() { + _super.apply(this, arguments); + } + return testClass7; +})(Foo); // error: could not find symbol V +// in implements clause +var testClass8 = (function () { + function testClass8() { + } + return testClass8; +})(); // error: could not find symbol V diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js new file mode 100644 index 00000000000..5fd9f0e9b7f --- /dev/null +++ b/tests/baselines/reference/es6ClassTest.js @@ -0,0 +1,151 @@ +//// [es6ClassTest.ts] +class Bar { + public goo: number; + public prop1(x) { + return x; + } + + constructor (n) { } +} + +// new-style class +class Foo extends Bar { + foo:number; + gar = 0; + zoo:string = "zoo"; + x: any; + + bar() { return 0; } + + private boo(); + private boo(x?) { return x; } + + static statVal = 0; + + constructor(); + constructor(x?, private y?:string, public z?=0) { + super(x); + this.x = x; + this.gar = 5; + } +} + +var f = new Foo(); + +declare module AmbientMod { + export class Provide { + foo:number; + zoo:string; + + constructor(); + + private boo(); + bar(); + } +} + + +//class GetSetMonster { + + +// // attack(target) { +// // WScript.Echo("Attacks " + target); +// // } +// // The contextual keyword "get" followed by an identifier and +// // a curly body defines a getter in the same way that "get" +// // defines one in an object literal. +// // get isAlive() { +// // return this.health > 0; +// // } + +// // Likewise, "set" can be used to define setters. +// set health(value:number) { +// if (value < 0) { +// throw new Error('Health must be non-negative.') +// } +// this.health = value +// } +// get health() { return 0; } + +// constructor(this.name: string, health: number) { +// this.health = 0; +// } +//} + + +//class bar { + +// static fnOverload( ); + +// static fnOverload(foo: string){ } // no error + +// constructor(){}; + +//} + + +//// [es6ClassTest.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Bar = (function () { + function Bar(n) { + } + Bar.prototype.prop1 = function (x) { + return x; + }; + return Bar; +})(); +// new-style class +var Foo = (function (_super) { + __extends(Foo, _super); + function Foo(x, y, z) { + if (z === void 0) { z = 0; } + _super.call(this, x); + this.y = y; + this.z = z; + this.gar = 0; + this.zoo = "zoo"; + this.x = x; + this.gar = 5; + } + Foo.prototype.bar = function () { + return 0; + }; + Foo.prototype.boo = function (x) { + return x; + }; + Foo.statVal = 0; + return Foo; +})(Bar); +var f = new Foo(); +//class GetSetMonster { +// // attack(target) { +// // WScript.Echo("Attacks " + target); +// // } +// // The contextual keyword "get" followed by an identifier and +// // a curly body defines a getter in the same way that "get" +// // defines one in an object literal. +// // get isAlive() { +// // return this.health > 0; +// // } +// // Likewise, "set" can be used to define setters. +// set health(value:number) { +// if (value < 0) { +// throw new Error('Health must be non-negative.') +// } +// this.health = value +// } +// get health() { return 0; } +// constructor(this.name: string, health: number) { +// this.health = 0; +// } +//} +//class bar { +// static fnOverload( ); +// static fnOverload(foo: string){ } // no error +// constructor(){}; +//} diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js new file mode 100644 index 00000000000..8ef7a2fa379 --- /dev/null +++ b/tests/baselines/reference/es6ClassTest2.js @@ -0,0 +1,326 @@ +//// [es6ClassTest2.ts] +class BasicMonster { + constructor(public name: string, public health: number) { + + } + + attack(target) { + // WScript.Echo("Attacks " + target); + } + + isAlive = true; +} + +var m1 = new BasicMonster("1", 100); +var m2 = new BasicMonster("2", 100); +m1.attack(m2); +m1.health = 0; +console.log((m5.isAlive).toString()); + +class GetSetMonster { + constructor(public name: string, private _health: number) { + + } + + attack(target) { + // WScript.Echo("Attacks " + target); + } + // The contextual keyword "get" followed by an identifier and + // a curly body defines a getter in the same way that "get" + // defines one in an object literal. + get isAlive() { + return this._health > 0; + } + + // Likewise, "set" can be used to define setters. + set health(value: number) { + if (value < 0) { + throw new Error('Health must be non-negative.') + } + this._health = value + } +} + +var m3 = new BasicMonster("1", 100); +var m4 = new BasicMonster("2", 100); +m3.attack(m4); +m3.health = 0; +var x = (m5.isAlive).toString() + +class OverloadedMonster { + constructor(name: string); + constructor(public name: string, public health?: number) { + + } + + attack(); + attack(a: any); + attack(target?) { + //WScript.Echo("Attacks " + target); + } + + isAlive = true; +} + +var m5 = new OverloadedMonster("1"); +var m6 = new OverloadedMonster("2"); +m5.attack(m6); +m5.health = 0; +var y = (m5.isAlive).toString() + +class SplatMonster { + constructor(...args: string[]) { } + roar(name: string, ...args: number[]) { } +} + + +function foo() { return true; } +class PrototypeMonster { + age: number = 1; + name: string; + b = foo(); +} + +class SuperParent { + constructor(a: number) { + + } + + b(b: string) { + + } + + c() { + + } +} + +class SuperChild extends SuperParent { + constructor() { + super(1); + } + + b() { + super.b('str'); + } + + c() { + super.c(); + } +} + +class Statics { + static foo = 1; + static bar: string; + + static baz() { + return ""; + } +} + +var stat = new Statics(); + +interface IFoo { + x: number; + z: string; +} + +class ImplementsInterface implements IFoo { + public x: number; + public z: string; + constructor() { + this.x = 1; + this.z = "foo"; + } +} + +class Visibility { + public foo() { } + private bar() { } + private x: number; + public y: number; + public z: number; + constructor() { + this.x = 1; + this.y = 2; + } +} + +class BaseClassWithConstructor { + constructor(public x: number, public s: string) { } +} + +// used to test codegen +class ChildClassWithoutConstructor extends BaseClassWithConstructor { } + + +var ccwc = new ChildClassWithoutConstructor(1, "s"); + + + +//// [es6ClassTest2.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var BasicMonster = (function () { + function BasicMonster(name, health) { + this.name = name; + this.health = health; + this.isAlive = true; + } + BasicMonster.prototype.attack = function (target) { + // WScript.Echo("Attacks " + target); + }; + return BasicMonster; +})(); +var m1 = new BasicMonster("1", 100); +var m2 = new BasicMonster("2", 100); +m1.attack(m2); +m1.health = 0; +console.log(m5.isAlive.toString()); +var GetSetMonster = (function () { + function GetSetMonster(name, _health) { + this.name = name; + this._health = _health; + } + GetSetMonster.prototype.attack = function (target) { + // WScript.Echo("Attacks " + target); + }; + Object.defineProperty(GetSetMonster.prototype, "isAlive", { + // The contextual keyword "get" followed by an identifier and + // a curly body defines a getter in the same way that "get" + // defines one in an object literal. + get: function () { + return this._health > 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GetSetMonster.prototype, "health", { + // Likewise, "set" can be used to define setters. + set: function (value) { + if (value < 0) { + throw new Error('Health must be non-negative.'); + } + this._health = value; + }, + enumerable: true, + configurable: true + }); + return GetSetMonster; +})(); +var m3 = new BasicMonster("1", 100); +var m4 = new BasicMonster("2", 100); +m3.attack(m4); +m3.health = 0; +var x = m5.isAlive.toString(); +var OverloadedMonster = (function () { + function OverloadedMonster(name, health) { + this.name = name; + this.health = health; + this.isAlive = true; + } + OverloadedMonster.prototype.attack = function (target) { + //WScript.Echo("Attacks " + target); + }; + return OverloadedMonster; +})(); +var m5 = new OverloadedMonster("1"); +var m6 = new OverloadedMonster("2"); +m5.attack(m6); +m5.health = 0; +var y = m5.isAlive.toString(); +var SplatMonster = (function () { + function SplatMonster() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + } + SplatMonster.prototype.roar = function (name) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + }; + return SplatMonster; +})(); +function foo() { + return true; +} +var PrototypeMonster = (function () { + function PrototypeMonster() { + this.age = 1; + this.b = foo(); + } + return PrototypeMonster; +})(); +var SuperParent = (function () { + function SuperParent(a) { + } + SuperParent.prototype.b = function (b) { + }; + SuperParent.prototype.c = function () { + }; + return SuperParent; +})(); +var SuperChild = (function (_super) { + __extends(SuperChild, _super); + function SuperChild() { + _super.call(this, 1); + } + SuperChild.prototype.b = function () { + _super.prototype.b.call(this, 'str'); + }; + SuperChild.prototype.c = function () { + _super.prototype.c.call(this); + }; + return SuperChild; +})(SuperParent); +var Statics = (function () { + function Statics() { + } + Statics.baz = function () { + return ""; + }; + Statics.foo = 1; + return Statics; +})(); +var stat = new Statics(); +var ImplementsInterface = (function () { + function ImplementsInterface() { + this.x = 1; + this.z = "foo"; + } + return ImplementsInterface; +})(); +var Visibility = (function () { + function Visibility() { + this.x = 1; + this.y = 2; + } + Visibility.prototype.foo = function () { + }; + Visibility.prototype.bar = function () { + }; + return Visibility; +})(); +var BaseClassWithConstructor = (function () { + function BaseClassWithConstructor(x, s) { + this.x = x; + this.s = s; + } + return BaseClassWithConstructor; +})(); +// used to test codegen +var ChildClassWithoutConstructor = (function (_super) { + __extends(ChildClassWithoutConstructor, _super); + function ChildClassWithoutConstructor() { + _super.apply(this, arguments); + } + return ChildClassWithoutConstructor; +})(BaseClassWithConstructor); +var ccwc = new ChildClassWithoutConstructor(1, "s"); diff --git a/tests/baselines/reference/es6ClassTest3.js b/tests/baselines/reference/es6ClassTest3.js new file mode 100644 index 00000000000..371a983d152 --- /dev/null +++ b/tests/baselines/reference/es6ClassTest3.js @@ -0,0 +1,31 @@ +//// [es6ClassTest3.ts] +module M { + class Visibility { + public foo() { }; + private bar() { }; + private x: number; + public y: number; + public z: number; + + constructor() { + this.x = 1; + this.y = 2; + } + } +} + +//// [es6ClassTest3.js] +var M; +(function (M) { + var Visibility = (function () { + function Visibility() { + this.x = 1; + this.y = 2; + } + Visibility.prototype.foo = function () { + }; + Visibility.prototype.bar = function () { + }; + return Visibility; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/es6ClassTest9.js b/tests/baselines/reference/es6ClassTest9.js new file mode 100644 index 00000000000..d45c99d3b04 --- /dev/null +++ b/tests/baselines/reference/es6ClassTest9.js @@ -0,0 +1,9 @@ +//// [es6ClassTest9.ts] +declare class foo(); +function foo() {} + + +//// [es6ClassTest9.js] +(); +function foo() { +} diff --git a/tests/baselines/reference/escapedIdentifiers.js b/tests/baselines/reference/escapedIdentifiers.js index cabeb7f1d5d..5de505e4cb7 100644 --- a/tests/baselines/reference/escapedIdentifiers.js +++ b/tests/baselines/reference/escapedIdentifiers.js @@ -204,19 +204,20 @@ constructorTestObject.arg\u0031 = 1; constructorTestObject.arg2 = 'string'; constructorTestObject.arg\u0033 = true; constructorTestObject.arg4 = 2; +// Lables l\u0061bel1: while (false) { while (false) - continue label1; + continue label1; // it will go to next iteration of outer loop } label2: while (false) { while (false) - continue l\u0061bel2; + continue l\u0061bel2; // it will go to next iteration of outer loop } label3: while (false) { while (false) - continue label3; + continue label3; // it will go to next iteration of outer loop } l\u0061bel4: while (false) { while (false) - continue l\u0061bel4; + continue l\u0061bel4; // it will go to next iteration of outer loop } diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt index 4ebb93b10a7..12478442472 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.errors.txt @@ -25,10 +25,10 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd Type 'string' is not assignable to type 'number'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'. Types of property 'A' are incompatible. - Type 'typeof A' is not assignable to type 'typeof A'. - Type 'A' is not assignable to type 'A'. + Type 'typeof N.A' is not assignable to type 'typeof M.A'. + Type 'N.A' is not assignable to type 'M.A'. Property 'name' is missing in type 'A'. -tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'A' is not assignable to type 'A'. +tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'N.A' is not assignable to type 'M.A'. tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'. Type 'boolean' is not assignable to type 'string'. @@ -124,12 +124,12 @@ tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAnd ~~~~~~~ !!! error TS2322: Type 'typeof N' is not assignable to type 'typeof M'. !!! error TS2322: Types of property 'A' are incompatible. -!!! error TS2322: Type 'typeof A' is not assignable to type 'typeof A'. -!!! error TS2322: Type 'A' is not assignable to type 'A'. +!!! error TS2322: Type 'typeof N.A' is not assignable to type 'typeof M.A'. +!!! error TS2322: Type 'N.A' is not assignable to type 'M.A'. !!! error TS2322: Property 'name' is missing in type 'A'. var aClassInModule: M.A = new N.A(); ~~~~~~~~~~~~~~ -!!! error TS2322: Type 'A' is not assignable to type 'A'. +!!! error TS2322: Type 'N.A' is not assignable to type 'M.A'. var aFunctionInModule: typeof M.F2 = F2; ~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'. diff --git a/tests/baselines/reference/exportAlreadySeen.js b/tests/baselines/reference/exportAlreadySeen.js new file mode 100644 index 00000000000..e18c0bbf7f6 --- /dev/null +++ b/tests/baselines/reference/exportAlreadySeen.js @@ -0,0 +1,38 @@ +//// [exportAlreadySeen.ts] +module M { + export export var x = 1; + export export function f() { } + + export export module N { + export export class C { } + export export interface I { } + } +} + +declare module A { + export export var x; + export export function f() + + export export module N { + export export class C { } + export export interface I { } + } +} + +//// [exportAlreadySeen.js] +var M; +(function (M) { + M.x = 1; + function f() { + } + M.f = f; + var N; + (function (N) { + var C = (function () { + function C() { + } + return C; + })(); + N.C = C; + })(N = M.N || (M.N = {})); +})(M || (M = {})); diff --git a/tests/baselines/reference/exportAssignDottedName.js b/tests/baselines/reference/exportAssignDottedName.js new file mode 100644 index 00000000000..48b06273c17 --- /dev/null +++ b/tests/baselines/reference/exportAssignDottedName.js @@ -0,0 +1,21 @@ +//// [tests/cases/conformance/externalModules/exportAssignDottedName.ts] //// + +//// [foo1.ts] +export function x(){ + return true; +} + +//// [foo2.ts] +import foo1 = require('./foo1'); +export = foo1.x; // Error, export assignment must be identifier only + + +//// [foo1.js] +function x() { + return true; +} +exports.x = x; +//// [foo2.js] +var foo1 = require('./foo1'); +x; // Error, export assignment must be identifier only +module.exports = foo1; diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.js b/tests/baselines/reference/exportAssignImportedIdentifier.js new file mode 100644 index 00000000000..b371e4db5e0 --- /dev/null +++ b/tests/baselines/reference/exportAssignImportedIdentifier.js @@ -0,0 +1,28 @@ +//// [tests/cases/conformance/externalModules/exportAssignImportedIdentifier.ts] //// + +//// [foo1.ts] +export function x(){ + return true; +} + +//// [foo2.ts] +import foo1 = require('./foo1'); +var x = foo1.x; +export = x; + +//// [foo3.ts] +import foo2 = require('./foo2'); +var x = foo2(); // should be boolean + +//// [foo1.js] +function x() { + return true; +} +exports.x = x; +//// [foo2.js] +var foo1 = require('./foo1'); +var x = foo1.x; +module.exports = x; +//// [foo3.js] +var foo2 = require('./foo2'); +var x = foo2(); // should be boolean diff --git a/tests/baselines/reference/exportAssignNonIdentifier.js b/tests/baselines/reference/exportAssignNonIdentifier.js new file mode 100644 index 00000000000..aaefca034cb --- /dev/null +++ b/tests/baselines/reference/exportAssignNonIdentifier.js @@ -0,0 +1,52 @@ +//// [tests/cases/conformance/externalModules/exportAssignNonIdentifier.ts] //// + +//// [foo1.ts] +var x = 10; +export = typeof x; // Error + +//// [foo2.ts] +export = "sausages"; // Error + +//// [foo3.ts] +export = class Foo3 {}; // Error + +//// [foo4.ts] +export = true; // Error + +//// [foo5.ts] +export = undefined; // Valid. undefined is an identifier in JavaScript/TypeScript + +//// [foo6.ts] +export = void; // Error + +//// [foo7.ts] +export = Date || String; // Error + +//// [foo8.ts] +export = null; // Error + + + +//// [foo1.js] +var x = 10; +typeof x; // Error +//// [foo2.js] +"sausages"; // Error +//// [foo3.js] +var Foo3 = (function () { + function Foo3() { + } + return Foo3; +})(); +; // Error +//// [foo4.js] +true; // Error +//// [foo5.js] +module.exports = undefined; +//// [foo6.js] +void ; // Error +//// [foo7.js] + || String; // Error +module.exports = Date; +//// [foo8.js] +null; // Error diff --git a/tests/baselines/reference/exportAssignTypes.js b/tests/baselines/reference/exportAssignTypes.js new file mode 100644 index 00000000000..e898f798a7c --- /dev/null +++ b/tests/baselines/reference/exportAssignTypes.js @@ -0,0 +1,93 @@ +//// [tests/cases/conformance/externalModules/exportAssignTypes.ts] //// + +//// [expString.ts] +var x = "test"; +export = x; + +//// [expNumber.ts] +var x = 42; +export = x; + +//// [expBoolean.ts] +var x = true; +export = x; + +//// [expArray.ts] +var x = [1,2]; +export = x; + +//// [expObject.ts] +var x = { answer: 42, when: 1776}; +export = x; + +//// [expAny.ts] +var x; +export = x; + +//// [expGeneric.ts] +function x(a: T){ + return a; +} +export = x; + +//// [consumer.ts] +import iString = require('./expString'); +var v1: string = iString; + +import iNumber = require('./expNumber'); +var v2: number = iNumber; + +import iBoolean = require('./expBoolean'); +var v3: boolean = iBoolean; + +import iArray = require('./expArray'); +var v4: Array = iArray; + +import iObject = require('./expObject'); +var v5: Object = iObject; + +import iAny = require('./expAny'); +var v6 = iAny; + +import iGeneric = require('./expGeneric'); +var v7: {(p1: x): x} = iGeneric; + + +//// [expString.js] +var x = "test"; +module.exports = x; +//// [expNumber.js] +var x = 42; +module.exports = x; +//// [expBoolean.js] +var x = true; +module.exports = x; +//// [expArray.js] +var x = [1, 2]; +module.exports = x; +//// [expObject.js] +var x = { answer: 42, when: 1776 }; +module.exports = x; +//// [expAny.js] +var x; +module.exports = x; +//// [expGeneric.js] +function x(a) { + return a; +} +module.exports = x; +//// [consumer.js] +var iString = require('./expString'); +var v1 = iString; +var iNumber = require('./expNumber'); +var v2 = iNumber; +var iBoolean = require('./expBoolean'); +var v3 = iBoolean; +var iArray = require('./expArray'); +var v4 = iArray; +var iObject = require('./expObject'); +var v5 = iObject; +var iAny = require('./expAny'); +var v6 = iAny; +var iGeneric = require('./expGeneric'); +var v7 = iGeneric; diff --git a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt index cf63c48925f..946bc8ee8b1 100644 --- a/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt +++ b/tests/baselines/reference/exportAssignmentConstrainedGenericType.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. + Property 'a' is missing in type 'Boolean'. ==== tests/cases/conformance/externalModules/foo_1.ts (1 errors) ==== @@ -6,6 +7,7 @@ tests/cases/conformance/externalModules/foo_1.ts(2,17): error TS2345: Argument o var x = new foo(true); // Should error ~~~~ !!! error TS2345: Argument of type 'boolean' is not assignable to parameter of type '{ a: string; b: number; }'. +!!! error TS2345: Property 'a' is missing in type 'Boolean'. var y = new foo({a: "test", b: 42}); // Should be OK var z: number = y.test.b; ==== tests/cases/conformance/externalModules/foo_0.ts (0 errors) ==== diff --git a/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.js b/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.js new file mode 100644 index 00000000000..74396bb951b --- /dev/null +++ b/tests/baselines/reference/exportAssignmentWithDeclareAndExportModifiers.js @@ -0,0 +1,7 @@ +//// [exportAssignmentWithDeclareAndExportModifiers.ts] +var x; +export declare export = x; + +//// [exportAssignmentWithDeclareAndExportModifiers.js] +var x; +module.exports = x; diff --git a/tests/baselines/reference/exportAssignmentWithDeclareModifier.js b/tests/baselines/reference/exportAssignmentWithDeclareModifier.js new file mode 100644 index 00000000000..711538616aa --- /dev/null +++ b/tests/baselines/reference/exportAssignmentWithDeclareModifier.js @@ -0,0 +1,7 @@ +//// [exportAssignmentWithDeclareModifier.ts] +var x; +declare export = x; + +//// [exportAssignmentWithDeclareModifier.js] +var x; +module.exports = x; diff --git a/tests/baselines/reference/exportAssignmentWithExportModifier.js b/tests/baselines/reference/exportAssignmentWithExportModifier.js new file mode 100644 index 00000000000..9d94cc8db75 --- /dev/null +++ b/tests/baselines/reference/exportAssignmentWithExportModifier.js @@ -0,0 +1,7 @@ +//// [exportAssignmentWithExportModifier.ts] +var x; +export export = x; + +//// [exportAssignmentWithExportModifier.js] +var x; +module.exports = x; diff --git a/tests/baselines/reference/exportAssignmentWithoutIdentifier1.js b/tests/baselines/reference/exportAssignmentWithoutIdentifier1.js new file mode 100644 index 00000000000..a90e17d790e --- /dev/null +++ b/tests/baselines/reference/exportAssignmentWithoutIdentifier1.js @@ -0,0 +1,18 @@ +//// [exportAssignmentWithoutIdentifier1.ts] +function Greeter() { + //... +} +Greeter.prototype.greet = function () { + //... +} +export = new Greeter(); + + +//// [exportAssignmentWithoutIdentifier1.js] +function Greeter() { + //... +} +Greeter.prototype.greet = function () { + //... +}; +new Greeter(); diff --git a/tests/baselines/reference/exportDeclareClass1.js b/tests/baselines/reference/exportDeclareClass1.js new file mode 100644 index 00000000000..121db110cc1 --- /dev/null +++ b/tests/baselines/reference/exportDeclareClass1.js @@ -0,0 +1,16 @@ +//// [exportDeclareClass1.ts] + export declare class eaC { + static tF() { }; + static tsF(param:any) { }; + }; + + export declare class eaC2 { + static tF(); + static tsF(param:any); + }; + +//// [exportDeclareClass1.js] +define(["require", "exports"], function (require, exports) { + ; + ; +}); diff --git a/tests/baselines/reference/exportDeclaredModule.js b/tests/baselines/reference/exportDeclaredModule.js new file mode 100644 index 00000000000..7aa75288bff --- /dev/null +++ b/tests/baselines/reference/exportDeclaredModule.js @@ -0,0 +1,19 @@ +//// [tests/cases/conformance/externalModules/exportDeclaredModule.ts] //// + +//// [foo1.ts] + +declare module M1 { + export var a: string; + export function b(): number; +} +export = M1; + +//// [foo2.ts] +import foo1 = require('./foo1'); +var x: number = foo1.b(); + +//// [foo1.js] +module.exports = M1; +//// [foo2.js] +var foo1 = require('./foo1'); +var x = foo1.b(); diff --git a/tests/baselines/reference/exportNonVisibleType.js b/tests/baselines/reference/exportNonVisibleType.js new file mode 100644 index 00000000000..101c356d582 --- /dev/null +++ b/tests/baselines/reference/exportNonVisibleType.js @@ -0,0 +1,54 @@ +//// [tests/cases/conformance/externalModules/exportNonVisibleType.ts] //// + +//// [foo1.ts] +interface I1 { + a: string; + b: number; +} + +var x: I1 = {a: "test", b: 42}; +export = x; // Should fail, I1 not exported. + + +//// [foo2.ts] +interface I1 { + a: string; + b: number; +} + +class C1 { + m1: I1; +} + +export = C1; // Should fail, type I1 of visible member C1.m1 not exported. + +//// [foo3.ts] +interface I1 { + a: string; + b: number; +} + +class C1 { + private m1: I1; +} + +export = C1; // Should work, private type I1 of visible class C1 only used in private member m1. + + +//// [foo1.js] +var x = { a: "test", b: 42 }; +module.exports = x; +//// [foo2.js] +var C1 = (function () { + function C1() { + } + return C1; +})(); +module.exports = C1; +//// [foo3.js] +var C1 = (function () { + function C1() { + } + return C1; +})(); +module.exports = C1; diff --git a/tests/baselines/reference/exportingContainingVisibleType.js b/tests/baselines/reference/exportingContainingVisibleType.js new file mode 100644 index 00000000000..2246a63bc49 --- /dev/null +++ b/tests/baselines/reference/exportingContainingVisibleType.js @@ -0,0 +1,29 @@ +//// [exportingContainingVisibleType.ts] +class Foo { + public get foo() { + var i: Foo; + return i; // Should be fine (previous bug report visibility error). + + } +} + +export var x = 5; + + +//// [exportingContainingVisibleType.js] +define(["require", "exports"], function (require, exports) { + var Foo = (function () { + function Foo() { + } + Object.defineProperty(Foo.prototype, "foo", { + get: function () { + var i; + return i; // Should be fine (previous bug report visibility error). + }, + enumerable: true, + configurable: true + }); + return Foo; + })(); + exports.x = 5; +}); diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js new file mode 100644 index 00000000000..5c328e39131 --- /dev/null +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -0,0 +1,29 @@ +//// [extendsClauseAlreadySeen.ts] +class C { + +} +class D extends C extends C { + baz() { } +} + +//// [extendsClauseAlreadySeen.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + D.prototype.baz = function () { + }; + return D; +})(C); diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js new file mode 100644 index 00000000000..3f3b7049311 --- /dev/null +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -0,0 +1,29 @@ +//// [extendsClauseAlreadySeen2.ts] +class C { + +} +class D extends C extends C { + baz() { } +} + +//// [extendsClauseAlreadySeen2.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + D.prototype.baz = function () { + }; + return D; +})(C); diff --git a/tests/baselines/reference/extension.js b/tests/baselines/reference/extension.js new file mode 100644 index 00000000000..40f4af12564 --- /dev/null +++ b/tests/baselines/reference/extension.js @@ -0,0 +1,37 @@ +//// [extension.ts] +interface I { + x; +} + +interface I { + y; +} + +declare module M { + export class C { + public p:number; + } +} + +declare module M { + export extension class C { + public pe:string; + } +} + +var c=new M.C(); +c.pe; +c.p; +var i:I; +i.x; +i.y; + + + +//// [extension.js] +var c = new M.C(); +c.pe; +c.p; +var i; +i.x; +i.y; diff --git a/tests/baselines/reference/externModule.js b/tests/baselines/reference/externModule.js new file mode 100644 index 00000000000..0dc3d8e84cd --- /dev/null +++ b/tests/baselines/reference/externModule.js @@ -0,0 +1,58 @@ +//// [externModule.ts] +declare module { + export class XDate { + public getDay():number; + public getXDate():number; + // etc. + + // Called as a function + // Not supported anymore? public (): string; + + // Called as a constructor + constructor(year: number, month: number); + constructor(year: number, month: number, date: number); + constructor(year: number, month: number, date: number, hours: number); + constructor(year: number, month: number, date: number, hours: number, minutes: number); + constructor(year: number, month: number, date: number, hours: number, minutes: number, seconds: number); + constructor(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, ms: number); + constructor(value: number); + constructor(); + + static parse(string: string): number; + static UTC(year: number, month: number): number; + static UTC(year: number, month: number, date: number): number; + static UTC(year: number, month: number, date: number, hours: number): number; + static UTC(year: number, month: number, date: number, hours: number, minutes: number): number; + static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number): number; + static UTC(year: number, month: number, date: number, hours: number, minutes: number, seconds: number, + ms: number): number; + static now(): number; + } +} + +var d=new XDate(); +d.getDay(); +d=new XDate(1978,2); +d.getXDate(); +var n=XDate.parse("3/2/2004"); +n=XDate.UTC(1964,2,1); + + + +//// [externModule.js] +declare; +module; +{ +} +var XDate = (function () { + function XDate() { + } + return XDate; +})(); +exports.XDate = XDate; +var d = new XDate(); +d.getDay(); +d = new XDate(1978, 2); +d.getXDate(); +var n = XDate.parse("3/2/2004"); +n = XDate.UTC(1964, 2, 1); diff --git a/tests/baselines/reference/externSemantics.js b/tests/baselines/reference/externSemantics.js new file mode 100644 index 00000000000..ed418c66f18 --- /dev/null +++ b/tests/baselines/reference/externSemantics.js @@ -0,0 +1,7 @@ +//// [externSemantics.ts] +declare var x=10; +declare var v; +declare var y:number=3; + + +//// [externSemantics.js] diff --git a/tests/baselines/reference/externSyntax.js b/tests/baselines/reference/externSyntax.js new file mode 100644 index 00000000000..409a9bcecef --- /dev/null +++ b/tests/baselines/reference/externSyntax.js @@ -0,0 +1,17 @@ +//// [externSyntax.ts] +declare var v; +declare module M { + export class D { + public p; + } + export class C { + public f(); + public g() { } // error body + } +} + + + + + +//// [externSyntax.js] diff --git a/tests/baselines/reference/externalModuleWithoutCompilerFlag1.js b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.js new file mode 100644 index 00000000000..b5c939453e6 --- /dev/null +++ b/tests/baselines/reference/externalModuleWithoutCompilerFlag1.js @@ -0,0 +1,7 @@ +//// [externalModuleWithoutCompilerFlag1.ts] + +// Not on line 0 because we want to verify the error is placed in the appropriate location. + export module M { +} + +//// [externalModuleWithoutCompilerFlag1.js] diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.js b/tests/baselines/reference/fatarrowfunctionsErrors.js new file mode 100644 index 00000000000..fd47f60b6a0 --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsErrors.js @@ -0,0 +1,47 @@ +//// [fatarrowfunctionsErrors.ts] +foo((...Far:any[])=>{return 0;}) +foo((1)=>{return 0;}); +foo((x?)=>{return x;}) +foo((x=0)=>{return x;}) +var y = x:number => x*x; +false? (() => null): null; + +// missing fatarrow +var x1 = () :void {}; +var x2 = (a:number) :void {}; +var x3 = (a:number) {}; +var x4= (...a: any[]) { }; + +//// [fatarrowfunctionsErrors.js] +foo(function () { + var Far = []; + for (var _i = 0; _i < arguments.length; _i++) { + Far[_i - 0] = arguments[_i]; + } + return 0; +}); +foo((1), { return: 0 }); +; +foo(function (x) { + return x; +}); +foo(function (x) { + if (x === void 0) { x = 0; } + return x; +}); +var y = x, number; +x * x; +false ? (function () { return null; }) : null; +// missing fatarrow +var x1 = function () { +}; +var x2 = function (a) { +}; +var x3 = function (a) { +}; +var x4 = function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } +}; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js new file mode 100644 index 00000000000..0b816cc9e09 --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js @@ -0,0 +1,394 @@ +//// [fatarrowfunctionsOptionalArgs.ts] +// valid + +// no params +() => 1; + +// one param, no type +(arg) => 2; + +// one param, no type +arg => 2; + +// one param, no type with default value +(arg = 1) => 3; + +// one param, no type, optional +(arg?) => 4; + +// typed param +(arg: number) => 5; + +// typed param with default value +(arg: number = 0) => 6; + +// optional param +(arg?: number) => 7; + +// var arg param +(...arg: number[]) => 8; + +// multiple arguments +(arg1, arg2) => 12; +(arg1 = 1, arg2 =3) => 13; +(arg1?, arg2?) => 14; +(arg1: number, arg2: number) => 15; +(arg1: number = 0, arg2: number = 1) => 16; +(arg1?: number, arg2?: number) => 17; +(arg1, ...arg2: number[]) => 18; +(arg1, arg2?: number) => 19; + +// in paren +(() => 21); +((arg) => 22); +((arg = 1) => 23); +((arg?) => 24); +((arg: number) => 25); +((arg: number = 0) => 26); +((arg?: number) => 27); +((...arg: number[]) => 28); + +// in multiple paren +(((((arg) => { return 32; })))); + +// in ternary exression +false ? () => 41 : null; +false ? (arg) => 42 : null; +false ? (arg = 1) => 43 : null; +false ? (arg?) => 44 : null; +false ? (arg: number) => 45 : null; +false ? (arg?: number) => 46 : null; +false ? (arg?: number = 0) => 47 : null; +false ? (...arg: number[]) => 48 : null; + +// in ternary exression within paren +false ? (() => 51) : null; +false ? ((arg) => 52) : null; +false ? ((arg = 1) => 53) : null; +false ? ((arg?) => 54) : null; +false ? ((arg: number) => 55) : null; +false ? ((arg?: number) => 56) : null; +false ? ((arg?: number = 0) => 57) : null; +false ? ((...arg: number[]) => 58) : null; + +// ternary exression's else clause +false ? null : () => 61; +false ? null : (arg) => 62; +false ? null : (arg = 1) => 63; +false ? null : (arg?) => 64; +false ? null : (arg: number) => 65; +false ? null : (arg?: number) => 66; +false ? null : (arg?: number = 0) => 67; +false ? null : (...arg: number[]) => 68; + + +// nested ternary expressions +((a?) => { return a; }) ? (b? ) => { return b; } : (c? ) => { return c; }; + +//multiple levels +(a?) => { return a; } ? (b)=>(c)=>81 : (c)=>(d)=>82; + + +// In Expressions +((arg) => 90) instanceof Function; +((arg = 1) => 91) instanceof Function; +((arg? ) => 92) instanceof Function; +((arg: number) => 93) instanceof Function; +((arg: number = 1) => 94) instanceof Function; +((arg?: number) => 95) instanceof Function; +((...arg: number[]) => 96) instanceof Function; + +'' + ((arg) => 100); +((arg) => 0) + '' + ((arg) => 101); +((arg = 1) => 0) + '' + ((arg = 2) => 102); +((arg?) => 0) + '' + ((arg?) => 103); +((arg:number) => 0) + '' + ((arg:number) => 104); +((arg:number = 1) => 0) + '' + ((arg:number = 2) => 105); +((arg?:number = 1) => 0) + '' + ((arg?:number = 2) => 106); +((...arg:number[]) => 0) + '' + ((...arg:number[]) => 107); +((arg1, arg2?) => 0) + '' + ((arg1,arg2?) => 108); +((arg1, ...arg2:number[]) => 0) + '' + ((arg1, ...arg2:number[]) => 108); + + +// Function Parameters +function foo(...arg: any[]) { } + +foo( + (a) => 110, + ((a) => 111), + (a) => { + return 112; + }, + (a? ) => 113, + (a, b? ) => 114, + (a: number) => 115, + (a: number = 0) => 116, + (a = 0) => 117, + (a?: number = 0) => 118, + (...a: number[]) => 119, + (a, b? = 0, ...c: number[]) => 120, + (a) => (b) => (c) => 121, + false? (a) => 0 : (b) => 122 +); + +//// [fatarrowfunctionsOptionalArgs.js] +// valid +// no params +(function () { return 1; }); +// one param, no type +(function (arg) { return 2; }); +// one param, no type +(function (arg) { return 2; }); +// one param, no type with default value +(function (arg) { + if (arg === void 0) { arg = 1; } + return 3; +}); +// one param, no type, optional +(function (arg) { return 4; }); +// typed param +(function (arg) { return 5; }); +// typed param with default value +(function (arg) { + if (arg === void 0) { arg = 0; } + return 6; +}); +// optional param +(function (arg) { return 7; }); +// var arg param +(function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 8; +}); +// multiple arguments +(function (arg1, arg2) { return 12; }); +(function (arg1, arg2) { + if (arg1 === void 0) { arg1 = 1; } + if (arg2 === void 0) { arg2 = 3; } + return 13; +}); +(function (arg1, arg2) { return 14; }); +(function (arg1, arg2) { return 15; }); +(function (arg1, arg2) { + if (arg1 === void 0) { arg1 = 0; } + if (arg2 === void 0) { arg2 = 1; } + return 16; +}); +(function (arg1, arg2) { return 17; }); +(function (arg1) { + var arg2 = []; + for (var _i = 1; _i < arguments.length; _i++) { + arg2[_i - 1] = arguments[_i]; + } + return 18; +}); +(function (arg1, arg2) { return 19; }); +// in paren +(function () { return 21; }); +(function (arg) { return 22; }); +(function (arg) { + if (arg === void 0) { arg = 1; } + return 23; +}); +(function (arg) { return 24; }); +(function (arg) { return 25; }); +(function (arg) { + if (arg === void 0) { arg = 0; } + return 26; +}); +(function (arg) { return 27; }); +(function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 28; +}); +// in multiple paren +((((function (arg) { + return 32; +})))); +// in ternary exression +false ? function () { return 41; } : null; +false ? function (arg) { return 42; } : null; +false ? function (arg) { + if (arg === void 0) { arg = 1; } + return 43; +} : null; +false ? function (arg) { return 44; } : null; +false ? function (arg) { return 45; } : null; +false ? function (arg) { return 46; } : null; +false ? function (arg) { + if (arg === void 0) { arg = 0; } + return 47; +} : null; +false ? function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 48; +} : null; +// in ternary exression within paren +false ? (function () { return 51; }) : null; +false ? (function (arg) { return 52; }) : null; +false ? (function (arg) { + if (arg === void 0) { arg = 1; } + return 53; +}) : null; +false ? (function (arg) { return 54; }) : null; +false ? (function (arg) { return 55; }) : null; +false ? (function (arg) { return 56; }) : null; +false ? (function (arg) { + if (arg === void 0) { arg = 0; } + return 57; +}) : null; +false ? (function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 58; +}) : null; +// ternary exression's else clause +false ? null : function () { return 61; }; +false ? null : function (arg) { return 62; }; +false ? null : function (arg) { + if (arg === void 0) { arg = 1; } + return 63; +}; +false ? null : function (arg) { return 64; }; +false ? null : function (arg) { return 65; }; +false ? null : function (arg) { return 66; }; +false ? null : function (arg) { + if (arg === void 0) { arg = 0; } + return 67; +}; +false ? null : function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 68; +}; +// nested ternary expressions +(function (a) { + return a; +}) ? function (b) { + return b; +} : function (c) { + return c; +}; +//multiple levels +(function (a) { + return a; +}); +(function (b) { return function (c) { return 81; }; }); +(function (c) { return function (d) { return 82; }; }); +// In Expressions +(function (arg) { return 90; }) instanceof Function; +(function (arg) { + if (arg === void 0) { arg = 1; } + return 91; +}) instanceof Function; +(function (arg) { return 92; }) instanceof Function; +(function (arg) { return 93; }) instanceof Function; +(function (arg) { + if (arg === void 0) { arg = 1; } + return 94; +}) instanceof Function; +(function (arg) { return 95; }) instanceof Function; +(function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 96; +}) instanceof Function; +'' + (function (arg) { return 100; }); +(function (arg) { return 0; }) + '' + (function (arg) { return 101; }); +(function (arg) { + if (arg === void 0) { arg = 1; } + return 0; +}) + '' + (function (arg) { + if (arg === void 0) { arg = 2; } + return 102; +}); +(function (arg) { return 0; }) + '' + (function (arg) { return 103; }); +(function (arg) { return 0; }) + '' + (function (arg) { return 104; }); +(function (arg) { + if (arg === void 0) { arg = 1; } + return 0; +}) + '' + (function (arg) { + if (arg === void 0) { arg = 2; } + return 105; +}); +(function (arg) { + if (arg === void 0) { arg = 1; } + return 0; +}) + '' + (function (arg) { + if (arg === void 0) { arg = 2; } + return 106; +}); +(function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 0; +}) + '' + (function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 107; +}); +(function (arg1, arg2) { return 0; }) + '' + (function (arg1, arg2) { return 108; }); +(function (arg1) { + var arg2 = []; + for (var _i = 1; _i < arguments.length; _i++) { + arg2[_i - 1] = arguments[_i]; + } + return 0; +}) + '' + (function (arg1) { + var arg2 = []; + for (var _i = 1; _i < arguments.length; _i++) { + arg2[_i - 1] = arguments[_i]; + } + return 108; +}); +// Function Parameters +function foo() { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } +} +foo(function (a) { return 110; }, (function (a) { return 111; }), function (a) { + return 112; +}, function (a) { return 113; }, function (a, b) { return 114; }, function (a) { return 115; }, function (a) { + if (a === void 0) { a = 0; } + return 116; +}, function (a) { + if (a === void 0) { a = 0; } + return 117; +}, function (a) { + if (a === void 0) { a = 0; } + return 118; +}, function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } + return 119; +}, function (a, b) { + if (b === void 0) { b = 0; } + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } + return 120; +}, function (a) { return function (b) { return function (c) { return 121; }; }; }, false ? function (a) { return 0; } : function (b) { return 122; }); diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors1.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors1.js new file mode 100644 index 00000000000..428a085ca56 --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors1.js @@ -0,0 +1,38 @@ +//// [fatarrowfunctionsOptionalArgsErrors1.ts] +(arg1?, arg2) => 101; +(...arg?) => 102; +(...arg) => 103; +(...arg:number [] = []) => 104; + +// Non optional parameter following an optional one +(arg1 = 1, arg2) => 1; + +//// [fatarrowfunctionsOptionalArgsErrors1.js] +(function (arg1, arg2) { return 101; }); +(function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 102; +}); +(function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 103; +}); +(function () { + if (arg === void 0) { arg = []; } + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 104; +}); +// Non optional parameter following an optional one +(function (arg1, arg2) { + if (arg1 === void 0) { arg1 = 1; } + return 1; +}); diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.js new file mode 100644 index 00000000000..b51003b62df --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors2.js @@ -0,0 +1,13 @@ +//// [fatarrowfunctionsOptionalArgsErrors2.ts] +var tt1 = (a, (b, c)) => a+b+c; +var tt2 = ((a), b, c) => a+b+c; + +var tt3 = ((a)) => a; + +//// [fatarrowfunctionsOptionalArgsErrors2.js] +var tt1 = (a, (b, c)); +a + b + c; +var tt2 = ((a), b, c); +a + b + c; +var tt3 = ((a)); +a; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors3.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors3.js new file mode 100644 index 00000000000..665c5244016 --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors3.js @@ -0,0 +1,12 @@ +//// [fatarrowfunctionsOptionalArgsErrors3.ts] +(...) => 105; + + +//// [fatarrowfunctionsOptionalArgsErrors3.js] +(function () { + var = []; + for (var _i = 0; _i < arguments.length; _i++) { + [_i - 0] = arguments[_i]; + } + return 105; +}); diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.js new file mode 100644 index 00000000000..dfd7e9f74dc --- /dev/null +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgsErrors4.js @@ -0,0 +1,69 @@ +//// [fatarrowfunctionsOptionalArgsErrors4.ts] + false ? (arg?: number = 0) => 47 : null; + false ? ((arg?: number = 0) => 57) : null; + false ? null : (arg?: number = 0) => 67; + ((arg?:number = 1) => 0) + '' + ((arg?:number = 2) => 106); + + foo( + (a) => 110, + ((a) => 111), + (a) => { + return 112; + }, + (a? ) => 113, + (a, b? ) => 114, + (a: number) => 115, + (a: number = 0) => 116, + (a = 0) => 117, + (a?: number = 0) => 118, + (...a: number[]) => 119, + (a, b? = 0, ...c: number[]) => 120, + (a) => (b) => (c) => 121, + false? (a) => 0 : (b) => 122 + ); + +//// [fatarrowfunctionsOptionalArgsErrors4.js] +false ? function (arg) { + if (arg === void 0) { arg = 0; } + return 47; +} : null; +false ? (function (arg) { + if (arg === void 0) { arg = 0; } + return 57; +}) : null; +false ? null : function (arg) { + if (arg === void 0) { arg = 0; } + return 67; +}; +(function (arg) { + if (arg === void 0) { arg = 1; } + return 0; +}) + '' + (function (arg) { + if (arg === void 0) { arg = 2; } + return 106; +}); +foo(function (a) { return 110; }, (function (a) { return 111; }), function (a) { + return 112; +}, function (a) { return 113; }, function (a, b) { return 114; }, function (a) { return 115; }, function (a) { + if (a === void 0) { a = 0; } + return 116; +}, function (a) { + if (a === void 0) { a = 0; } + return 117; +}, function (a) { + if (a === void 0) { a = 0; } + return 118; +}, function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } + return 119; +}, function (a, b) { + if (b === void 0) { b = 0; } + var c = []; + for (var _i = 2; _i < arguments.length; _i++) { + c[_i - 2] = arguments[_i]; + } + return 120; +}, function (a) { return function (b) { return function (c) { return 121; }; }; }, false ? function (a) { return 0; } : function (b) { return 122; }); diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.js b/tests/baselines/reference/fieldAndGetterWithSameName.js new file mode 100644 index 00000000000..64129ff9365 --- /dev/null +++ b/tests/baselines/reference/fieldAndGetterWithSameName.js @@ -0,0 +1,22 @@ +//// [fieldAndGetterWithSameName.ts] +export class C { + x: number; + get x(): number { return 1; } +} + +//// [fieldAndGetterWithSameName.js] +define(["require", "exports"], function (require, exports) { + var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C; + })(); + exports.C = C; +}); diff --git a/tests/baselines/reference/for.js b/tests/baselines/reference/for.js new file mode 100644 index 00000000000..a77b68d8b6e --- /dev/null +++ b/tests/baselines/reference/for.js @@ -0,0 +1,56 @@ +//// [for.ts] +for (var i = 0; i < 10; i++) { // ok + var x1 = i; +} + +for (var j: number = 0; j < 10; j++) { // ok + var x2 = j; +} + +for (var k = 0; k < 10;) { // ok + k++; +} + +for (; i < 10;) { // ok + i++; +} + +for (; i > 1; i--) { // ok +} + +for (var l = 0; ; l++) { // ok + if (l > 10) { + break; + } +} + +for (; ;) { // ok +} + +for () { // error +} + +//// [for.js] +for (var i = 0; i < 10; i++) { + var x1 = i; +} +for (var j = 0; j < 10; j++) { + var x2 = j; +} +for (var k = 0; k < 10;) { + k++; +} +for (; i < 10;) { + i++; +} +for (; i > 1; i--) { +} +for (var l = 0;; l++) { + if (l > 10) { + break; + } +} +for (;;) { +} +for (;;) { +} diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 73db1ff3c7d..4dbfe7e62bc 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -93,6 +93,7 @@ var M; } M.F2 = F2; })(M || (M = {})); +// all of these are errors for (var a;;) { } for (var a = 1;;) { diff --git a/tests/baselines/reference/functionAndPropertyNameConflict.js b/tests/baselines/reference/functionAndPropertyNameConflict.js new file mode 100644 index 00000000000..1368f8241d5 --- /dev/null +++ b/tests/baselines/reference/functionAndPropertyNameConflict.js @@ -0,0 +1,23 @@ +//// [functionAndPropertyNameConflict.ts] +class C65 { + public aaaaa() { } + public get aaaaa() { + return 1; + } +} + +//// [functionAndPropertyNameConflict.js] +var C65 = (function () { + function C65() { + } + C65.prototype.aaaaa = function () { + }; + Object.defineProperty(C65.prototype, "aaaaa", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C65; +})(); diff --git a/tests/baselines/reference/functionCall7.errors.txt b/tests/baselines/reference/functionCall7.errors.txt index 576ea9c266e..19e572fa58d 100644 --- a/tests/baselines/reference/functionCall7.errors.txt +++ b/tests/baselines/reference/functionCall7.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/functionCall7.ts(5,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/functionCall7.ts(6,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. + Property 'a' is missing in type 'Number'. tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. @@ -14,6 +15,7 @@ tests/cases/compiler/functionCall7.ts(7,1): error TS2346: Supplied parameters do foo(4); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'c1'. +!!! error TS2345: Property 'a' is missing in type 'Number'. foo(); ~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt index 4af5c01c505..03ce9952938 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt +++ b/tests/baselines/reference/functionConstraintSatisfaction2.errors.txt @@ -1,8 +1,11 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(5,5): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. + Property 'apply' is missing in type 'Number'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(6,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(23,14): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(x: string) => string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(24,15): error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. + Types of parameters 'x' and 'x' are incompatible. + Type 'string[]' is not assignable to type 'string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(25,15): error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(26,15): error TS2345: Argument of type 'new (x: string) => string' is not assignable to parameter of type '(x: string) => string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(28,16): error TS2345: Argument of type '(x: U, y: V) => U' is not assignable to parameter of type '(x: string) => string'. @@ -11,6 +14,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(34,16): error TS2345: Argument of type 'F2' is not assignable to parameter of type '(x: string) => string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(36,38): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(37,10): error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. + Type 'void' is not assignable to type 'string'. tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction2.ts(38,10): error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. @@ -22,6 +26,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain foo(1); ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Function'. +!!! error TS2345: Property 'apply' is missing in type 'Number'. foo(() => { }, 1); ~~~~~~~~~~~~~~~~~ !!! error TS2346: Supplied parameters do not match any signature of call target. @@ -49,6 +54,8 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain var r2 = foo2((x: string[]) => x); ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: string[]) => string[]' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2345: Type 'string[]' is not assignable to type 'string'. var r6 = foo2(C); ~ !!! error TS2345: Argument of type 'typeof C' is not assignable to parameter of type '(x: string) => string'. @@ -78,6 +85,7 @@ tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstrain foo2(x); ~ !!! error TS2345: Argument of type 'T' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type 'void' is not assignable to type 'string'. foo2(y); ~ !!! error TS2345: Argument of type 'U' is not assignable to parameter of type '(x: string) => string'. diff --git a/tests/baselines/reference/functionOverloadErrorsSyntax.js b/tests/baselines/reference/functionOverloadErrorsSyntax.js new file mode 100644 index 00000000000..3706f4da744 --- /dev/null +++ b/tests/baselines/reference/functionOverloadErrorsSyntax.js @@ -0,0 +1,20 @@ +//// [functionOverloadErrorsSyntax.ts] +//Function overload signature with optional parameter followed by non-optional parameter +function fn4a(x?: number, y: string); +function fn4a() { } + +function fn4b(n: string, x?: number, y: string); +function fn4b() { } + +//Function overload signature with rest param followed by non-optional parameter +function fn5(x: string, ...y: any[], z: string); +function fn5() { } + + +//// [functionOverloadErrorsSyntax.js] +function fn4a() { +} +function fn4b() { +} +function fn5() { +} diff --git a/tests/baselines/reference/functionTypesLackingReturnTypes.js b/tests/baselines/reference/functionTypesLackingReturnTypes.js new file mode 100644 index 00000000000..10b447a838f --- /dev/null +++ b/tests/baselines/reference/functionTypesLackingReturnTypes.js @@ -0,0 +1,25 @@ +//// [functionTypesLackingReturnTypes.ts] + +// Error (no '=>') +function f(x: ()) { +} + +// Error (no '=>') +var g: (param); + +// Okay +var h: { () } + +// Okay +var i: { new () } + +//// [functionTypesLackingReturnTypes.js] +// Error (no '=>') +function f(x) { +} +// Error (no '=>') +var g; +// Okay +var h; +// Okay +var i; diff --git a/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js new file mode 100644 index 00000000000..ae8e7d9c918 --- /dev/null +++ b/tests/baselines/reference/functionsMissingReturnStatementsAndExpressions.js @@ -0,0 +1,237 @@ +//// [functionsMissingReturnStatementsAndExpressions.ts] + +function f1(): string { + // errors because there are no return statements +} + +function f2(): string { + // Permissible; returns undefined. + return; +} + +function f3(): string { + return "Okay, because this is a return expression."; +} + +function f4(): void { + // Fine since we are typed void. +} + +function f5(): void { + // Fine since we are typed void. + return; +} + +function f6(): void { + // Fine since we are typed void and return undefined + return undefined; +} + +function f7(): void { + // Fine since we are typed void and return null + return null; +} + +function f8(): void { + // Fine since are typed any. + return; +} + +function f9(): void { + // Fine since we are typed any and return undefined + return undefined; +} + +function f10(): void { + // Fine since we are typed any and return null + return null; +} + +function f11(): string { + // Fine since we consist of a single throw statement. + throw undefined; +} + +function f12(): void { + // Fine since we consist of a single throw statement. + throw undefined; +} + +function f13(): any { + // Fine since we consist of a single throw statement. + throw undefined; +} + +function f14(): number { + // Not fine, since we can *only* consist of a single throw statement + // if no return statements are present but we are annotated. + throw undefined; + throw null; +} + +function f15(): number { + // Fine, since we have a return statement somewhere. + throw undefined; + throw null; + return; +} + + +function f16() { + // Okay; not type annotated. +} + +function f17() { + // Okay; not type annotated. + return; +} + +function f18() { + return "Okay, not type annotated."; +} + + +class C { + public get m1() { + // Errors; get accessors must return a value. + } + + public get m2() { + // Permissible; returns undefined. + return; + } + + public get m3() { + return "Okay, because this is a return expression."; + } + + public get m4() { + // Fine since this consists of a single throw statement. + throw null; + } + + public get m5() { + // Not fine, since we can *only* consist of a single throw statement + // if no return statements are present but we are a get accessor. + throw null; + throw undefined. + } +} + +//// [functionsMissingReturnStatementsAndExpressions.js] +function f1() { + // errors because there are no return statements +} +function f2() { + // Permissible; returns undefined. + return; +} +function f3() { + return "Okay, because this is a return expression."; +} +function f4() { + // Fine since we are typed void. +} +function f5() { + // Fine since we are typed void. + return; +} +function f6() { + // Fine since we are typed void and return undefined + return undefined; +} +function f7() { + // Fine since we are typed void and return null + return null; +} +function f8() { + // Fine since are typed any. + return; +} +function f9() { + // Fine since we are typed any and return undefined + return undefined; +} +function f10() { + // Fine since we are typed any and return null + return null; +} +function f11() { + // Fine since we consist of a single throw statement. + throw undefined; +} +function f12() { + // Fine since we consist of a single throw statement. + throw undefined; +} +function f13() { + // Fine since we consist of a single throw statement. + throw undefined; +} +function f14() { + // Not fine, since we can *only* consist of a single throw statement + // if no return statements are present but we are annotated. + throw undefined; + throw null; +} +function f15() { + // Fine, since we have a return statement somewhere. + throw undefined; + throw null; + return; +} +function f16() { + // Okay; not type annotated. +} +function f17() { + // Okay; not type annotated. + return; +} +function f18() { + return "Okay, not type annotated."; +} +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "m1", { + get: function () { + // Errors; get accessors must return a value. + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "m2", { + get: function () { + // Permissible; returns undefined. + return; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "m3", { + get: function () { + return "Okay, because this is a return expression."; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "m4", { + get: function () { + // Fine since this consists of a single throw statement. + throw null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "m5", { + get: function () { + // Not fine, since we can *only* consist of a single throw statement + // if no return statements are present but we are a get accessor. + throw null; + throw undefined.; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/functionsWithModifiersInBlocks1.js b/tests/baselines/reference/functionsWithModifiersInBlocks1.js new file mode 100644 index 00000000000..1d381bccfe1 --- /dev/null +++ b/tests/baselines/reference/functionsWithModifiersInBlocks1.js @@ -0,0 +1,13 @@ +//// [functionsWithModifiersInBlocks1.ts] +{ + declare function f() { } + export function f() { } + declare export function f() { } +} + +//// [functionsWithModifiersInBlocks1.js] +{ + function f() { + } + exports.f = f; +} diff --git a/tests/baselines/reference/genericArrayExtenstions.js b/tests/baselines/reference/genericArrayExtenstions.js new file mode 100644 index 00000000000..774e512d48f --- /dev/null +++ b/tests/baselines/reference/genericArrayExtenstions.js @@ -0,0 +1,8 @@ +//// [genericArrayExtenstions.ts] +export declare class ObservableArray implements Array { // MS.Entertainment.ObservableArray +concat(...items: U[]): T[]; +concat(...items: T[]): T[]; +} + + +//// [genericArrayExtenstions.js] diff --git a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt index 8900e975030..428ebecf5b0 100644 --- a/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt +++ b/tests/baselines/reference/genericCallToOverloadedMethodWithOverloadedArguments.errors.txt @@ -1,7 +1,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(24,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(53,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(69,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(85,38): error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. + Type 'Promise' is not assignable to type 'Promise'. + Type 'number' is not assignable to type 'boolean'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ==== @@ -31,6 +39,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl var newPromise = numPromise.then(testFunction); ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. } ////////////////////////////////////// @@ -62,6 +72,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl var newPromise = numPromise.then(testFunction); ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. } ////////////////////////////////////// @@ -80,6 +92,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl var newPromise = numPromise.then(testFunction); ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. } ////////////////////////////////////// @@ -98,5 +112,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverl var newPromise = numPromise.then(testFunction); ~~~~~~~~~~~~ !!! error TS2345: Argument of type '{ (n: number): Promise; (s: string): Promise; (b: boolean): Promise; }' is not assignable to parameter of type '(x: number) => Promise'. +!!! error TS2345: Type 'Promise' is not assignable to type 'Promise'. +!!! error TS2345: Type 'number' is not assignable to type 'boolean'. } \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt index 604896319ca..d8228dd2243 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference2.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(3,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts(11,26): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. + Property 'toDateString' is missing in type 'Number'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstraintsTypeArgumentInference2.ts (2 errors) ==== @@ -18,4 +19,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon var r4 = foo(1); // error ~ !!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Date'. +!!! error TS2345: Property 'toDateString' is missing in type 'Number'. var r5 = foo(new Date()); // no error \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt index 48e615bdb3e..a014ef85b6c 100644 --- a/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt +++ b/tests/baselines/reference/genericCallWithConstructorTypedArguments5.errors.txt @@ -1,5 +1,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(11,14): error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'. + Types of property 'cb' are incompatible. + Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: any) => string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts(13,14): error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. + Types of property 'cb' are incompatible. + Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithConstructorTypedArguments5.ts (2 errors) ==== @@ -16,10 +20,14 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithCon var r2 = foo(arg2); // error ~~~~ !!! error TS2345: Argument of type '{ cb: new (x: T, y: T) => string; }' is not assignable to parameter of type '{ cb: new (t: any) => string; }'. +!!! error TS2345: Types of property 'cb' are incompatible. +!!! error TS2345: Type 'new (x: T, y: T) => string' is not assignable to type 'new (t: any) => string'. var arg3: { cb: new (x: string, y: number) => string }; var r3 = foo(arg3); // error ~~~~ !!! error TS2345: Argument of type '{ cb: new (x: string, y: number) => string; }' is not assignable to parameter of type '{ cb: new (t: string) => string; }'. +!!! error TS2345: Types of property 'cb' are incompatible. +!!! error TS2345: Type 'new (x: string, y: number) => string' is not assignable to type 'new (t: string) => string'. function foo2(arg: { cb: new(t: T, t2: T) => U }) { return new arg.cb(null, null); diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt index 2d5ad21959e..33c01aa544a 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. + Property 'y' is missing in type '{ x: number; z?: number; }'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts(19,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. + Property 'z' is missing in type '{ x: number; y?: number; }'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments.ts (2 errors) ==== @@ -26,10 +28,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen ~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. +!!! error TS2453: Property 'y' is missing in type '{ x: number; z?: number; }'. var r5 = foo((x: typeof b) => b, (x: typeof a) => a); // typeof b => typeof b ~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. +!!! error TS2453: Property 'z' is missing in type '{ x: number; y?: number; }'. function other(x: T) { var r6 = foo((a: T) => a, (b: T) => b); // T => T diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt index a8ee6ac6ca9..5b5d4ad66f0 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments2.errors.txt @@ -3,10 +3,15 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(15,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(16,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(25,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. + Types of parameters 'a' and 'x' are incompatible. + Type 'T' is not assignable to type 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(37,36): error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'. + Type 'F' is not assignable to type 'E'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(50,21): error TS2345: Argument of type 'Date' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(51,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(60,23): error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. + Types of parameters 'a' and 'x' are incompatible. + Type 'T' is not assignable to type 'Date'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,51): error TS2304: Cannot find name 'U'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments2.ts(67,57): error TS2304: Cannot find name 'U'. @@ -46,6 +51,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r7 = foo2((a: T) => a, (b: T) => b); // error ~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. +!!! error TS2345: Types of parameters 'a' and 'x' are incompatible. +!!! error TS2345: Type 'T' is not assignable to type 'Date'. var r7b = foo2((a) => a, (b) => b); // valid, T is inferred to be Date } @@ -60,6 +67,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r7 = foo3(E.A, (x) => E.A, (x) => F.A); // error ~~~~~~~~~~ !!! error TS2345: Argument of type '(x: E) => F' is not assignable to parameter of type '(x: E) => E'. +!!! error TS2345: Type 'F' is not assignable to type 'E'. } module TU { @@ -89,6 +97,8 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen var r7 = foo2((a: T) => a, (b: T) => b); ~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: T) => T' is not assignable to parameter of type '(x: Date) => Date'. +!!! error TS2345: Types of parameters 'a' and 'x' are incompatible. +!!! error TS2345: Type 'T' is not assignable to type 'Date'. var r7b = foo2((a) => a, (b) => b); } diff --git a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt index 574cc5ca50d..87ae6b63855 100644 --- a/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt +++ b/tests/baselines/reference/genericCallWithGenericSignatureArguments3.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(32,11): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'. + Type 'boolean' is not assignable to type 'string'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGenericSignatureArguments3.ts(33,11): error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '(n: Object) => number' is not a valid type argument because it is not a supertype of candidate 'number'. @@ -40,6 +41,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithGen ~~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '(y: string) => string' is not a valid type argument because it is not a supertype of candidate '(a: string) => boolean'. +!!! error TS2453: Type 'boolean' is not assignable to type 'string'. var r12 = foo2(x, (a1: (y: string) => boolean) => (n: Object) => 1, (a2: (z: string) => boolean) => 2); // error ~~~~ !!! error TS2453: The type argument for type parameter 'U' cannot be inferred from the usage. Consider specifying the type arguments explicitly. diff --git a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt index 2efcd043d78..3b896d9a7d8 100644 --- a/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt +++ b/tests/baselines/reference/genericCallWithNonSymmetricSubtypes.errors.txt @@ -1,7 +1,9 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(12,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. + Property 'y' is missing in type '{ x: number; z?: number; }'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts(13,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. + Property 'z' is missing in type '{ x: number; y?: number; }'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNonSymmetricSubtypes.ts (2 errors) ==== @@ -20,10 +22,12 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithNon ~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; y?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; z?: number; }'. +!!! error TS2453: Property 'y' is missing in type '{ x: number; z?: number; }'. var r2 = foo(b, a); // { x: number; z?: number; }; ~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate '{ x: number; z?: number; }' is not a valid type argument because it is not a supertype of candidate '{ x: number; y?: number; }'. +!!! error TS2453: Property 'z' is missing in type '{ x: number; y?: number; }'. var x: { x: number; }; var y: { x?: number; }; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt index 97b09a7d43f..ecd76d4ea1b 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts(20,9): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'. + Types have separate declarations of a private property 'x'. ==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgs.ts (1 errors) ==== @@ -26,4 +27,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj ~~~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate 'C' is not a valid type argument because it is not a supertype of candidate 'D'. +!!! error TS2453: Types have separate declarations of a private property 'x'. var r2 = foo(c1, c1); // ok \ No newline at end of file diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt index 02b38ddeb74..54455782cc2 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.errors.txt @@ -1,5 +1,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(18,10): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'. + Property 'y' is missing in type 'Derived2'. tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObjectTypeArgsAndConstraints3.ts(20,29): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. @@ -25,6 +26,7 @@ tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithObj ~ !!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. !!! error TS2453: Type argument candidate 'Derived' is not a valid type argument because it is not a supertype of candidate 'Derived2'. +!!! error TS2453: Property 'y' is missing in type 'Derived2'. function f2(a: U) { ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/genericCallWithoutArgs.js b/tests/baselines/reference/genericCallWithoutArgs.js new file mode 100644 index 00000000000..abf947a7d3b --- /dev/null +++ b/tests/baselines/reference/genericCallWithoutArgs.js @@ -0,0 +1,10 @@ +//// [genericCallWithoutArgs.ts] +function f(x: X, y: Y) { +} + +f. + +//// [genericCallWithoutArgs.js] +function f(x, y) { +} +f(); diff --git a/tests/baselines/reference/genericCallsWithoutParens.js b/tests/baselines/reference/genericCallsWithoutParens.js new file mode 100644 index 00000000000..e51ed55224c --- /dev/null +++ b/tests/baselines/reference/genericCallsWithoutParens.js @@ -0,0 +1,21 @@ +//// [genericCallsWithoutParens.ts] +function f() { } +var r = f; // parse error + +class C { + foo: T; +} +var c = new C; // parse error + + + +//// [genericCallsWithoutParens.js] +function f() { +} +var r = f(); // parse error +var C = (function () { + function C() { + } + return C; +})(); +var c = new C(); // parse error diff --git a/tests/baselines/reference/genericChainedCalls.js b/tests/baselines/reference/genericChainedCalls.js index 618d34cbc5a..71d83a906bf 100644 --- a/tests/baselines/reference/genericChainedCalls.js +++ b/tests/baselines/reference/genericChainedCalls.js @@ -15,7 +15,8 @@ var s3 = s2.func(num => num.toString()) //// [genericChainedCalls.js] -var r1 = v1.func(function (num) { return num.toString(); }).func(function (str) { return str.length; }).func(function (num) { return num.toString(); }); +var r1 = v1.func(function (num) { return num.toString(); }).func(function (str) { return str.length; }) // error, number doesn't have a length +.func(function (num) { return num.toString(); }); var s1 = v1.func(function (num) { return num.toString(); }); var s2 = s1.func(function (str) { return str.length; }); // should also error var s3 = s2.func(function (num) { return num.toString(); }); diff --git a/tests/baselines/reference/genericCombinators2.errors.txt b/tests/baselines/reference/genericCombinators2.errors.txt index c09ef79b29b..5be717109c8 100644 --- a/tests/baselines/reference/genericCombinators2.errors.txt +++ b/tests/baselines/reference/genericCombinators2.errors.txt @@ -1,5 +1,7 @@ tests/cases/compiler/genericCombinators2.ts(15,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. + Type 'string' is not assignable to type 'Date'. tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. + Type 'string' is not assignable to type 'Date'. ==== tests/cases/compiler/genericCombinators2.ts (2 errors) ==== @@ -20,6 +22,8 @@ tests/cases/compiler/genericCombinators2.ts(16,43): error TS2345: Argument of ty var r5a = _.map(c2, (x, y) => { return x.toFixed() }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. +!!! error TS2345: Type 'string' is not assignable to type 'Date'. var r5b = _.map(c2, rf1); ~~~ -!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. \ No newline at end of file +!!! error TS2345: Argument of type '(x: number, y: string) => string' is not assignable to parameter of type '(x: number, y: string) => Date'. +!!! error TS2345: Type 'string' is not assignable to type 'Date'. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstraint2.errors.txt b/tests/baselines/reference/genericConstraint2.errors.txt index 3ab29b585d8..c1be6fc2325 100644 --- a/tests/baselines/reference/genericConstraint2.errors.txt +++ b/tests/baselines/reference/genericConstraint2.errors.txt @@ -2,6 +2,7 @@ tests/cases/compiler/genericConstraint2.ts(5,18): error TS2313: Constraint of a tests/cases/compiler/genericConstraint2.ts(11,7): error TS2420: Class 'ComparableString' incorrectly implements interface 'Comparable'. Property 'comparer' is missing in type 'ComparableString'. tests/cases/compiler/genericConstraint2.ts(21,17): error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable'. + Property 'comparer' is missing in type 'ComparableString'. ==== tests/cases/compiler/genericConstraint2.ts (3 errors) ==== @@ -32,4 +33,5 @@ tests/cases/compiler/genericConstraint2.ts(21,17): error TS2344: Type 'Comparabl var b = new ComparableString("b"); var c = compare(a, b); ~~~~~~~~~~~~~~~~ -!!! error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable'. \ No newline at end of file +!!! error TS2344: Type 'ComparableString' does not satisfy the constraint 'Comparable'. +!!! error TS2344: Property 'comparer' is missing in type 'ComparableString'. \ No newline at end of file diff --git a/tests/baselines/reference/genericConstructExpressionWithoutArgs.js b/tests/baselines/reference/genericConstructExpressionWithoutArgs.js new file mode 100644 index 00000000000..c3066de2721 --- /dev/null +++ b/tests/baselines/reference/genericConstructExpressionWithoutArgs.js @@ -0,0 +1,26 @@ +//// [genericConstructExpressionWithoutArgs.ts] +class B { } +var b = new B; // no error + +class C { + x: T; +} + +var c = new C // C +var c2 = new C // error, type params are actually part of the arg list so you need both + + +//// [genericConstructExpressionWithoutArgs.js] +var B = (function () { + function B() { + } + return B; +})(); +var b = new B; // no error +var C = (function () { + function C() { + } + return C; +})(); +var c = new C; // C +var c2 = new C(); // error, type params are actually part of the arg list so you need both diff --git a/tests/baselines/reference/genericGetter.js b/tests/baselines/reference/genericGetter.js new file mode 100644 index 00000000000..59425d8c13b --- /dev/null +++ b/tests/baselines/reference/genericGetter.js @@ -0,0 +1,26 @@ +//// [genericGetter.ts] +class C { + data: T; + get x(): T { + return this.data; + } +} + +var c = new C(); +var r: string = c.x; + +//// [genericGetter.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return this.data; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var c = new C(); +var r = c.x; diff --git a/tests/baselines/reference/genericGetter2.js b/tests/baselines/reference/genericGetter2.js new file mode 100644 index 00000000000..9d39ce02d5f --- /dev/null +++ b/tests/baselines/reference/genericGetter2.js @@ -0,0 +1,28 @@ +//// [genericGetter2.ts] +class A { } + +class C { + data: A; + get x(): A { + return this.data; + } +} + +//// [genericGetter2.js] +var A = (function () { + function A() { + } + return A; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return this.data; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/genericGetter3.js b/tests/baselines/reference/genericGetter3.js new file mode 100644 index 00000000000..1cb01c6f112 --- /dev/null +++ b/tests/baselines/reference/genericGetter3.js @@ -0,0 +1,33 @@ +//// [genericGetter3.ts] +class A { } + +class C { + data: A; + get x(): A { + return this.data; + } +} + +var c = new C(); +var r: string = c.x; + +//// [genericGetter3.js] +var A = (function () { + function A() { + } + return A; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return this.data; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var c = new C(); +var r = c.x; diff --git a/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.js b/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.js new file mode 100644 index 00000000000..75e85283aa9 --- /dev/null +++ b/tests/baselines/reference/genericObjectCreationWithoutTypeArgs.js @@ -0,0 +1,21 @@ +//// [genericObjectCreationWithoutTypeArgs.ts] +class SS{ + +} + +var x1 = new SS(); // OK +var x2 = new SS < number>; // Correctly give error +var x3 = new SS(); // OK +var x4 = new SS; // Should be allowed, but currently give error ('supplied parameters do not match any signature of the call target') + + +//// [genericObjectCreationWithoutTypeArgs.js] +var SS = (function () { + function SS() { + } + return SS; +})(); +var x1 = new SS(); // OK +var x2 = new SS(); // Correctly give error +var x3 = new SS(); // OK +var x4 = new SS; // Should be allowed, but currently give error ('supplied parameters do not match any signature of the call target') diff --git a/tests/baselines/reference/genericRestArgs.errors.txt b/tests/baselines/reference/genericRestArgs.errors.txt index 8a977452958..99106ebd795 100644 --- a/tests/baselines/reference/genericRestArgs.errors.txt +++ b/tests/baselines/reference/genericRestArgs.errors.txt @@ -4,6 +4,7 @@ tests/cases/compiler/genericRestArgs.ts(5,34): error TS2345: Argument of type 's tests/cases/compiler/genericRestArgs.ts(10,12): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly. Type argument candidate 'number' is not a valid type argument because it is not a supertype of candidate 'string'. tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. + Property 'length' is missing in type 'Number'. ==== tests/cases/compiler/genericRestArgs.ts (4 errors) ==== @@ -28,4 +29,5 @@ tests/cases/compiler/genericRestArgs.ts(12,30): error TS2345: Argument of type ' var a2Gb = makeArrayG(1, ""); var a2Gc = makeArrayG(1, ""); // error ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'any[]'. +!!! error TS2345: Property 'length' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.js b/tests/baselines/reference/genericReturnTypeFromGetter1.js new file mode 100644 index 00000000000..208b12308e1 --- /dev/null +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.js @@ -0,0 +1,27 @@ +//// [genericReturnTypeFromGetter1.ts] +export interface A { + new (dbSet: DbSet): T; +} +export class DbSet { + _entityType: A; + get entityType() { return this._entityType; } // used to ICE without return type annotation +} + + +//// [genericReturnTypeFromGetter1.js] +define(["require", "exports"], function (require, exports) { + var DbSet = (function () { + function DbSet() { + } + Object.defineProperty(DbSet.prototype, "entityType", { + get: function () { + return this._entityType; + } // used to ICE without return type annotation + , + enumerable: true, + configurable: true + }); + return DbSet; + })(); + exports.DbSet = DbSet; +}); diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js new file mode 100644 index 00000000000..dbda6074830 --- /dev/null +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -0,0 +1,103 @@ +//// [genericTypeReferenceWithoutTypeArgument.ts] +// it is an error to use a generic type without type arguments +// all of these are errors + +class C { + foo: T; +} + +var c: C; + +var a: { x: C }; +var b: { (x: C): C }; +var d: { [x: C]: C }; + +var e = (x: C) => { var y: C; return y; } + +function f(x: C): C { var y: C; return y; } + +var g = function f(x: C): C { var y: C; return y; } + +class D extends C { +} + +interface I extends C {} + +module M { + export class E { foo: T } +} + +class D2 extends M.E { } +class D3 { } +interface I2 extends M.E { } + +function h(x: T) { } +function i(x: T) { } + +var j = null; +var k = null; + +//// [genericTypeReferenceWithoutTypeArgument.js] +// it is an error to use a generic type without type arguments +// all of these are errors +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + return C; +})(); +var c; +var a; +var b; +var d; +var e = function (x) { + var y; + return y; +}; +function f(x) { + var y; + return y; +} +var g = function f(x) { + var y; + return y; +}; +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +})(C); +var M; +(function (M) { + var E = (function () { + function E() { + } + return E; + })(); + M.E = E; +})(M || (M = {})); +var D2 = (function (_super) { + __extends(D2, _super); + function D2() { + _super.apply(this, arguments); + } + return D2; +})(M.E); +var D3 = (function () { + function D3() { + } + return D3; +})(); +function h(x) { +} +function i(x) { +} +var j = null; +var k = null; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js new file mode 100644 index 00000000000..f6a22073702 --- /dev/null +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -0,0 +1,84 @@ +//// [genericTypeReferenceWithoutTypeArgument2.ts] +// it is an error to use a generic type without type arguments +// all of these are errors + +interface I { + foo: T; +} + +var c: I; + +var a: { x: I }; +var b: { (x: I): I }; +var d: { [x: I]: I }; + +var e = (x: I) => { var y: I; return y; } + +function f(x: I): I { var y: I; return y; } + +var g = function f(x: I): I { var y: I; return y; } + +class D extends I { +} + +interface U extends I {} + +module M { + export interface E { foo: T } +} + +class D2 extends M.C { } +interface D3 { } +interface I2 extends M.C { } + +function h(x: T) { } +function i(x: T) { } + +var j = null; +var k = null; + +//// [genericTypeReferenceWithoutTypeArgument2.js] +// it is an error to use a generic type without type arguments +// all of these are errors +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var c; +var a; +var b; +var d; +var e = function (x) { + var y; + return y; +}; +function f(x) { + var y; + return y; +} +var g = function f(x) { + var y; + return y; +}; +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +})(I); +var D2 = (function (_super) { + __extends(D2, _super); + function D2() { + _super.apply(this, arguments); + } + return D2; +})(M.C); +function h(x) { +} +function i(x) { +} +var j = null; +var k = null; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.js new file mode 100644 index 00000000000..a56ec43d7c3 --- /dev/null +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.js @@ -0,0 +1,31 @@ +//// [genericTypeReferenceWithoutTypeArgument3.ts] +// it is an error to use a generic type without type arguments +// all of these are errors + +declare class C { + foo: T; +} + +declare var c: C; + +declare var a: { x: C }; +declare var b: { (x: C): C }; +declare var d: { [x: C]: C }; + +declare function f(x: C): C; + +declare class D extends C {} + +declare module M { + export class E { foo: T } +} + +declare class D2 extends M.C { } +declare class D3 { } + +declare function h(x: T); +declare function i(x: T); + +//// [genericTypeReferenceWithoutTypeArgument3.js] +// it is an error to use a generic type without type arguments +// all of these are errors diff --git a/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.js b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.js new file mode 100644 index 00000000000..0211ce55119 --- /dev/null +++ b/tests/baselines/reference/getAccessorWithImpliedReturnTypeAndFunctionClassMerge.js @@ -0,0 +1,47 @@ +//// [getAccessorWithImpliedReturnTypeAndFunctionClassMerge.ts] +declare function _(value: Array): _; +declare function _(value: T): _; + +declare module _ { + export function each( + //list: List, + //iterator: ListIterator, + context?: any): void; + + interface ListIterator { + (value: T, index: number, list: T[]): TResult; + } +} + +declare class _ { + each(iterator: _.ListIterator, context?: any): void; +} + +module MyModule { + export class MyClass { + public get myGetter() { + var obj:any = {}; + + return obj; + } + } +} + +//// [getAccessorWithImpliedReturnTypeAndFunctionClassMerge.js] +var MyModule; +(function (MyModule) { + var MyClass = (function () { + function MyClass() { + } + Object.defineProperty(MyClass.prototype, "myGetter", { + get: function () { + var obj = {}; + return obj; + }, + enumerable: true, + configurable: true + }); + return MyClass; + })(); + MyModule.MyClass = MyClass; +})(MyModule || (MyModule = {})); diff --git a/tests/baselines/reference/getAndSetAsMemberNames.js b/tests/baselines/reference/getAndSetAsMemberNames.js new file mode 100644 index 00000000000..22f99920fb1 --- /dev/null +++ b/tests/baselines/reference/getAndSetAsMemberNames.js @@ -0,0 +1,66 @@ +//// [getAndSetAsMemberNames.ts] +class C1 { + set: boolean; + get = 1; +} +class C2 { + set; +} +class C3 { + set (x) { + return x + 1; + } +} +class C4 { + get: boolean = true; +} +class C5 { + public set: () => boolean = function () { return true; }; + get (): boolean { return true; } + set t(x) { } +} + + +//// [getAndSetAsMemberNames.js] +var C1 = (function () { + function C1() { + this.get = 1; + } + return C1; +})(); +var C2 = (function () { + function C2() { + } + return C2; +})(); +var C3 = (function () { + function C3() { + } + C3.prototype.set = function (x) { + return x + 1; + }; + return C3; +})(); +var C4 = (function () { + function C4() { + this.get = true; + } + return C4; +})(); +var C5 = (function () { + function C5() { + this.set = function () { + return true; + }; + } + C5.prototype.get = function () { + return true; + }; + Object.defineProperty(C5.prototype, "t", { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C5; +})(); diff --git a/tests/baselines/reference/getAndSetNotIdenticalType.js b/tests/baselines/reference/getAndSetNotIdenticalType.js new file mode 100644 index 00000000000..7e77fc25d0b --- /dev/null +++ b/tests/baselines/reference/getAndSetNotIdenticalType.js @@ -0,0 +1,23 @@ +//// [getAndSetNotIdenticalType.ts] +class C { + get x(): number { + return 1; + } + set x(v: string) { } +} + +//// [getAndSetNotIdenticalType.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/getAndSetNotIdenticalType2.js b/tests/baselines/reference/getAndSetNotIdenticalType2.js new file mode 100644 index 00000000000..d73f07ec388 --- /dev/null +++ b/tests/baselines/reference/getAndSetNotIdenticalType2.js @@ -0,0 +1,41 @@ +//// [getAndSetNotIdenticalType2.ts] +class A { foo: T; } + +class C { + data: A; + get x(): A { + return this.data; + } + set x(v: A) { + this.data = v; + } +} + +var x = new C(); +var r = x.x; +x.x = r; + +//// [getAndSetNotIdenticalType2.js] +var A = (function () { + function A() { + } + return A; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return this.data; + }, + set: function (v) { + this.data = v; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var x = new C(); +var r = x.x; +x.x = r; diff --git a/tests/baselines/reference/getAndSetNotIdenticalType3.js b/tests/baselines/reference/getAndSetNotIdenticalType3.js new file mode 100644 index 00000000000..2f37a7cbfae --- /dev/null +++ b/tests/baselines/reference/getAndSetNotIdenticalType3.js @@ -0,0 +1,41 @@ +//// [getAndSetNotIdenticalType3.ts] +class A { foo: T; } + +class C { + data: A; + get x(): A { + return this.data; + } + set x(v: A) { + this.data = v; + } +} + +var x = new C(); +var r = x.x; +x.x = r; + +//// [getAndSetNotIdenticalType3.js] +var A = (function () { + function A() { + } + return A; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "x", { + get: function () { + return this.data; + }, + set: function (v) { + this.data = v; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var x = new C(); +var r = x.x; +x.x = r; diff --git a/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline b/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline index 4b89414059c..5552851dec4 100644 --- a/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline +++ b/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline @@ -1,30 +1,30 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile1.js var x = 5; var Bar = (function () { function Bar() { } return Bar; })(); -Filename : tests/cases/fourslash/inputFile1.d.ts +FileName : tests/cases/fourslash/inputFile1.d.ts declare var x: number; declare class Bar { x: string; y: number; } - -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js + +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile2.js var x1 = "hello world"; var Foo = (function () { function Foo() { } return Foo; })(); -Filename : tests/cases/fourslash/inputFile2.d.ts +FileName : tests/cases/fourslash/inputFile2.d.ts declare var x1: string; declare class Foo { x: string; y: number; } - + diff --git a/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline b/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline index 545c37a0728..4abc99b05c2 100644 --- a/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline +++ b/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline @@ -1,5 +1,5 @@ -EmitOutputStatus : Succeeded -Filename : declSingleFile.js +EmitSkipped: false +FileName : declSingleFile.js var x = 5; var Bar = (function () { function Bar() { @@ -12,7 +12,7 @@ var Foo = (function () { } return Foo; })(); -Filename : declSingleFile.d.ts +FileName : declSingleFile.d.ts declare var x: number; declare class Bar { x: string; @@ -23,4 +23,4 @@ declare class Foo { x: string; y: number; } - + diff --git a/tests/baselines/reference/getEmitOutputExternalModule.baseline b/tests/baselines/reference/getEmitOutputExternalModule.baseline index 33360cbed61..ac2f7cb3dac 100644 --- a/tests/baselines/reference/getEmitOutputExternalModule.baseline +++ b/tests/baselines/reference/getEmitOutputExternalModule.baseline @@ -1,9 +1,9 @@ -EmitOutputStatus : Succeeded -Filename : declSingleFile.js +EmitSkipped: false +FileName : declSingleFile.js var x = 5; var Bar = (function () { function Bar() { } return Bar; })(); - + diff --git a/tests/baselines/reference/getEmitOutputExternalModule2.baseline b/tests/baselines/reference/getEmitOutputExternalModule2.baseline index ede5474d8cc..c32472d318f 100644 --- a/tests/baselines/reference/getEmitOutputExternalModule2.baseline +++ b/tests/baselines/reference/getEmitOutputExternalModule2.baseline @@ -1,5 +1,5 @@ -EmitOutputStatus : JSGeneratedWithSemanticErrors -Filename : declSingleFile.js +EmitSkipped: false +FileName : declSingleFile.js var x = 5; var Bar = (function () { function Bar() { @@ -12,4 +12,4 @@ var Bar2 = (function () { } return Bar2; })(); - + diff --git a/tests/baselines/reference/getEmitOutputMapRoots.baseline b/tests/baselines/reference/getEmitOutputMapRoots.baseline index 93dab28e6fc..16f39169e23 100644 --- a/tests/baselines/reference/getEmitOutputMapRoots.baseline +++ b/tests/baselines/reference/getEmitOutputMapRoots.baseline @@ -1,6 +1,6 @@ -EmitOutputStatus : Succeeded -Filename : declSingleFile.js.map -{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : declSingleFile.js +EmitSkipped: false +FileName : declSingleFile.js.map +{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : declSingleFile.js var x = 109; var foo = "hello world"; var M = (function () { @@ -8,4 +8,4 @@ var M = (function () { } return M; })(); -//# sourceMappingURL=mapRootDir/declSingleFile.js.map +//# sourceMappingURL=mapRootDir/declSingleFile.js.map diff --git a/tests/baselines/reference/getEmitOutputNoErrors.baseline b/tests/baselines/reference/getEmitOutputNoErrors.baseline index 47ba1435319..a1efeecd321 100644 --- a/tests/baselines/reference/getEmitOutputNoErrors.baseline +++ b/tests/baselines/reference/getEmitOutputNoErrors.baseline @@ -1,9 +1,9 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js var x; var M = (function () { function M() { } return M; })(); - + diff --git a/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline b/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline index 1f61d57c81e..981b4710e41 100644 --- a/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline +++ b/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline @@ -1,9 +1,9 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile2.js var x; var Foo = (function () { function Foo() { } return Foo; })(); - + diff --git a/tests/baselines/reference/getEmitOutputSingleFile.baseline b/tests/baselines/reference/getEmitOutputSingleFile.baseline index dd8f2be8079..4a71299dcc0 100644 --- a/tests/baselines/reference/getEmitOutputSingleFile.baseline +++ b/tests/baselines/reference/getEmitOutputSingleFile.baseline @@ -1,5 +1,5 @@ -EmitOutputStatus : Succeeded -Filename : outputDir/singleFile.js +EmitSkipped: false +FileName : outputDir/singleFile.js var x; var Bar = (function () { function Bar() { @@ -12,4 +12,4 @@ var Foo = (function () { } return Foo; })(); - + diff --git a/tests/baselines/reference/getEmitOutputSingleFile2.baseline b/tests/baselines/reference/getEmitOutputSingleFile2.baseline index 2f5dbe3daf8..c9409c5ca8c 100644 --- a/tests/baselines/reference/getEmitOutputSingleFile2.baseline +++ b/tests/baselines/reference/getEmitOutputSingleFile2.baseline @@ -1,8 +1,8 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile3.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile3.js exports.foo = 10; exports.bar = "hello world"; -Filename : tests/cases/fourslash/inputFile3.d.ts +FileName : tests/cases/fourslash/inputFile3.d.ts export declare var foo: number; export declare var bar: string; - + diff --git a/tests/baselines/reference/getEmitOutputSourceMap.baseline b/tests/baselines/reference/getEmitOutputSourceMap.baseline index 75ee2a26617..39cff967d89 100644 --- a/tests/baselines/reference/getEmitOutputSourceMap.baseline +++ b/tests/baselines/reference/getEmitOutputSourceMap.baseline @@ -1,6 +1,6 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile.js.map -{"version":3,"file":"inputFile.js","sourceRoot":"","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js.map +{"version":3,"file":"inputFile.js","sourceRoot":"","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile.js var x = 109; var foo = "hello world"; var M = (function () { @@ -8,4 +8,4 @@ var M = (function () { } return M; })(); -//# sourceMappingURL=inputFile.js.map +//# sourceMappingURL=inputFile.js.map diff --git a/tests/baselines/reference/getEmitOutputSourceMap2.baseline b/tests/baselines/reference/getEmitOutputSourceMap2.baseline index 2c132d8cd66..713aa4f3c08 100644 --- a/tests/baselines/reference/getEmitOutputSourceMap2.baseline +++ b/tests/baselines/reference/getEmitOutputSourceMap2.baseline @@ -1,6 +1,6 @@ -EmitOutputStatus : Succeeded -Filename : sample/outDir/inputFile1.js.map -{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : sample/outDir/inputFile1.js +EmitSkipped: false +FileName : sample/outDir/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : sample/outDir/inputFile1.js var x = 109; var foo = "hello world"; var M = (function () { @@ -8,12 +8,12 @@ var M = (function () { } return M; })(); -//# sourceMappingURL=inputFile1.js.map -EmitOutputStatus : Succeeded -Filename : sample/outDir/inputFile2.js.map -{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}Filename : sample/outDir/inputFile2.js +//# sourceMappingURL=inputFile1.js.map +EmitSkipped: false +FileName : sample/outDir/inputFile2.js.map +{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}FileName : sample/outDir/inputFile2.js var intro = "hello world"; if (intro !== undefined) { var k = 10; } -//# sourceMappingURL=inputFile2.js.map +//# sourceMappingURL=inputFile2.js.map diff --git a/tests/baselines/reference/getEmitOutputSourceRoot.baseline b/tests/baselines/reference/getEmitOutputSourceRoot.baseline index 9252163165b..5424def98ee 100644 --- a/tests/baselines/reference/getEmitOutputSourceRoot.baseline +++ b/tests/baselines/reference/getEmitOutputSourceRoot.baseline @@ -1,6 +1,6 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile.js.map -{"version":3,"file":"inputFile.js","sourceRoot":"sourceRootDir/","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js.map +{"version":3,"file":"inputFile.js","sourceRoot":"sourceRootDir/","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile.js var x = 109; var foo = "hello world"; var M = (function () { @@ -8,4 +8,4 @@ var M = (function () { } return M; })(); -//# sourceMappingURL=inputFile.js.map +//# sourceMappingURL=inputFile.js.map diff --git a/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline b/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline index 5c26a1920f9..7948ad99673 100644 --- a/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline +++ b/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline @@ -1,6 +1,6 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js.map -{"version":3,"file":"inputFile1.js","sourceRoot":"sourceRootDir/","sources":["inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile1.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"sourceRootDir/","sources":["inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile1.js var x = 109; var foo = "hello world"; var M = (function () { @@ -8,14 +8,14 @@ var M = (function () { } return M; })(); -//# sourceMappingURL=inputFile1.js.map -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js.map -{"version":3,"file":"inputFile2.js","sourceRoot":"sourceRootDir/","sources":["inputFile2.ts"],"names":["C","C.constructor"],"mappings":"AAAA,IAAI,GAAG,GAAG,wBAAwB,CAAC;AACnC,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile2.js +//# sourceMappingURL=inputFile1.js.map +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile2.js.map +{"version":3,"file":"inputFile2.js","sourceRoot":"sourceRootDir/","sources":["inputFile2.ts"],"names":["C","C.constructor"],"mappings":"AAAA,IAAI,GAAG,GAAG,wBAAwB,CAAC;AACnC,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile2.js var bar = "hello world Typescript"; var C = (function () { function C() { } return C; })(); -//# sourceMappingURL=inputFile2.js.map +//# sourceMappingURL=inputFile2.js.map diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline index be0ac935601..4fda32ad7c4 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline @@ -1,11 +1,11 @@ -EmitOutputStatus : Succeeded - -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js +EmitSkipped: false + +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile2.js var x1 = "hello world"; var Foo = (function () { function Foo() { } return Foo; })(); - + diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline index 92a1ea1fe7a..4582af47f5a 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline @@ -1,15 +1,15 @@ -EmitOutputStatus : Succeeded - -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js +EmitSkipped: false + +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile2.js var Foo = (function () { function Foo() { } return Foo; })(); exports.Foo = Foo; - -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile3.js + +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile3.js var x = "hello"; - + diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline index f960a05f151..1ce3d9f33c3 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline @@ -1,5 +1,5 @@ -EmitOutputStatus : Succeeded -Filename : declSingle.js +EmitSkipped: false +FileName : declSingle.js var x = "hello"; var x1 = 1000; - + diff --git a/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline b/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline index a5d5d2eb9d7..8dc9355bca2 100644 --- a/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline @@ -1,2 +1,5 @@ -EmitOutputStatus : AllOutputGenerationSkipped - +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile1.js +// File contains early errors. All outputs should be skipped. +const uninitialized_const_error; + diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline index f16e3810592..f854a619a47 100644 --- a/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline @@ -1,5 +1,5 @@ -EmitOutputStatus : EmitErrorsEncountered -Filename : tests/cases/fourslash/inputFile.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js var M; (function (M) { var C = (function () { @@ -9,4 +9,4 @@ var M; })(); M.foo = new C(); })(M || (M = {})); - + diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline index 4befff0466c..463dfe6899a 100644 --- a/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline @@ -1,5 +1,5 @@ -EmitOutputStatus : EmitErrorsEncountered -Filename : tests/cases/fourslash/inputFile.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js define(["require", "exports"], function (require, exports) { var C = (function () { function C() { @@ -11,4 +11,4 @@ define(["require", "exports"], function (require, exports) { M.foo = new C(); })(M = exports.M || (exports.M = {})); }); - + diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline index fed9a4d2089..b6249822131 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline @@ -1,4 +1,4 @@ -EmitOutputStatus : JSGeneratedWithSemanticErrors -Filename : tests/cases/fourslash/inputFile.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js var x = "hello world"; - + diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline index a2e296b85e2..396e220bdb6 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline @@ -1,4 +1,6 @@ -EmitOutputStatus : DeclarationGenerationSkipped -Filename : tests/cases/fourslash/inputFile.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js var x = "hello world"; - +FileName : tests/cases/fourslash/inputFile.d.ts +declare var x: number; + diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline index c6396314824..7f012b6a546 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline @@ -1,8 +1,8 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile1.js // File to emit, does not contain semantic errors // expected to be emitted correctelly regardless of the semantic errors in the other file var noErrors = true; -Filename : tests/cases/fourslash/inputFile1.d.ts +FileName : tests/cases/fourslash/inputFile1.d.ts declare var noErrors: boolean; - + diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline index 41b16b40e65..6a58015c1b3 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline @@ -1,8 +1,11 @@ -EmitOutputStatus : DeclarationGenerationSkipped -Filename : out.js +EmitSkipped: false +FileName : out.js // File to emit, does not contain semantic errors, but --out is passed // expected to not generate declarations because of the semantic errors in the other file var noErrors = true; // File not emitted, and contains semantic errors var semanticError = "string"; - +FileName : out.d.ts +declare var noErrors: boolean; +declare var semanticError: boolean; + diff --git a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline index bf27703890b..701b275eb31 100644 --- a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline +++ b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline @@ -1,6 +1,6 @@ -EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile1.js // File to emit, does not contain syntactic errors // expected to be emitted correctelly regardless of the syntactic errors in the other file var noErrors = true; - + diff --git a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline index a5d5d2eb9d7..b66f83dc6b6 100644 --- a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline +++ b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline @@ -1,2 +1,8 @@ -EmitOutputStatus : AllOutputGenerationSkipped - +EmitSkipped: false +FileName : out.js +// File to emit, does not contain syntactic errors, but --out is passed +// expected to not generate outputs because of the syntactic errors in the other file. +var noErrors = true; +// File not emitted, and contains syntactic errors +var syntactic = Error; + diff --git a/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline b/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline index a5d5d2eb9d7..2c341821fb0 100644 --- a/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline @@ -1,2 +1,4 @@ -EmitOutputStatus : AllOutputGenerationSkipped - +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile.js +var x; + diff --git a/tests/baselines/reference/getsetReturnTypes.js b/tests/baselines/reference/getsetReturnTypes.js new file mode 100644 index 00000000000..55d7e9285b0 --- /dev/null +++ b/tests/baselines/reference/getsetReturnTypes.js @@ -0,0 +1,20 @@ +//// [getsetReturnTypes.ts] +function makePoint(x: number) { + return { + get x() { return x; } + } +}; +var x = makePoint(2).x; +var y: number = makePoint(2).x; + +//// [getsetReturnTypes.js] +function makePoint(x) { + return { + get x() { + return x; + } + }; +} +; +var x = makePoint(2).x; +var y = makePoint(2).x; diff --git a/tests/baselines/reference/getterMissingReturnError.js b/tests/baselines/reference/getterMissingReturnError.js new file mode 100644 index 00000000000..76566d9346e --- /dev/null +++ b/tests/baselines/reference/getterMissingReturnError.js @@ -0,0 +1,20 @@ +//// [getterMissingReturnError.ts] +class test { + public get p2(){ + + } +} + + +//// [getterMissingReturnError.js] +var test = (function () { + function test() { + } + Object.defineProperty(test.prototype, "p2", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return test; +})(); diff --git a/tests/baselines/reference/getterSetterNonAccessor.types b/tests/baselines/reference/getterSetterNonAccessor.types index 0c1be481b3a..f3e5d549cff 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.types +++ b/tests/baselines/reference/getterSetterNonAccessor.types @@ -14,8 +14,8 @@ Object.defineProperty({}, "0", ({ >{} : {} >({ get: getFunc, set: setFunc, configurable: true }) : PropertyDescriptor >PropertyDescriptor : PropertyDescriptor ->({ get: getFunc, set: setFunc, configurable: true }) : { get: () => any; set: (v: any) => void; configurable: boolean; enumerable?: boolean; value?: any; writable?: boolean; } ->{ get: getFunc, set: setFunc, configurable: true } : { get: () => any; set: (v: any) => void; configurable: boolean; enumerable?: boolean; value?: any; writable?: boolean; } +>({ get: getFunc, set: setFunc, configurable: true }) : { get: () => any; set: (v: any) => void; configurable: boolean; } +>{ get: getFunc, set: setFunc, configurable: true } : { get: () => any; set: (v: any) => void; configurable: boolean; } get: getFunc, >get : () => any diff --git a/tests/baselines/reference/getterThatThrowsShouldNotNeedReturn.js b/tests/baselines/reference/getterThatThrowsShouldNotNeedReturn.js new file mode 100644 index 00000000000..c48e5c9c6bc --- /dev/null +++ b/tests/baselines/reference/getterThatThrowsShouldNotNeedReturn.js @@ -0,0 +1,27 @@ +//// [getterThatThrowsShouldNotNeedReturn.ts] +class Greeter { + public get greet(): string { + throw ''; // should not raise an error + } + public greeting(): string { + throw ''; // should not raise an error + } +} + + +//// [getterThatThrowsShouldNotNeedReturn.js] +var Greeter = (function () { + function Greeter() { + } + Object.defineProperty(Greeter.prototype, "greet", { + get: function () { + throw ''; // should not raise an error + }, + enumerable: true, + configurable: true + }); + Greeter.prototype.greeting = function () { + throw ''; // should not raise an error + }; + return Greeter; +})(); diff --git a/tests/baselines/reference/gettersAndSetters.js b/tests/baselines/reference/gettersAndSetters.js new file mode 100644 index 00000000000..4c94cbc43db --- /dev/null +++ b/tests/baselines/reference/gettersAndSetters.js @@ -0,0 +1,98 @@ +//// [gettersAndSetters.ts] +// classes +class C { + public fooBack = ""; + static barBack:string = ""; + public bazBack = ""; + + public get Foo() { return this.fooBack;} // ok + public set Foo(foo:string) {this.fooBack = foo;} // ok + + static get Bar() {return C.barBack;} // ok + static set Bar(bar:string) {C.barBack = bar;} // ok + + public get = function() {} // ok + public set = function() {} // ok +} + +var c = new C(); + +var foo = c.Foo; +c.Foo = "foov"; + +var bar = C.Bar; +C.Bar = "barv"; + +var baz = c.Baz; +c.Baz = "bazv"; + +// The Foo accessors' return and param types should be contextually typed to the Foo field +var o : {Foo:number;} = {get Foo() {return 0;}, set Foo(val:number){val}}; // o + +var ofg = o.Foo; +o.Foo = 0; + + +interface I1 { + (n:number):number; +} + +var i:I1 = function (n) {return n;} + + +//// [gettersAndSetters.js] +// classes +var C = (function () { + function C() { + this.fooBack = ""; + this.bazBack = ""; + this.get = function () { + }; // ok + this.set = function () { + }; // ok + } + Object.defineProperty(C.prototype, "Foo", { + get: function () { + return this.fooBack; + } // ok + , + set: function (foo) { + this.fooBack = foo; + } // ok + , + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "Bar", { + get: function () { + return C.barBack; + } // ok + , + set: function (bar) { + C.barBack = bar; + } // ok + , + enumerable: true, + configurable: true + }); + C.barBack = ""; + return C; +})(); +var c = new C(); +var foo = c.Foo; +c.Foo = "foov"; +var bar = C.Bar; +C.Bar = "barv"; +var baz = c.Baz; +c.Baz = "bazv"; +// The Foo accessors' return and param types should be contextually typed to the Foo field +var o = { get Foo() { + return 0; +}, set Foo(val) { + val; +} }; // o +var ofg = o.Foo; +o.Foo = 0; +var i = function (n) { + return n; +}; diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.js b/tests/baselines/reference/gettersAndSettersAccessibility.js new file mode 100644 index 00000000000..9a7564ec96d --- /dev/null +++ b/tests/baselines/reference/gettersAndSettersAccessibility.js @@ -0,0 +1,23 @@ +//// [gettersAndSettersAccessibility.ts] +class C99 { + private get Baz():number { return 0; } + public set Baz(n:number) {} // error - accessors do not agree in visibility +} + + +//// [gettersAndSettersAccessibility.js] +var C99 = (function () { + function C99() { + } + Object.defineProperty(C99.prototype, "Baz", { + get: function () { + return 0; + }, + set: function (n) { + } // error - accessors do not agree in visibility + , + enumerable: true, + configurable: true + }); + return C99; +})(); diff --git a/tests/baselines/reference/gettersAndSettersErrors.js b/tests/baselines/reference/gettersAndSettersErrors.js new file mode 100644 index 00000000000..514a69b2513 --- /dev/null +++ b/tests/baselines/reference/gettersAndSettersErrors.js @@ -0,0 +1,62 @@ +//// [gettersAndSettersErrors.ts] +class C { + public get Foo() { return "foo";} // ok + public set Foo(foo:string) {} // ok + + public Foo = 0; // error - duplicate identifier Foo - confirmed + public get Goo(v:string):string {return null;} // error - getters must not have a parameter + public set Goo(v:string):string {} // error - setters must not specify a return type +} + +class E { + private get Baz():number { return 0; } + public set Baz(n:number) {} // error - accessors do not agree in visibility +} + + + + +//// [gettersAndSettersErrors.js] +var C = (function () { + function C() { + this.Foo = 0; // error - duplicate identifier Foo - confirmed + } + Object.defineProperty(C.prototype, "Foo", { + get: function () { + return "foo"; + } // ok + , + set: function (foo) { + } // ok + , + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "Goo", { + get: function (v) { + return null; + } // error - getters must not have a parameter + , + set: function (v) { + } // error - setters must not specify a return type + , + enumerable: true, + configurable: true + }); + return C; +})(); +var E = (function () { + function E() { + } + Object.defineProperty(E.prototype, "Baz", { + get: function () { + return 0; + }, + set: function (n) { + } // error - accessors do not agree in visibility + , + enumerable: true, + configurable: true + }); + return E; +})(); diff --git a/tests/baselines/reference/gettersAndSettersTypesAgree.js b/tests/baselines/reference/gettersAndSettersTypesAgree.js new file mode 100644 index 00000000000..48c0ac1500c --- /dev/null +++ b/tests/baselines/reference/gettersAndSettersTypesAgree.js @@ -0,0 +1,48 @@ +//// [gettersAndSettersTypesAgree.ts] +class C { + public get Foo() { return "foo";} // ok + public set Foo(foo) {} // ok - type inferred from getter return statement + + public get Bar() { return "foo";} // ok + public set Bar(bar:string) {} // ok - type must be declared +} + +var o1 = {get Foo(){return 0;}, set Foo(val){}}; // ok - types agree (inference) +var o2 = {get Foo(){return 0;}, set Foo(val:number){}}; // ok - types agree + +//// [gettersAndSettersTypesAgree.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + get: function () { + return "foo"; + } // ok + , + set: function (foo) { + } // ok - type inferred from getter return statement + , + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "Bar", { + get: function () { + return "foo"; + } // ok + , + set: function (bar) { + } // ok - type must be declared + , + enumerable: true, + configurable: true + }); + return C; +})(); +var o1 = { get Foo() { + return 0; +}, set Foo(val) { +} }; // ok - types agree (inference) +var o2 = { get Foo() { + return 0; +}, set Foo(val) { +} }; // ok - types agree diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index fbe05bbfc79..e8c574d2115 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -17,6 +17,7 @@ tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(76,5): error TS2386: Overload signatures must all be optional or required. @@ -39,6 +40,7 @@ tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(140,9): error TS2386: Overload signatures must all be optional or required. @@ -62,6 +64,7 @@ tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all be optional or required. @@ -117,6 +120,7 @@ tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(334,5): error TS2386: Overload signatures must all be optional or required. @@ -139,6 +143,7 @@ tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(398,9): error TS2386: Overload signatures must all be optional or required. @@ -162,6 +167,7 @@ tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all be optional or required. @@ -233,6 +239,7 @@ tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(602,9): error TS2386: Overload signatures must all be optional or required. @@ -249,6 +256,7 @@ tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/giant.ts(668,9): error TS2386: Overload signatures must all be optional or required. @@ -257,7 +265,7 @@ tests/cases/compiler/giant.ts(672,25): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be declared in ambient contexts. -==== tests/cases/compiler/giant.ts (257 errors) ==== +==== tests/cases/compiler/giant.ts (265 errors) ==== /* Prefixes @@ -357,6 +365,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. @@ -465,6 +475,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. @@ -590,6 +602,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. @@ -815,6 +829,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. @@ -923,6 +939,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. @@ -1048,6 +1066,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. @@ -1315,6 +1335,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. @@ -1413,6 +1435,8 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be [p]; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js new file mode 100644 index 00000000000..b16d0f5231c --- /dev/null +++ b/tests/baselines/reference/giant.js @@ -0,0 +1,1524 @@ +//// [giant.ts] + +/* + Prefixes + p -> public + r -> private + i -> import + e -> export + a -> ambient + t -> static + s -> set + g -> get + + MAX DEPTH 3 LEVELS +*/ +var V; +function F() { }; +class C { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() +} +interface I { + //Call Signature + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; +} +module M { + var V; + function F() { }; + class C { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() + } + interface I { + //Call Signature + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; + } + module M { + var V; + function F() { }; + class C { }; + interface I { }; + module M { }; + export var eV; + export function eF() { }; + export class eC { }; + export interface eI { }; + export module eM { }; + export declare var eaV; + export declare function eaF() { }; + export declare class eaC { }; + export declare module eaM { }; + } + export var eV; + export function eF() { }; + export class eC { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() + } + export interface eI { + //Call Signature + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; + } + export module eM { + var V; + function F() { }; + class C { }; + interface I { }; + module M { }; + export var eV; + export function eF() { }; + export class eC { }; + export interface eI { }; + export module eM { }; + export declare var eaV; + export declare function eaF() { }; + export declare class eaC { }; + export declare module eaM { }; + } + export declare var eaV; + export declare function eaF() { }; + export declare class eaC { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() + } + export declare module eaM { + var V; + function F() { }; + class C { } + interface I { } + module M { } + export var eV; + export function eF() { }; + export class eC { } + export interface eI { } + export module eM { } + } +} +export var eV; +export function eF() { }; +export class eC { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() +} +export interface eI { + //Call Signature + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; +} +export module eM { + var V; + function F() { }; + class C { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() + } + interface I { + //Call Signature + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; + } + module M { + var V; + function F() { }; + class C { }; + interface I { }; + module M { }; + export var eV; + export function eF() { }; + export class eC { }; + export interface eI { }; + export module eM { }; + export declare var eaV; + export declare function eaF() { }; + export declare class eaC { }; + export declare module eaM { }; + } + export var eV; + export function eF() { }; + export class eC { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() + } + export interface eI { + //Call Signature + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; + } + export module eM { + var V; + function F() { }; + class C { }; + interface I { }; + module M { }; + export var eV; + export function eF() { }; + export class eC { }; + export interface eI { }; + export module eM { }; + export declare var eaV; + export declare function eaF() { }; + export declare class eaC { }; + export declare module eaM { }; + } + export declare var eaV; + export declare function eaF() { }; + export declare class eaC { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() + } + export declare module eaM { + var V; + function F() { }; + class C { } + interface I { } + module M { } + export var eV; + export function eF() { }; + export class eC { } + export interface eI { } + export module eM { } + } +} +export declare var eaV; +export declare function eaF() { }; +export declare class eaC { + constructor () { } + public pV; + private rV; + public pF() { } + private rF() { } + public pgF() { } + public get pgF() + public psF(param:any) { } + public set psF(param:any) + private rgF() { } + private get rgF() + private rsF(param:any) { } + private set rsF(param:any) + static tV; + static tF() { } + static tsF(param:any) { } + static set tsF(param:any) + static tgF() { } + static get tgF() +} +export declare module eaM { + var V; + function F() { }; + class C { + constructor () { } + public pV; + private rV; + public pF() { } + static tV; + static tF() { } + } + interface I { + //Call Signature + (); + (): number; + (p: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; + } + module M { + var V; + function F() { }; + class C { } + interface I { } + module M { } + export var eV; + export function eF() { }; + export class eC { } + export interface eI { } + export module eM { } + export declare var eaV + export declare function eaF() { }; + export declare class eaC { } + export declare module eaM { } + } + export var eV; + export function eF() { }; + export class eC { + constructor () { } + public pV; + private rV; + public pF() { } + static tV + static tF() { } + } + export interface eI { + //Call Signature + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signature + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + //Index Signature + [p]; + [p1: string]; + [p2: string, p3: number]; + + //Property Signature + p; + p1?; + p2?: string; + + //Function Signature + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; + } + export module eM { + var V; + function F() { }; + class C { } + module M { } + export var eV; + export function eF() { }; + export class eC { } + export interface eI { } + export module eM { } + } +} + +//// [giant.js] +define(["require", "exports"], function (require, exports) { + /* + Prefixes + p -> public + r -> private + i -> import + e -> export + a -> ambient + t -> static + s -> set + g -> get + + MAX DEPTH 3 LEVELS + */ + var V; + function F() { + } + ; + var C = (function () { + function C() { + } + C.prototype.pF = function () { + }; + C.prototype.rF = function () { + }; + C.prototype.pgF = function () { + }; + Object.defineProperty(C.prototype, "pgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + C.prototype.psF = function (param) { + }; + Object.defineProperty(C.prototype, "psF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.prototype.rgF = function () { + }; + Object.defineProperty(C.prototype, "rgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + C.prototype.rsF = function (param) { + }; + Object.defineProperty(C.prototype, "rsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.tF = function () { + }; + C.tsF = function (param) { + }; + Object.defineProperty(C, "tsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.tgF = function () { + }; + Object.defineProperty(C, "tgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; + })(); + var M; + (function (_M) { + var V; + function F() { + } + ; + var C = (function () { + function C() { + } + C.prototype.pF = function () { + }; + C.prototype.rF = function () { + }; + C.prototype.pgF = function () { + }; + Object.defineProperty(C.prototype, "pgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + C.prototype.psF = function (param) { + }; + Object.defineProperty(C.prototype, "psF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.prototype.rgF = function () { + }; + Object.defineProperty(C.prototype, "rgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + C.prototype.rsF = function (param) { + }; + Object.defineProperty(C.prototype, "rsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.tF = function () { + }; + C.tsF = function (param) { + }; + Object.defineProperty(C, "tsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.tgF = function () { + }; + Object.defineProperty(C, "tgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; + })(); + var M; + (function (M) { + var V; + function F() { + } + ; + var C = (function () { + function C() { + } + return C; + })(); + ; + ; + ; + M.eV; + function eF() { + } + M.eF = eF; + ; + var eC = (function () { + function eC() { + } + return eC; + })(); + M.eC = eC; + ; + ; + ; + ; + ; + ; + })(M || (M = {})); + _M.eV; + function eF() { + } + _M.eF = eF; + ; + var eC = (function () { + function eC() { + } + eC.prototype.pF = function () { + }; + eC.prototype.rF = function () { + }; + eC.prototype.pgF = function () { + }; + Object.defineProperty(eC.prototype, "pgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + eC.prototype.psF = function (param) { + }; + Object.defineProperty(eC.prototype, "psF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.prototype.rgF = function () { + }; + Object.defineProperty(eC.prototype, "rgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + eC.prototype.rsF = function (param) { + }; + Object.defineProperty(eC.prototype, "rsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.tF = function () { + }; + eC.tsF = function (param) { + }; + Object.defineProperty(eC, "tsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.tgF = function () { + }; + Object.defineProperty(eC, "tgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return eC; + })(); + _M.eC = eC; + var eM; + (function (eM) { + var V; + function F() { + } + ; + var C = (function () { + function C() { + } + return C; + })(); + ; + ; + ; + eM.eV; + function eF() { + } + eM.eF = eF; + ; + var eC = (function () { + function eC() { + } + return eC; + })(); + eM.eC = eC; + ; + ; + ; + ; + ; + ; + })(eM = _M.eM || (_M.eM = {})); + ; + })(M || (M = {})); + exports.eV; + function eF() { + } + exports.eF = eF; + ; + var eC = (function () { + function eC() { + } + eC.prototype.pF = function () { + }; + eC.prototype.rF = function () { + }; + eC.prototype.pgF = function () { + }; + Object.defineProperty(eC.prototype, "pgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + eC.prototype.psF = function (param) { + }; + Object.defineProperty(eC.prototype, "psF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.prototype.rgF = function () { + }; + Object.defineProperty(eC.prototype, "rgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + eC.prototype.rsF = function (param) { + }; + Object.defineProperty(eC.prototype, "rsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.tF = function () { + }; + eC.tsF = function (param) { + }; + Object.defineProperty(eC, "tsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.tgF = function () { + }; + Object.defineProperty(eC, "tgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return eC; + })(); + exports.eC = eC; + var eM; + (function (_eM) { + var V; + function F() { + } + ; + var C = (function () { + function C() { + } + C.prototype.pF = function () { + }; + C.prototype.rF = function () { + }; + C.prototype.pgF = function () { + }; + Object.defineProperty(C.prototype, "pgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + C.prototype.psF = function (param) { + }; + Object.defineProperty(C.prototype, "psF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.prototype.rgF = function () { + }; + Object.defineProperty(C.prototype, "rgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + C.prototype.rsF = function (param) { + }; + Object.defineProperty(C.prototype, "rsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.tF = function () { + }; + C.tsF = function (param) { + }; + Object.defineProperty(C, "tsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + C.tgF = function () { + }; + Object.defineProperty(C, "tgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; + })(); + var M; + (function (M) { + var V; + function F() { + } + ; + var C = (function () { + function C() { + } + return C; + })(); + ; + ; + ; + M.eV; + function eF() { + } + M.eF = eF; + ; + var eC = (function () { + function eC() { + } + return eC; + })(); + M.eC = eC; + ; + ; + ; + ; + ; + ; + })(M || (M = {})); + _eM.eV; + function eF() { + } + _eM.eF = eF; + ; + var eC = (function () { + function eC() { + } + eC.prototype.pF = function () { + }; + eC.prototype.rF = function () { + }; + eC.prototype.pgF = function () { + }; + Object.defineProperty(eC.prototype, "pgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + eC.prototype.psF = function (param) { + }; + Object.defineProperty(eC.prototype, "psF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.prototype.rgF = function () { + }; + Object.defineProperty(eC.prototype, "rgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + eC.prototype.rsF = function (param) { + }; + Object.defineProperty(eC.prototype, "rsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.tF = function () { + }; + eC.tsF = function (param) { + }; + Object.defineProperty(eC, "tsF", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + eC.tgF = function () { + }; + Object.defineProperty(eC, "tgF", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return eC; + })(); + _eM.eC = eC; + var eM; + (function (eM) { + var V; + function F() { + } + ; + var C = (function () { + function C() { + } + return C; + })(); + ; + ; + ; + eM.eV; + function eF() { + } + eM.eF = eF; + ; + var eC = (function () { + function eC() { + } + return eC; + })(); + eM.eC = eC; + ; + ; + ; + ; + ; + ; + })(eM = _eM.eM || (_eM.eM = {})); + ; + })(eM = exports.eM || (exports.eM = {})); + ; +}); + + +//// [giant.d.ts] +export declare var eV: any; +export declare function eF(): void; +export declare class eC { + constructor(); + pV: any; + private rV; + pF(): void; + private rF(); + pgF(): void; + pgF: any; + psF(param: any): void; + psF: any; + private rgF(); + private rgF; + private rsF(param); + private rsF; + static tV: any; + static tF(): void; + static tsF(param: any): void; + static tsF: any; + static tgF(): void; + static tgF: any; +} +export interface eI { + (): any; + (): number; + (p: any): any; + (p1: string): any; + (p2?: string): any; + (...p3: any[]): any; + (p4: string, p5?: string): any; + (p6: string, ...p7: any[]): any; + new (): any; + new (): number; + new (p: string): any; + new (p2?: string): any; + new (...p3: any[]): any; + new (p4: string, p5?: string): any; + new (p6: string, ...p7: any[]): any; + [p1: string]: any; + [p2: string, p3: number]: any; + p: any; + p1?: any; + p2?: string; + p3(): any; + p4?(): any; + p5?(): void; + p6(pa1: any): void; + p7(pa1: any, pa2: any): void; + p7?(pa1: any, pa2: any): void; +} +export declare module eM { + var eV: any; + function eF(): void; + class eC { + constructor(); + pV: any; + private rV; + pF(): void; + private rF(); + pgF(): void; + pgF: any; + psF(param: any): void; + psF: any; + private rgF(); + private rgF; + private rsF(param); + private rsF; + static tV: any; + static tF(): void; + static tsF(param: any): void; + static tsF: any; + static tgF(): void; + static tgF: any; + } + interface eI { + (): any; + (): number; + (p: any): any; + (p1: string): any; + (p2?: string): any; + (...p3: any[]): any; + (p4: string, p5?: string): any; + (p6: string, ...p7: any[]): any; + new (): any; + new (): number; + new (p: string): any; + new (p2?: string): any; + new (...p3: any[]): any; + new (p4: string, p5?: string): any; + new (p6: string, ...p7: any[]): any; + [p1: string]: any; + [p2: string, p3: number]: any; + p: any; + p1?: any; + p2?: string; + p3(): any; + p4?(): any; + p5?(): void; + p6(pa1: any): void; + p7(pa1: any, pa2: any): void; + p7?(pa1: any, pa2: any): void; + } + module eM { + var eV: any; + function eF(): void; + class eC { + } + interface eI { + } + module eM { + } + var eaV: any; + function eaF(): void; + class eaC { + } + module eaM { + } + } + var eaV: any; + function eaF(): void; + class eaC { + constructor(); + pV: any; + private rV; + pF(): void; + private rF(); + pgF(): void; + pgF: any; + psF(param: any): void; + psF: any; + private rgF(); + private rgF; + private rsF(param); + private rsF; + static tV: any; + static tF(): void; + static tsF(param: any): void; + static tsF: any; + static tgF(): void; + static tgF: any; + } + module eaM { + var V: any; + function F(): void; + class C { + } + interface I { + } + module M { + } + var eV: any; + function eF(): void; + class eC { + } + interface eI { + } + module eM { + } + } +} +export declare var eaV: any; +export declare function eaF(): void; +export declare class eaC { + constructor(); + pV: any; + private rV; + pF(): void; + private rF(); + pgF(): void; + pgF: any; + psF(param: any): void; + psF: any; + private rgF(); + private rgF; + private rsF(param); + private rsF; + static tV: any; + static tF(): void; + static tsF(param: any): void; + static tsF: any; + static tgF(): void; + static tgF: any; +} +export declare module eaM { + var V: any; + function F(): void; + class C { + constructor(); + pV: any; + private rV; + pF(): void; + static tV: any; + static tF(): void; + } + interface I { + (): any; + (): number; + (p: string): any; + (p2?: string): any; + (...p3: any[]): any; + (p4: string, p5?: string): any; + (p6: string, ...p7: any[]): any; + new (): any; + new (): number; + new (p: string): any; + new (p2?: string): any; + new (...p3: any[]): any; + new (p4: string, p5?: string): any; + new (p6: string, ...p7: any[]): any; + [p1: string]: any; + [p2: string, p3: number]: any; + p: any; + p1?: any; + p2?: string; + p3(): any; + p4?(): any; + p5?(): void; + p6(pa1: any): void; + p7(pa1: any, pa2: any): void; + p7?(pa1: any, pa2: any): void; + } + module M { + var V: any; + function F(): void; + class C { + } + interface I { + } + module M { + } + var eV: any; + function eF(): void; + class eC { + } + interface eI { + } + module eM { + } + var eaV: any; + function eaF(): void; + class eaC { + } + module eaM { + } + } + var eV: any; + function eF(): void; + class eC { + constructor(); + pV: any; + private rV; + pF(): void; + static tV: any; + static tF(): void; + } + interface eI { + (): any; + (): number; + (p: any): any; + (p1: string): any; + (p2?: string): any; + (...p3: any[]): any; + (p4: string, p5?: string): any; + (p6: string, ...p7: any[]): any; + new (): any; + new (): number; + new (p: string): any; + new (p2?: string): any; + new (...p3: any[]): any; + new (p4: string, p5?: string): any; + new (p6: string, ...p7: any[]): any; + [p1: string]: any; + [p2: string, p3: number]: any; + p: any; + p1?: any; + p2?: string; + p3(): any; + p4?(): any; + p5?(): void; + p6(pa1: any): void; + p7(pa1: any, pa2: any): void; + p7?(pa1: any, pa2: any): void; + } + module eM { + var V: any; + function F(): void; + class C { + } + module M { + } + var eV: any; + function eF(): void; + class eC { + } + interface eI { + } + module eM { + } + } +} diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.types.pull b/tests/baselines/reference/heterogeneousArrayLiterals.types.pull new file mode 100644 index 00000000000..e35caeed74a --- /dev/null +++ b/tests/baselines/reference/heterogeneousArrayLiterals.types.pull @@ -0,0 +1,548 @@ +=== tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts === +// type of an array is the best common type of its elements (plus its contextual type if it exists) + +var a = [1, '']; // {}[] +>a : (string | number)[] +>[1, ''] : (string | number)[] + +var b = [1, null]; // number[] +>b : number[] +>[1, null] : number[] + +var c = [1, '', null]; // {}[] +>c : (string | number)[] +>[1, '', null] : (string | number)[] + +var d = [{}, 1]; // {}[] +>d : {}[] +>[{}, 1] : {}[] +>{} : {} + +var e = [{}, Object]; // {}[] +>e : {}[] +>[{}, Object] : {}[] +>{} : {} +>Object : ObjectConstructor + +var f = [[], [1]]; // number[][] +>f : number[][] +>[[], [1]] : number[][] +>[] : undefined[] +>[1] : number[] + +var g = [[1], ['']]; // {}[] +>g : (number[] | string[])[] +>[[1], ['']] : (number[] | string[])[] +>[1] : number[] +>[''] : string[] + +var h = [{ foo: 1, bar: '' }, { foo: 2 }]; // {foo: number}[] +>h : { foo: number; }[] +>[{ foo: 1, bar: '' }, { foo: 2 }] : { foo: number; }[] +>{ foo: 1, bar: '' } : { foo: number; bar: string; } +>foo : number +>bar : string +>{ foo: 2 } : { foo: number; } +>foo : number + +var i = [{ foo: 1, bar: '' }, { foo: '' }]; // {}[] +>i : ({ foo: number; bar: string; } | { foo: string; })[] +>[{ foo: 1, bar: '' }, { foo: '' }] : ({ foo: number; bar: string; } | { foo: string; })[] +>{ foo: 1, bar: '' } : { foo: number; bar: string; } +>foo : number +>bar : string +>{ foo: '' } : { foo: string; } +>foo : string + +var j = [() => 1, () => '']; // {}[] +>j : ((() => number) | (() => string))[] +>[() => 1, () => ''] : ((() => number) | (() => string))[] +>() => 1 : () => number +>() => '' : () => string + +var k = [() => 1, () => 1]; // { (): number }[] +>k : (() => number)[] +>[() => 1, () => 1] : (() => number)[] +>() => 1 : () => number +>() => 1 : () => number + +var l = [() => 1, () => null]; // { (): any }[] +>l : (() => any)[] +>[() => 1, () => null] : (() => any)[] +>() => 1 : () => number +>() => null : () => any + +var m = [() => 1, () => '', () => null]; // { (): any }[] +>m : (() => any)[] +>[() => 1, () => '', () => null] : (() => any)[] +>() => 1 : () => number +>() => '' : () => string +>() => null : () => any + +var n = [[() => 1], [() => '']]; // {}[] +>n : ((() => number)[] | (() => string)[])[] +>[[() => 1], [() => '']] : ((() => number)[] | (() => string)[])[] +>[() => 1] : (() => number)[] +>() => 1 : () => number +>[() => ''] : (() => string)[] +>() => '' : () => string + +class Base { foo: string; } +>Base : Base +>foo : string + +class Derived extends Base { bar: string; } +>Derived : Derived +>Base : Base +>bar : string + +class Derived2 extends Base { baz: string; } +>Derived2 : Derived2 +>Base : Base +>baz : string + +var base: Base; +>base : Base +>Base : Base + +var derived: Derived; +>derived : Derived +>Derived : Derived + +var derived2: Derived2; +>derived2 : Derived2 +>Derived2 : Derived2 + +module Derived { +>Derived : typeof Derived + + var h = [{ foo: base, basear: derived }, { foo: base }]; // {foo: Base}[] +>h : { foo: Base; }[] +>[{ foo: base, basear: derived }, { foo: base }] : { foo: Base; }[] +>{ foo: base, basear: derived } : { foo: Base; basear: Derived; } +>foo : Base +>base : Base +>basear : Derived +>derived : Derived +>{ foo: base } : { foo: Base; } +>foo : Base +>base : Base + + var i = [{ foo: base, basear: derived }, { foo: derived }]; // {foo: Derived}[] +>i : ({ foo: Base; basear: Derived; } | { foo: Derived; })[] +>[{ foo: base, basear: derived }, { foo: derived }] : ({ foo: Base; basear: Derived; } | { foo: Derived; })[] +>{ foo: base, basear: derived } : { foo: Base; basear: Derived; } +>foo : Base +>base : Base +>basear : Derived +>derived : Derived +>{ foo: derived } : { foo: Derived; } +>foo : Derived +>derived : Derived + + var j = [() => base, () => derived]; // { {}: Base } +>j : (() => Base)[] +>[() => base, () => derived] : (() => Base)[] +>() => base : () => Base +>base : Base +>() => derived : () => Derived +>derived : Derived + + var k = [() => base, () => 1]; // {}[]~ +>k : ((() => Base) | (() => number))[] +>[() => base, () => 1] : ((() => Base) | (() => number))[] +>() => base : () => Base +>base : Base +>() => 1 : () => number + + var l = [() => base, () => null]; // { (): any }[] +>l : (() => any)[] +>[() => base, () => null] : (() => any)[] +>() => base : () => Base +>base : Base +>() => null : () => any + + var m = [() => base, () => derived, () => null]; // { (): any }[] +>m : (() => any)[] +>[() => base, () => derived, () => null] : (() => any)[] +>() => base : () => Base +>base : Base +>() => derived : () => Derived +>derived : Derived +>() => null : () => any + + var n = [[() => base], [() => derived]]; // { (): Base }[] +>n : (() => Base)[][] +>[[() => base], [() => derived]] : (() => Base)[][] +>[() => base] : (() => Base)[] +>() => base : () => Base +>base : Base +>[() => derived] : (() => Derived)[] +>() => derived : () => Derived +>derived : Derived + + var o = [derived, derived2]; // {}[] +>o : (Derived | Derived2)[] +>[derived, derived2] : (Derived | Derived2)[] +>derived : Derived +>derived2 : Derived2 + + var p = [derived, derived2, base]; // Base[] +>p : Base[] +>[derived, derived2, base] : Base[] +>derived : Derived +>derived2 : Derived2 +>base : Base + + var q = [[() => derived2], [() => derived]]; // {}[] +>q : ((() => Derived2)[] | (() => Derived)[])[] +>[[() => derived2], [() => derived]] : ((() => Derived2)[] | (() => Derived)[])[] +>[() => derived2] : (() => Derived2)[] +>() => derived2 : () => Derived2 +>derived2 : Derived2 +>[() => derived] : (() => Derived)[] +>() => derived : () => Derived +>derived : Derived +} + +module WithContextualType { +>WithContextualType : typeof WithContextualType + + // no errors + var a: Base[] = [derived, derived2]; +>a : Base[] +>Base : Base +>[derived, derived2] : (Derived | Derived2)[] +>derived : Derived +>derived2 : Derived2 + + var b: Derived[] = [null]; +>b : Derived[] +>Derived : Derived +>[null] : null[] + + var c: Derived[] = []; +>c : Derived[] +>Derived : Derived +>[] : undefined[] + + var d: { (): Base }[] = [() => derived, () => derived2]; +>d : (() => Base)[] +>Base : Base +>[() => derived, () => derived2] : ((() => Derived) | (() => Derived2))[] +>() => derived : () => Derived +>derived : Derived +>() => derived2 : () => Derived2 +>derived2 : Derived2 +} + +function foo(t: T, u: U) { +>foo : (t: T, u: U) => void +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // {}[] +>c : (T | U)[] +>[t, u] : (T | U)[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : (number | T)[] +>[t, 1] : (number | T)[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : ((() => T) | (() => U))[] +>[() => t, () => u] : ((() => T) | (() => U))[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any +} + +function foo2(t: T, u: U) { +>foo2 : (t: T, u: U) => void +>T : T +>Base : Base +>U : U +>Derived : Derived +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // {}[] +>c : (T | U)[] +>[t, u] : (T | U)[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : (number | T)[] +>[t, 1] : (number | T)[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : ((() => T) | (() => U))[] +>[() => t, () => u] : ((() => T) | (() => U))[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any + + var g = [t, base]; // Base[] +>g : Base[] +>[t, base] : Base[] +>t : T +>base : Base + + var h = [t, derived]; // Derived[] +>h : (Derived | T)[] +>[t, derived] : (Derived | T)[] +>t : T +>derived : Derived + + var i = [u, base]; // Base[] +>i : Base[] +>[u, base] : Base[] +>u : U +>base : Base + + var j = [u, derived]; // Derived[] +>j : Derived[] +>[u, derived] : Derived[] +>u : U +>derived : Derived +} + +function foo3(t: T, u: U) { +>foo3 : (t: T, u: U) => void +>T : T +>Derived : Derived +>U : U +>Derived : Derived +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // {}[] +>c : (T | U)[] +>[t, u] : (T | U)[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : (number | T)[] +>[t, 1] : (number | T)[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : ((() => T) | (() => U))[] +>[() => t, () => u] : ((() => T) | (() => U))[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any + + var g = [t, base]; // Base[] +>g : Base[] +>[t, base] : Base[] +>t : T +>base : Base + + var h = [t, derived]; // Derived[] +>h : Derived[] +>[t, derived] : Derived[] +>t : T +>derived : Derived + + var i = [u, base]; // Base[] +>i : Base[] +>[u, base] : Base[] +>u : U +>base : Base + + var j = [u, derived]; // Derived[] +>j : Derived[] +>[u, derived] : Derived[] +>u : U +>derived : Derived +} + +function foo4(t: T, u: U) { +>foo4 : (t: T, u: U) => void +>T : T +>Base : Base +>U : U +>Base : Base +>t : T +>T : T +>u : U +>U : U + + var a = [t, t]; // T[] +>a : T[] +>[t, t] : T[] +>t : T +>t : T + + var b = [t, null]; // T[] +>b : T[] +>[t, null] : T[] +>t : T + + var c = [t, u]; // BUG 821629 +>c : (T | U)[] +>[t, u] : (T | U)[] +>t : T +>u : U + + var d = [t, 1]; // {}[] +>d : (number | T)[] +>[t, 1] : (number | T)[] +>t : T + + var e = [() => t, () => u]; // {}[] +>e : ((() => T) | (() => U))[] +>[() => t, () => u] : ((() => T) | (() => U))[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U + + var f = [() => t, () => u, () => null]; // { (): any }[] +>f : (() => any)[] +>[() => t, () => u, () => null] : (() => any)[] +>() => t : () => T +>t : T +>() => u : () => U +>u : U +>() => null : () => any + + var g = [t, base]; // Base[] +>g : Base[] +>[t, base] : Base[] +>t : T +>base : Base + + var h = [t, derived]; // Derived[] +>h : (Derived | T)[] +>[t, derived] : (Derived | T)[] +>t : T +>derived : Derived + + var i = [u, base]; // Base[] +>i : Base[] +>[u, base] : Base[] +>u : U +>base : Base + + var j = [u, derived]; // Derived[] +>j : (Derived | U)[] +>[u, derived] : (Derived | U)[] +>u : U +>derived : Derived + + var k: Base[] = [t, u]; +>k : Base[] +>Base : Base +>[t, u] : (T | U)[] +>t : T +>u : U +} + +//function foo3(t: T, u: U) { +// var a = [t, t]; // T[] +// var b = [t, null]; // T[] +// var c = [t, u]; // {}[] +// var d = [t, 1]; // {}[] +// var e = [() => t, () => u]; // {}[] +// var f = [() => t, () => u, () => null]; // { (): any }[] + +// var g = [t, base]; // Base[] +// var h = [t, derived]; // Derived[] +// var i = [u, base]; // Base[] +// var j = [u, derived]; // Derived[] +//} + +//function foo4(t: T, u: U) { +// var a = [t, t]; // T[] +// var b = [t, null]; // T[] +// var c = [t, u]; // BUG 821629 +// var d = [t, 1]; // {}[] +// var e = [() => t, () => u]; // {}[] +// var f = [() => t, () => u, () => null]; // { (): any }[] + +// var g = [t, base]; // Base[] +// var h = [t, derived]; // Derived[] +// var i = [u, base]; // Base[] +// var j = [u, derived]; // Derived[] + +// var k: Base[] = [t, u]; +//} diff --git a/tests/baselines/reference/illegalModifiersOnClassElements.js b/tests/baselines/reference/illegalModifiersOnClassElements.js new file mode 100644 index 00000000000..b9a40fa6aa0 --- /dev/null +++ b/tests/baselines/reference/illegalModifiersOnClassElements.js @@ -0,0 +1,14 @@ +//// [illegalModifiersOnClassElements.ts] +class C { + declare foo = 1; + export bar = 1; +} + +//// [illegalModifiersOnClassElements.js] +var C = (function () { + function C() { + this.foo = 1; + this.bar = 1; + } + return C; +})(); diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js new file mode 100644 index 00000000000..b978af1a609 --- /dev/null +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -0,0 +1,56 @@ +//// [illegalSuperCallsInConstructor.ts] +class Base { + x: string; +} + +class Derived extends Base { + constructor() { + var r2 = () => super(); + var r3 = () => { super(); } + var r4 = function () { super(); } + var r5 = { + get foo() { + super(); + return 1; + }, + set foo(v: number) { + super(); + } + } + } +} + +//// [illegalSuperCallsInConstructor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var Derived = (function (_super) { + __extends(Derived, _super); + function Derived() { + var r2 = function () { return _super.call(this); }; + var r3 = function () { + _super.call(this); + }; + var r4 = function () { + _super.call(this); + }; + var r5 = { + get foo() { + _super.call(this); + return 1; + }, + set foo(v) { + _super.call(this); + } + }; + } + return Derived; +})(Base); diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js new file mode 100644 index 00000000000..e8f0b96f485 --- /dev/null +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -0,0 +1,23 @@ +//// [implementClausePrecedingExtends.ts] +class C { foo: number } +class D implements C extends C { } + +//// [implementClausePrecedingExtends.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; +})(C); diff --git a/tests/baselines/reference/implementsClauseAlreadySeen.js b/tests/baselines/reference/implementsClauseAlreadySeen.js new file mode 100644 index 00000000000..84823c13fa8 --- /dev/null +++ b/tests/baselines/reference/implementsClauseAlreadySeen.js @@ -0,0 +1,21 @@ +//// [implementsClauseAlreadySeen.ts] +class C { + +} +class D implements C implements C { + baz() { } +} + +//// [implementsClauseAlreadySeen.js] +var C = (function () { + function C() { + } + return C; +})(); +var D = (function () { + function D() { + } + D.prototype.baz = function () { + }; + return D; +})(); diff --git a/tests/baselines/reference/implicitAnyCastedValue.js b/tests/baselines/reference/implicitAnyCastedValue.js new file mode 100644 index 00000000000..be6bd1bfef3 --- /dev/null +++ b/tests/baselines/reference/implicitAnyCastedValue.js @@ -0,0 +1,163 @@ +//// [implicitAnyCastedValue.ts] +var x = function () { + return 0; // this should not be an error +} + +function foo() { + return "hello world"; // this should not be an error +} + +class C { + bar = null; // this should be an error + foo = undefined; // this should be an error + public get tempVar() { + return 0; // this should not be an error + } + + public returnBarWithCase() { // this should not be an error + return this.bar; + } + + public returnFooWithCase() { + return this.foo; // this should not be an error + } +} + +class C1 { + getValue = null; // this should be an error + + public get castedGet() { + return this.getValue; // this should not be an error + } + + public get notCastedGet() { + return this.getValue; // this should not be an error + } +} + +function castedNull() { + return null; // this should not be an error +} + +function notCastedNull() { + return null; // this should be an error +} + +function returnTypeBar(): any { + return null; // this should not be an error +} + +function undefinedBar() { + return undefined; // this should not be an error +} + +function multipleRets1(x) { // this should not be an error + if (x) { + return 0; + } + else { + return null; + } +} + +function multipleRets2(x) { // this should not be an error + if (x) { + return null; + } + else if (x == 1) { + return 0; + } + else { + return undefined; + } +} + +// this should not be an error +var bar1 = null; +var bar2 = undefined; +var bar3 = 0; +var array = [null, undefined]; + +//// [implicitAnyCastedValue.js] +var x = function () { + return 0; // this should not be an error +}; +function foo() { + return "hello world"; // this should not be an error +} +var C = (function () { + function C() { + this.bar = null; // this should be an error + this.foo = undefined; // this should be an error + } + Object.defineProperty(C.prototype, "tempVar", { + get: function () { + return 0; // this should not be an error + }, + enumerable: true, + configurable: true + }); + C.prototype.returnBarWithCase = function () { + return this.bar; + }; + C.prototype.returnFooWithCase = function () { + return this.foo; // this should not be an error + }; + return C; +})(); +var C1 = (function () { + function C1() { + this.getValue = null; // this should be an error + } + Object.defineProperty(C1.prototype, "castedGet", { + get: function () { + return this.getValue; // this should not be an error + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C1.prototype, "notCastedGet", { + get: function () { + return this.getValue; // this should not be an error + }, + enumerable: true, + configurable: true + }); + return C1; +})(); +function castedNull() { + return null; // this should not be an error +} +function notCastedNull() { + return null; // this should be an error +} +function returnTypeBar() { + return null; // this should not be an error +} +function undefinedBar() { + return undefined; // this should not be an error +} +function multipleRets1(x) { + if (x) { + return 0; + } + else { + return null; + } +} +function multipleRets2(x) { + if (x) { + return null; + } + else if (x == 1) { + return 0; + } + else { + return undefined; + } +} +// this should not be an error +var bar1 = null; +var bar2 = undefined; +var bar3 = 0; +var array = [null, undefined]; diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js index 72d68da2287..6332f444487 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionWithoutFormalType.js @@ -18,22 +18,22 @@ function foo(x) { ; function bar(x, y) { } -; +; // error at "y"; no error at "x" function func2(a, b, c) { } -; +; // error at "a,b,c" function func3() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i - 0] = arguments[_i]; } } -; +; // error at "args" function func4(z, w) { if (z === void 0) { z = null; } if (w === void 0) { w = undefined; } } -; +; // error at "z,w" // these shouldn't be errors function noError1(x, y) { if (x === void 0) { x = 3; } diff --git a/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.js b/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.js index 95b617d79ee..ae09bf2e40e 100644 --- a/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.js +++ b/tests/baselines/reference/implicitAnyDeclareVariablesWithoutTypeAndInit.js @@ -16,7 +16,7 @@ var x1: any; var y1 = new x1; var x; // error at "x" function func(k) { } -; +; //error at "k" func(x); // this shouldn't be an error var bar = 3; diff --git a/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.js b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.js new file mode 100644 index 00000000000..ac3b5e66493 --- /dev/null +++ b/tests/baselines/reference/implicitAnyGetAndSetAccessorWithAnyReturnType.js @@ -0,0 +1,67 @@ +//// [implicitAnyGetAndSetAccessorWithAnyReturnType.ts] +// these should be errors +class GetAndSet { + getAndSet = null; // error at "getAndSet" + public get haveGetAndSet() { // this should not be an error + return this.getAndSet; + } + + // this shouldn't be an error + public set haveGetAndSet(value) { // error at "value" + this.getAndSet = value; + } +} + +class SetterOnly { + public set haveOnlySet(newXValue) { // error at "haveOnlySet, newXValue" + } +} + +class GetterOnly { + public get haveOnlyGet() { // error at "haveOnlyGet" + return null; + } +} + +//// [implicitAnyGetAndSetAccessorWithAnyReturnType.js] +// these should be errors +var GetAndSet = (function () { + function GetAndSet() { + this.getAndSet = null; // error at "getAndSet" + } + Object.defineProperty(GetAndSet.prototype, "haveGetAndSet", { + get: function () { + return this.getAndSet; + }, + // this shouldn't be an error + set: function (value) { + this.getAndSet = value; + }, + enumerable: true, + configurable: true + }); + return GetAndSet; +})(); +var SetterOnly = (function () { + function SetterOnly() { + } + Object.defineProperty(SetterOnly.prototype, "haveOnlySet", { + set: function (newXValue) { + }, + enumerable: true, + configurable: true + }); + return SetterOnly; +})(); +var GetterOnly = (function () { + function GetterOnly() { + } + Object.defineProperty(GetterOnly.prototype, "haveOnlyGet", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + return GetterOnly; +})(); diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration.js b/tests/baselines/reference/implicitAnyInAmbientDeclaration.js new file mode 100644 index 00000000000..7807f8fc1ee --- /dev/null +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration.js @@ -0,0 +1,16 @@ +//// [implicitAnyInAmbientDeclaration.ts] +module Test { + declare class C { + public publicMember; // this should be an error + private privateMember; // this should not be an error + + public publicFunction(x); // this should be an error + private privateFunction(privateParam); // this should not be an error + private constructor(privateParam); + } +} + +//// [implicitAnyInAmbientDeclaration.js] +var Test; +(function (Test) { +})(Test || (Test = {})); diff --git a/tests/baselines/reference/implicitAnyInCatch.js b/tests/baselines/reference/implicitAnyInCatch.js index 9952c7ca327..29a2e03a130 100644 --- a/tests/baselines/reference/implicitAnyInCatch.js +++ b/tests/baselines/reference/implicitAnyInCatch.js @@ -15,6 +15,7 @@ class C { //// [implicitAnyInCatch.js] +// this should not be an error try { } catch (error) { diff --git a/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js new file mode 100644 index 00000000000..35992b86fec --- /dev/null +++ b/tests/baselines/reference/importAliasAnExternalModuleInsideAnInternalModule.js @@ -0,0 +1,31 @@ +//// [tests/cases/compiler/importAliasAnExternalModuleInsideAnInternalModule.ts] //// + +//// [importAliasAnExternalModuleInsideAnInternalModule_file0.ts] +export module m { + export function foo() { } +} + +//// [importAliasAnExternalModuleInsideAnInternalModule_file1.ts] +import r = require('importAliasAnExternalModuleInsideAnInternalModule_file0'); +module m_private { + //import r2 = require('m'); // would be error + export import C = r; // no error + C.m.foo(); +} + + +//// [importAliasAnExternalModuleInsideAnInternalModule_file0.js] +var m; +(function (m) { + function foo() { + } + m.foo = foo; +})(m = exports.m || (exports.m = {})); +//// [importAliasAnExternalModuleInsideAnInternalModule_file1.js] +var r = require('importAliasAnExternalModuleInsideAnInternalModule_file0'); +var m_private; +(function (m_private) { + //import r2 = require('m'); // would be error + m_private.C = r; // no error + m_private.C.m.foo(); +})(m_private || (m_private = {})); diff --git a/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.js b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.js new file mode 100644 index 00000000000..34a662d6451 --- /dev/null +++ b/tests/baselines/reference/importDeclRefereingExternalModuleWithNoResolve.js @@ -0,0 +1,8 @@ +//// [importDeclRefereingExternalModuleWithNoResolve.ts] +import b = require("externalModule"); +declare module "m1" { + import im2 = require("externalModule"); +} + + +//// [importDeclRefereingExternalModuleWithNoResolve.js] diff --git a/tests/baselines/reference/importDeclWithClassModifiers.js b/tests/baselines/reference/importDeclWithClassModifiers.js new file mode 100644 index 00000000000..c8aefe03bab --- /dev/null +++ b/tests/baselines/reference/importDeclWithClassModifiers.js @@ -0,0 +1,15 @@ +//// [importDeclWithClassModifiers.ts] +module x { + interface c { + } +} +export public import a = x.c; +export private import b = x.c; +export static import c = x.c; +var b: a; + + +//// [importDeclWithClassModifiers.js] +define(["require", "exports"], function (require, exports) { + var b; +}); diff --git a/tests/baselines/reference/importDeclWithDeclareModifier.js b/tests/baselines/reference/importDeclWithDeclareModifier.js new file mode 100644 index 00000000000..3c80e47a90f --- /dev/null +++ b/tests/baselines/reference/importDeclWithDeclareModifier.js @@ -0,0 +1,11 @@ +//// [importDeclWithDeclareModifier.ts] +module x { + interface c { + } +} +declare export import a = x.c; +var b: a; + + +//// [importDeclWithDeclareModifier.js] +var b; diff --git a/tests/baselines/reference/importDeclWithDeclareModifierInAmbientContext.js b/tests/baselines/reference/importDeclWithDeclareModifierInAmbientContext.js new file mode 100644 index 00000000000..a268c8a0987 --- /dev/null +++ b/tests/baselines/reference/importDeclWithDeclareModifierInAmbientContext.js @@ -0,0 +1,12 @@ +//// [importDeclWithDeclareModifierInAmbientContext.ts] +declare module "m" { + module x { + interface c { + } + } + declare export import a = x.c; + var b: a; +} + + +//// [importDeclWithDeclareModifierInAmbientContext.js] diff --git a/tests/baselines/reference/importDeclarationInModuleDeclaration1.js b/tests/baselines/reference/importDeclarationInModuleDeclaration1.js new file mode 100644 index 00000000000..46a62fd0584 --- /dev/null +++ b/tests/baselines/reference/importDeclarationInModuleDeclaration1.js @@ -0,0 +1,6 @@ +//// [importDeclarationInModuleDeclaration1.ts] +module m2 { + import m3 = require("use_glo_M1_public"); +} + +//// [importDeclarationInModuleDeclaration1.js] diff --git a/tests/baselines/reference/importInsideModule.js b/tests/baselines/reference/importInsideModule.js new file mode 100644 index 00000000000..b0ba16fa850 --- /dev/null +++ b/tests/baselines/reference/importInsideModule.js @@ -0,0 +1,17 @@ +//// [tests/cases/compiler/importInsideModule.ts] //// + +//// [importInsideModule_file1.ts] +export var x = 1; + +//// [importInsideModule_file2.ts] +export module myModule { + import foo = require("importInsideModule_file1"); + var a = foo.x; +} + +//// [importInsideModule_file2.js] +var myModule; +(function (myModule) { + var foo = require("importInsideModule_file1"); + var a = foo.x; +})(myModule = exports.myModule || (exports.myModule = {})); diff --git a/tests/baselines/reference/importNonStringLiteral.js b/tests/baselines/reference/importNonStringLiteral.js new file mode 100644 index 00000000000..52ef5a10a67 --- /dev/null +++ b/tests/baselines/reference/importNonStringLiteral.js @@ -0,0 +1,7 @@ +//// [importNonStringLiteral.ts] +var x = "filename"; +import foo = require(x); // invalid + + +//// [importNonStringLiteral.js] +var x = "filename"; diff --git a/tests/baselines/reference/incompatibleTypes.errors.txt b/tests/baselines/reference/incompatibleTypes.errors.txt index 14dfa883f45..01e4531031a 100644 --- a/tests/baselines/reference/incompatibleTypes.errors.txt +++ b/tests/baselines/reference/incompatibleTypes.errors.txt @@ -15,6 +15,8 @@ tests/cases/compiler/incompatibleTypes.ts(33,7): error TS2420: Class 'C4' incorr Type '{ c: { b: string; }; d: string; }' is not assignable to type '{ a: { a: string; }; b: string; }'. Property 'a' is missing in type '{ c: { b: string; }; d: string; }'. tests/cases/compiler/incompatibleTypes.ts(42,5): error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. + Types of property 'p1' are incompatible. + Type '() => string' is not assignable to type '(s: string) => number'. tests/cases/compiler/incompatibleTypes.ts(49,5): error TS2345: Argument of type '{ e: number; f: number; }' is not assignable to parameter of type '{ c: { b: string; }; d: string; }'. Property 'c' is missing in type '{ e: number; f: number; }'. tests/cases/compiler/incompatibleTypes.ts(66,5): error TS2322: Type '{ e: number; f: number; }' is not assignable to type '{ a: { a: string; }; b: string; }'. @@ -88,6 +90,8 @@ tests/cases/compiler/incompatibleTypes.ts(74,5): error TS2322: Type '(a: any) => if1(c1); ~~ !!! error TS2345: Argument of type 'C1' is not assignable to parameter of type 'IFoo2'. +!!! error TS2345: Types of property 'p1' are incompatible. +!!! error TS2345: Type '() => string' is not assignable to type '(s: string) => number'. function of1(n: { a: { a: string; }; b: string; }): number; diff --git a/tests/baselines/reference/incompleteDottedExpressionAtEOF.js b/tests/baselines/reference/incompleteDottedExpressionAtEOF.js new file mode 100644 index 00000000000..9a51c206683 --- /dev/null +++ b/tests/baselines/reference/incompleteDottedExpressionAtEOF.js @@ -0,0 +1,7 @@ +//// [incompleteDottedExpressionAtEOF.ts] +// used to leak __missing into error message +var p2 = window. + +//// [incompleteDottedExpressionAtEOF.js] +// used to leak __missing into error message +var p2 = window.; diff --git a/tests/baselines/reference/incompleteObjectLiteral1.js b/tests/baselines/reference/incompleteObjectLiteral1.js new file mode 100644 index 00000000000..ecdbe86604a --- /dev/null +++ b/tests/baselines/reference/incompleteObjectLiteral1.js @@ -0,0 +1,7 @@ +//// [incompleteObjectLiteral1.ts] +var tt = { aa; } +var x = tt; + +//// [incompleteObjectLiteral1.js] +var tt = { aa: }; +var x = tt; diff --git a/tests/baselines/reference/incrementAndDecrement.js b/tests/baselines/reference/incrementAndDecrement.js new file mode 100644 index 00000000000..96794e3c956 --- /dev/null +++ b/tests/baselines/reference/incrementAndDecrement.js @@ -0,0 +1,123 @@ +//// [incrementAndDecrement.ts] +enum E { A, B, C }; +var x = 4; +var e = E.B; +var a: any; +var w = window; + +// Assign to expression++ +x++ = 4; // Error + +// Assign to expression-- +x-- = 5; // Error + +// Assign to++expression +++x = 4; // Error + +// Assign to--expression +--x = 5; // Error + +// Pre and postfix++ on number +x++; +x--; +++x; +--x; +++x++; // Error +--x--; // Error +++x--; // Error +--x++; // Error + +// Pre and postfix++ on enum +e++; +e--; +++e; +--e; +++e++; // Error +--e--; // Error +++e--; // Error +--e++; // Error + +// Pre and postfix++ on value of type 'any' +a++; +a--; +++a; +--a; +++a++; // Error +--a--; // Error +++a--; // Error +--a++; // Error + + +// Pre and postfix++ on other types +w++; // Error +w--; // Error +++w; // Error +--w; // Error +++w++; // Error +--w--; // Error +++w--; // Error +--w++; // Error + + + + +//// [incrementAndDecrement.js] +var E; +(function (E) { + E[E["A"] = 0] = "A"; + E[E["B"] = 1] = "B"; + E[E["C"] = 2] = "C"; +})(E || (E = {})); +; +var x = 4; +var e = 1 /* B */; +var a; +var w = window; +// Assign to expression++ +x++; +4; // Error +// Assign to expression-- +x--; +5; // Error +// Assign to++expression +++x; +4; // Error +// Assign to--expression +--x; +5; // Error +// Pre and postfix++ on number +x++; +x--; +++x; +--x; +++x++; // Error +--x--; // Error +++x--; // Error +--x++; // Error +// Pre and postfix++ on enum +e++; +e--; +++e; +--e; +++e++; // Error +--e--; // Error +++e--; // Error +--e++; // Error +// Pre and postfix++ on value of type 'any' +a++; +a--; +++a; +--a; +++a++; // Error +--a--; // Error +++a--; // Error +--a++; // Error +// Pre and postfix++ on other types +w++; // Error +w--; // Error +++w; // Error +--w; // Error +++w++; // Error +--w--; // Error +++w--; // Error +--w++; // Error diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 294282d1e9e..82e96bf3846 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,23 +1,31 @@ -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(12,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation. -==== tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts (4 errors) ==== +==== tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts (6 errors) ==== interface I { + // Used to be indexer, now it is a computed property [x]: string; ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'x'. [x: string]; ~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. } class C { + // Used to be indexer, now it is a computed property [x]: string ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'x'. } diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.js b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.js new file mode 100644 index 00000000000..f586a19bf0e --- /dev/null +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.js @@ -0,0 +1,28 @@ +//// [indexSignatureMustHaveTypeAnnotation.ts] +interface I { + // Used to be indexer, now it is a computed property + [x]: string; + [x: string]; +} + +class C { + // Used to be indexer, now it is a computed property + [x]: string + +} + +class C2 { + [x: string] +} + +//// [indexSignatureMustHaveTypeAnnotation.js] +var C = (function () { + function C() { + } + return C; +})(); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/indexSignatureTypeCheck.js b/tests/baselines/reference/indexSignatureTypeCheck.js new file mode 100644 index 00000000000..02676348bec --- /dev/null +++ b/tests/baselines/reference/indexSignatureTypeCheck.js @@ -0,0 +1,24 @@ +//// [indexSignatureTypeCheck.ts] +interface IPropertySet { + + [index: string]: any; + +} + + +var ps: IPropertySet = null; +var index: any = "hello"; +ps[index] = 12; + + +interface indexErrors { + [p2?: string]; + [...p3: any[]]; + [p4: string, p5?: string]; + [p6: string, ...p7: any[]]; +} + +//// [indexSignatureTypeCheck.js] +var ps = null; +var index = "hello"; +ps[index] = 12; diff --git a/tests/baselines/reference/indexSignatureTypeCheck2.js b/tests/baselines/reference/indexSignatureTypeCheck2.js new file mode 100644 index 00000000000..6dcc0f392a5 --- /dev/null +++ b/tests/baselines/reference/indexSignatureTypeCheck2.js @@ -0,0 +1,25 @@ +//// [indexSignatureTypeCheck2.ts] +class IPropertySet { + [index: string]: any +} + +var ps: IPropertySet = null; +var index: any = "hello"; +ps[index] = 12; + +interface indexErrors { + [p2?: string]; + [...p3: any[]]; + [p4: string, p5?: string]; + [p6: string, ...p7: any[]]; +} + +//// [indexSignatureTypeCheck2.js] +var IPropertySet = (function () { + function IPropertySet() { + } + return IPropertySet; +})(); +var ps = null; +var index = "hello"; +ps[index] = 12; diff --git a/tests/baselines/reference/indexSignatureTypeInference.errors.txt b/tests/baselines/reference/indexSignatureTypeInference.errors.txt index 55bd2ce884f..f93bfc6ce40 100644 --- a/tests/baselines/reference/indexSignatureTypeInference.errors.txt +++ b/tests/baselines/reference/indexSignatureTypeInference.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts(18,27): error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap<{}>'. + Index signature is missing in type 'NumberMap'. ==== tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureTypeInference.ts (1 errors) ==== @@ -22,5 +23,6 @@ tests/cases/conformance/types/typeRelationships/typeInference/indexSignatureType var v1 = stringMapToArray(numberMap); // Error expected here ~~~~~~~~~ !!! error TS2345: Argument of type 'NumberMap' is not assignable to parameter of type 'StringMap<{}>'. +!!! error TS2345: Index signature is missing in type 'NumberMap'. var v1 = stringMapToArray(stringMap); // Ok \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureWithAccessibilityModifier.js b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.js new file mode 100644 index 00000000000..798fef924b9 --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithAccessibilityModifier.js @@ -0,0 +1,15 @@ +//// [indexSignatureWithAccessibilityModifier.ts] +interface I { + [public x: string]: string; +} + +class C { + [public x: string]: string +} + +//// [indexSignatureWithAccessibilityModifier.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index 6fb708a3b80..d6f547a25cb 100644 --- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt +++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt @@ -1,16 +1,23 @@ -tests/cases/compiler/indexSignatureWithInitializer.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/compiler/indexSignatureWithInitializer.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'. +tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'. -==== tests/cases/compiler/indexSignatureWithInitializer.ts (2 errors) ==== +==== tests/cases/compiler/indexSignatureWithInitializer.ts (4 errors) ==== + // These used to be indexers, now they are computed properties interface I { [x = '']: string; ~~~~~~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'x'. } class C { [x = 0]: string ~~~~~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureWithInitializer.js b/tests/baselines/reference/indexSignatureWithInitializer.js new file mode 100644 index 00000000000..490033dde0f --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithInitializer.js @@ -0,0 +1,16 @@ +//// [indexSignatureWithInitializer.ts] +// These used to be indexers, now they are computed properties +interface I { + [x = '']: string; +} + +class C { + [x = 0]: string +} + +//// [indexSignatureWithInitializer.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/indexSignatureWithInitializer1.js b/tests/baselines/reference/indexSignatureWithInitializer1.js new file mode 100644 index 00000000000..16852fd4174 --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithInitializer1.js @@ -0,0 +1,11 @@ +//// [indexSignatureWithInitializer1.ts] +class C { + [a: number = 1]: number; +} + +//// [indexSignatureWithInitializer1.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1.js b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1.js new file mode 100644 index 00000000000..bef6af37931 --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1.js @@ -0,0 +1,11 @@ +//// [indexSignatureWithoutTypeAnnotation1.ts] +class C { + [a: number]; +} + +//// [indexSignatureWithoutTypeAnnotation1.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/indexTypeCheck.js b/tests/baselines/reference/indexTypeCheck.js new file mode 100644 index 00000000000..6e74111a357 --- /dev/null +++ b/tests/baselines/reference/indexTypeCheck.js @@ -0,0 +1,87 @@ +//// [indexTypeCheck.ts] +interface Red { + [n:number]; // ok + [s:string]; // ok +} + +interface Blue { + [n:number]: any; // ok + [s:string]: any; // ok +} + +interface Yellow { + [n:number]: Red; // ok + [s:string]: Red; // ok +} + +interface Orange { + [n:number]: number; // ok + [s:string]: string; // error +} + +interface Green { + [n:number]: Orange; // error + [s:string]: Yellow; // ok +} + +interface Cyan { + [n:number]: number; // error + [s:string]: string; // ok +} + +interface Purple { + [n:number, s:string]; // error +} + +interface Magenta { + [p:Purple]; // error +} + +var yellow: Yellow; +var blue: Blue; +var s = "some string"; + +yellow[5]; // ok +yellow["hue"]; // ok +yellow[{}]; // ok + +s[0]; // error +s["s"]; // ok +s[{}]; // ok + +yellow[blue]; // error + +var x:number[]; +x[0]; + +class Benchmark { + + public results: { [x:string]: any; } = <{ [x:string]: any; }>{}; + + public addTimingFor(name: string, timing: number) { + this.results[name] = this.results[name]; + } +} + +//// [indexTypeCheck.js] +var yellow; +var blue; +var s = "some string"; +yellow[5]; // ok +yellow["hue"]; // ok +yellow[{}]; // ok +s[0]; // error +s["s"]; // ok +s[{}]; // ok +yellow[blue]; // error +var x; +x[0]; +var Benchmark = (function () { + function Benchmark() { + this.results = {}; + } + Benchmark.prototype.addTimingFor = function (name, timing) { + this.results[name] = this.results[name]; + }; + return Benchmark; +})(); diff --git a/tests/baselines/reference/indexWithoutParamType.js b/tests/baselines/reference/indexWithoutParamType.js new file mode 100644 index 00000000000..0ea3e8f897f --- /dev/null +++ b/tests/baselines/reference/indexWithoutParamType.js @@ -0,0 +1,5 @@ +//// [indexWithoutParamType.ts] +var y: { []; } // Error + +//// [indexWithoutParamType.js] +var y; // Error diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 41527d0859f..468368b5f23 100644 --- a/tests/baselines/reference/indexWithoutParamType2.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt @@ -1,9 +1,13 @@ -tests/cases/compiler/indexWithoutParamType2.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'. -==== tests/cases/compiler/indexWithoutParamType2.ts (1 errors) ==== +==== tests/cases/compiler/indexWithoutParamType2.ts (2 errors) ==== class C { + // Used to be indexer, now it is a computed property [x]: string ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexWithoutParamType2.js b/tests/baselines/reference/indexWithoutParamType2.js new file mode 100644 index 00000000000..4197b0596ec --- /dev/null +++ b/tests/baselines/reference/indexWithoutParamType2.js @@ -0,0 +1,12 @@ +//// [indexWithoutParamType2.ts] +class C { + // Used to be indexer, now it is a computed property + [x]: string +} + +//// [indexWithoutParamType2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/indexer2.errors.txt b/tests/baselines/reference/indexer2.errors.txt deleted file mode 100644 index 28020a570ed..00000000000 --- a/tests/baselines/reference/indexer2.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -tests/cases/compiler/indexer2.ts(6,25): error TS2352: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other. - Types of property 'hasOwnProperty' are incompatible. - Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean'. - Types of parameters 'v' and 'objectId' are incompatible. - Type 'string' is not assignable to type 'number'. - - -==== tests/cases/compiler/indexer2.ts (1 errors) ==== - interface IHeapObjectProperty {} - interface IDirectChildrenMap { - hasOwnProperty(objectId: number) : boolean; - [objectId: number] : IHeapObjectProperty[]; - } - var directChildrenMap = {}; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other. -!!! error TS2352: Types of property 'hasOwnProperty' are incompatible. -!!! error TS2352: Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean'. -!!! error TS2352: Types of parameters 'v' and 'objectId' are incompatible. -!!! error TS2352: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/indexer2.types b/tests/baselines/reference/indexer2.types new file mode 100644 index 00000000000..7f1ccd41cb5 --- /dev/null +++ b/tests/baselines/reference/indexer2.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/indexer2.ts === +interface IHeapObjectProperty {} +>IHeapObjectProperty : IHeapObjectProperty + +interface IDirectChildrenMap { +>IDirectChildrenMap : IDirectChildrenMap + + hasOwnProperty(objectId: number) : boolean; +>hasOwnProperty : (objectId: number) => boolean +>objectId : number + + [objectId: number] : IHeapObjectProperty[]; +>objectId : number +>IHeapObjectProperty : IHeapObjectProperty +} +var directChildrenMap = {}; +>directChildrenMap : IDirectChildrenMap +>{} : IDirectChildrenMap +>IDirectChildrenMap : IDirectChildrenMap +>{} : { [x: number]: undefined; } + diff --git a/tests/baselines/reference/indexer2A.errors.txt b/tests/baselines/reference/indexer2A.errors.txt index f2314c5b49b..adf90fb743f 100644 --- a/tests/baselines/reference/indexer2A.errors.txt +++ b/tests/baselines/reference/indexer2A.errors.txt @@ -1,12 +1,7 @@ tests/cases/compiler/indexer2A.ts(4,5): error TS2391: Function implementation is missing or not immediately following the declaration. -tests/cases/compiler/indexer2A.ts(7,25): error TS2352: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other. - Types of property 'hasOwnProperty' are incompatible. - Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean'. - Types of parameters 'v' and 'objectId' are incompatible. - Type 'string' is not assignable to type 'number'. -==== tests/cases/compiler/indexer2A.ts (2 errors) ==== +==== tests/cases/compiler/indexer2A.ts (1 errors) ==== class IHeapObjectProperty { } class IDirectChildrenMap { // Decided to enforce a semicolon after declarations @@ -15,10 +10,4 @@ tests/cases/compiler/indexer2A.ts(7,25): error TS2352: Neither type '{ [x: numbe !!! error TS2391: Function implementation is missing or not immediately following the declaration. [objectId: number]: IHeapObjectProperty[] } - var directChildrenMap = {}; - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2352: Neither type '{ [x: number]: undefined; }' nor type 'IDirectChildrenMap' is assignable to the other. -!!! error TS2352: Types of property 'hasOwnProperty' are incompatible. -!!! error TS2352: Type '(v: string) => boolean' is not assignable to type '(objectId: number) => boolean'. -!!! error TS2352: Types of parameters 'v' and 'objectId' are incompatible. -!!! error TS2352: Type 'string' is not assignable to type 'number'. \ No newline at end of file + var directChildrenMap = {}; \ No newline at end of file diff --git a/tests/baselines/reference/indexerAsOptional.js b/tests/baselines/reference/indexerAsOptional.js new file mode 100644 index 00000000000..509e3890ec8 --- /dev/null +++ b/tests/baselines/reference/indexerAsOptional.js @@ -0,0 +1,17 @@ +//// [indexerAsOptional.ts] +interface indexSig { + //Index signatures can't be optional + [idx?: number]: any; //err +} + +class indexSig2 { + //Index signatures can't be optional + [idx?: number]: any //err +} + +//// [indexerAsOptional.js] +var indexSig2 = (function () { + function indexSig2() { + } + return indexSig2; +})(); diff --git a/tests/baselines/reference/indexerSignatureWithRestParam.js b/tests/baselines/reference/indexerSignatureWithRestParam.js new file mode 100644 index 00000000000..8a7defb049c --- /dev/null +++ b/tests/baselines/reference/indexerSignatureWithRestParam.js @@ -0,0 +1,15 @@ +//// [indexerSignatureWithRestParam.ts] +interface I { + [...x]: string; +} + +class C { + [...x]: string +} + +//// [indexerSignatureWithRestParam.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/inferSetterParamType.js b/tests/baselines/reference/inferSetterParamType.js new file mode 100644 index 00000000000..c0be3a5c394 --- /dev/null +++ b/tests/baselines/reference/inferSetterParamType.js @@ -0,0 +1,49 @@ +//// [inferSetterParamType.ts] +class Foo { + + get bar() { + return 0; + } + set bar(n) { // should not be an error - infer number + } +} + +class Foo2 { + + get bar() { + return 0; // should be an error - can't coerce infered return type to match setter annotated type + } + set bar(n:string) { + } +} + + +//// [inferSetterParamType.js] +var Foo = (function () { + function Foo() { + } + Object.defineProperty(Foo.prototype, "bar", { + get: function () { + return 0; + }, + set: function (n) { + }, + enumerable: true, + configurable: true + }); + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + Object.defineProperty(Foo2.prototype, "bar", { + get: function () { + return 0; // should be an error - can't coerce infered return type to match setter annotated type + }, + set: function (n) { + }, + enumerable: true, + configurable: true + }); + return Foo2; +})(); diff --git a/tests/baselines/reference/infinitelyExpandingOverloads.js b/tests/baselines/reference/infinitelyExpandingOverloads.js new file mode 100644 index 00000000000..1e84eba27cf --- /dev/null +++ b/tests/baselines/reference/infinitelyExpandingOverloads.js @@ -0,0 +1,52 @@ +//// [infinitelyExpandingOverloads.ts] +interface KnockoutSubscription2 { + target: KnockoutObservableBase2; +} +interface KnockoutObservableBase2 { + subscribe(callback: (newValue: T) => void, target?: any, topic?: string): KnockoutSubscription2; +} +interface ValidationPlacement2 { + initialize(validatable: Validatable2): void; +} +interface Validatable2 { + validators: KnockoutObservableBase2>; +} +class Validator2 { + private _subscription: KnockoutSubscription2; +} +class ViewModel { + public validationPlacements: Array> = new Array>(); +} +class Widget { + constructor(viewModelType: new () => ViewModel); // Shouldnt error on this overload + constructor(viewModelType: new () => ViewModel) { + } + public get options(): ViewModel { + return null; + } +} + +//// [infinitelyExpandingOverloads.js] +var Validator2 = (function () { + function Validator2() { + } + return Validator2; +})(); +var ViewModel = (function () { + function ViewModel() { + this.validationPlacements = new Array(); + } + return ViewModel; +})(); +var Widget = (function () { + function Widget(viewModelType) { + } + Object.defineProperty(Widget.prototype, "options", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + return Widget; +})(); diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js new file mode 100644 index 00000000000..d1eb53c4ec7 --- /dev/null +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -0,0 +1,56 @@ +//// [inheritanceMemberAccessorOverridingAccessor.ts] +class a { + get x() { + return "20"; + } + set x(aValue: string) { + + } +} + +class b extends a { + get x() { + return "20"; + } + set x(aValue: string) { + + } +} + +//// [inheritanceMemberAccessorOverridingAccessor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + Object.defineProperty(a.prototype, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b.prototype, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js new file mode 100644 index 00000000000..d234eb89582 --- /dev/null +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -0,0 +1,47 @@ +//// [inheritanceMemberAccessorOverridingMethod.ts] +class a { + x() { + return "20"; + } +} + +class b extends a { + get x() { + return "20"; + } + set x(aValue: string) { + + } +} + +//// [inheritanceMemberAccessorOverridingMethod.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + a.prototype.x = function () { + return "20"; + }; + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b.prototype, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js new file mode 100644 index 00000000000..b307f3bfedb --- /dev/null +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -0,0 +1,42 @@ +//// [inheritanceMemberAccessorOverridingProperty.ts] +class a { + x: string; +} + +class b extends a { + get x() { + return "20"; + } + set x(aValue: string) { + + } +} + +//// [inheritanceMemberAccessorOverridingProperty.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b.prototype, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js new file mode 100644 index 00000000000..e05ed9633cc --- /dev/null +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -0,0 +1,47 @@ +//// [inheritanceMemberFuncOverridingAccessor.ts] +class a { + get x() { + return "20"; + } + set x(aValue: string) { + + } +} + +class b extends a { + x() { + return "20"; + } +} + +//// [inheritanceMemberFuncOverridingAccessor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + Object.defineProperty(a.prototype, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + b.prototype.x = function () { + return "20"; + }; + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js new file mode 100644 index 00000000000..7d92b494416 --- /dev/null +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -0,0 +1,44 @@ +//// [inheritanceMemberPropertyOverridingAccessor.ts] +class a { + private __x: () => string; + get x() { + return this.__x; + } + set x(aValue: () => string) { + this.__x = aValue; + } +} + +class b extends a { + x: () => string; +} + +//// [inheritanceMemberPropertyOverridingAccessor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + Object.defineProperty(a.prototype, "x", { + get: function () { + return this.__x; + }, + set: function (aValue) { + this.__x = aValue; + }, + enumerable: true, + configurable: true + }); + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js new file mode 100644 index 00000000000..f7ed912d030 --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -0,0 +1,56 @@ +//// [inheritanceStaticAccessorOverridingAccessor.ts] +class a { + static get x() { + return "20"; + } + static set x(aValue: string) { + + } +} + +class b extends a { + static get x() { + return "20"; + } + static set x(aValue: string) { + + } +} + +//// [inheritanceStaticAccessorOverridingAccessor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + Object.defineProperty(a, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js new file mode 100644 index 00000000000..dbef001740e --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -0,0 +1,47 @@ +//// [inheritanceStaticAccessorOverridingMethod.ts] +class a { + static x() { + return "20"; + } +} + +class b extends a { + static get x() { + return "20"; + } + static set x(aValue: string) { + + } +} + +//// [inheritanceStaticAccessorOverridingMethod.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + a.x = function () { + return "20"; + }; + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js new file mode 100644 index 00000000000..3536ca8accb --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -0,0 +1,42 @@ +//// [inheritanceStaticAccessorOverridingProperty.ts] +class a { + static x: string; +} + +class b extends a { + static get x() { + return "20"; + } + static set x(aValue: string) { + + } +} + +//// [inheritanceStaticAccessorOverridingProperty.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + Object.defineProperty(b, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js new file mode 100644 index 00000000000..b3cc7d3461e --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -0,0 +1,47 @@ +//// [inheritanceStaticFuncOverridingAccessor.ts] +class a { + static get x() { + return "20"; + } + static set x(aValue: string) { + + } +} + +class b extends a { + static x() { + return "20"; + } +} + +//// [inheritanceStaticFuncOverridingAccessor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + Object.defineProperty(a, "x", { + get: function () { + return "20"; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + b.x = function () { + return "20"; + }; + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js new file mode 100644 index 00000000000..bb77561153e --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -0,0 +1,42 @@ +//// [inheritanceStaticFuncOverridingAccessorOfFuncType.ts] +class a { + static get x(): () => string { + return null; + } +} + +class b extends a { + static x() { + return "20"; + } +} + +//// [inheritanceStaticFuncOverridingAccessorOfFuncType.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + Object.defineProperty(a, "x", { + get: function () { + return null; + }, + enumerable: true, + configurable: true + }); + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + b.x = function () { + return "20"; + }; + return b; +})(a); diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js new file mode 100644 index 00000000000..da3a42eafe1 --- /dev/null +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -0,0 +1,42 @@ +//// [inheritanceStaticPropertyOverridingAccessor.ts] +class a { + static get x(): () => string { + return null;; + } + static set x(aValue: () => string) { + } +} + +class b extends a { + static x: () => string; +} + +//// [inheritanceStaticPropertyOverridingAccessor.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var a = (function () { + function a() { + } + Object.defineProperty(a, "x", { + get: function () { + return null; + ; + }, + set: function (aValue) { + }, + enumerable: true, + configurable: true + }); + return a; +})(); +var b = (function (_super) { + __extends(b, _super); + function b() { + _super.apply(this, arguments); + } + return b; +})(a); diff --git a/tests/baselines/reference/initializerReferencingConstructorLocals.js b/tests/baselines/reference/initializerReferencingConstructorLocals.js new file mode 100644 index 00000000000..f382b5b7010 --- /dev/null +++ b/tests/baselines/reference/initializerReferencingConstructorLocals.js @@ -0,0 +1,43 @@ +//// [initializerReferencingConstructorLocals.ts] +// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. + +class C { + a = z; // error + b: typeof z; // error + c = this.z; // error + d: typeof this.z; // error + constructor(x) { + z = 1; + } +} + +class D { + a = z; // error + b: typeof z; // error + c = this.z; // error + d: typeof this.z; // error + constructor(x: T) { + z = 1; + } +} + +//// [initializerReferencingConstructorLocals.js] +// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. +var C = (function () { + function C(x) { + this.a = z; // error + this.c = this.z; // error + this.d = this.z; // error + z = 1; + } + return C; +})(); +var D = (function () { + function D(x) { + this.a = z; // error + this.c = this.z; // error + this.d = this.z; // error + z = 1; + } + return D; +})(); diff --git a/tests/baselines/reference/initializerReferencingConstructorParameters.js b/tests/baselines/reference/initializerReferencingConstructorParameters.js new file mode 100644 index 00000000000..8314d5b7155 --- /dev/null +++ b/tests/baselines/reference/initializerReferencingConstructorParameters.js @@ -0,0 +1,58 @@ +//// [initializerReferencingConstructorParameters.ts] +// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. + +class C { + a = x; // error + b: typeof x; // error + constructor(x) { } +} + +class D { + a = x; // error + b: typeof x; // error + constructor(public x) { } +} + +class E { + a = this.x; // ok + b: typeof this.x; // error + constructor(public x) { } +} + +class F { + a = this.x; // ok + b = x; // error + constructor(public x: T) { } +} + +//// [initializerReferencingConstructorParameters.js] +// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor. +var C = (function () { + function C(x) { + this.a = x; // error + } + return C; +})(); +var D = (function () { + function D(x) { + this.x = x; + this.a = x; // error + } + return D; +})(); +var E = (function () { + function E(x) { + this.x = x; + this.a = this.x; // ok + this.b = this.x; // error + } + return E; +})(); +var F = (function () { + function F(x) { + this.x = x; + this.a = this.x; // ok + this.b = x; // error + } + return F; +})(); diff --git a/tests/baselines/reference/initializersInDeclarations.js b/tests/baselines/reference/initializersInDeclarations.js new file mode 100644 index 00000000000..0506c72fc56 --- /dev/null +++ b/tests/baselines/reference/initializersInDeclarations.js @@ -0,0 +1,23 @@ +//// [initializersInDeclarations.ts] + +// Errors: Initializers & statements in declaration file + +declare class Foo { + name = "test"; + "some prop" = 42; + fn(): boolean { + return false; + } +} + +declare var x = []; +declare var y = {}; + +declare module M1 { + while(true); + + export var v1 = () => false; +} + +//// [initializersInDeclarations.js] +// Errors: Initializers & statements in declaration file diff --git a/tests/baselines/reference/innerModExport1.js b/tests/baselines/reference/innerModExport1.js new file mode 100644 index 00000000000..d61e79f2396 --- /dev/null +++ b/tests/baselines/reference/innerModExport1.js @@ -0,0 +1,45 @@ +//// [innerModExport1.ts] +module Outer { + + // inner mod 1 + var non_export_var: number; + module { + var non_export_var = 0; + export var export_var = 1; + + function NonExportFunc() { return 0; } + + export function ExportFunc() { return 0; } + } + + export var outer_var_export = 0; + export function outerFuncExport() { return 0; } + +} + +Outer.ExportFunc(); + +//// [innerModExport1.js] +var Outer; +(function (Outer) { + // inner mod 1 + var non_export_var; + module; + { + var non_export_var = 0; + Outer.export_var = 1; + function NonExportFunc() { + return 0; + } + function ExportFunc() { + return 0; + } + Outer.ExportFunc = ExportFunc; + } + Outer.outer_var_export = 0; + function outerFuncExport() { + return 0; + } + Outer.outerFuncExport = outerFuncExport; +})(Outer || (Outer = {})); +Outer.ExportFunc(); diff --git a/tests/baselines/reference/innerModExport2.js b/tests/baselines/reference/innerModExport2.js new file mode 100644 index 00000000000..26399879e6d --- /dev/null +++ b/tests/baselines/reference/innerModExport2.js @@ -0,0 +1,47 @@ +//// [innerModExport2.ts] +module Outer { + + // inner mod 1 + var non_export_var: number; + module { + var non_export_var = 0; + export var export_var = 1; + + function NonExportFunc() { return 0; } + + export function ExportFunc() { return 0; } + } + var export_var: number; + + export var outer_var_export = 0; + export function outerFuncExport() { return 0; } + +} + +Outer.NonExportFunc(); + +//// [innerModExport2.js] +var Outer; +(function (Outer) { + // inner mod 1 + var non_export_var; + module; + { + var non_export_var = 0; + Outer.export_var = 1; + function NonExportFunc() { + return 0; + } + function ExportFunc() { + return 0; + } + Outer.ExportFunc = ExportFunc; + } + var export_var; + Outer.outer_var_export = 0; + function outerFuncExport() { + return 0; + } + Outer.outerFuncExport = outerFuncExport; +})(Outer || (Outer = {})); +Outer.NonExportFunc(); diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js new file mode 100644 index 00000000000..eca12f7b1ae --- /dev/null +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -0,0 +1,121 @@ +//// [instancePropertiesInheritedIntoClassType.ts] +module NonGeneric { + class C { + x: string; + get y() { + return 1; + } + set y(v) { } + fn() { return this; } + constructor(public a: number, private b: number) { } + } + + class D extends C { e: string; } + + var d = new D(1, 2); + var r = d.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = 4; + var r6 = d.y(); // error + +} + +module Generic { + class C { + x: T; + get y() { + return null; + } + set y(v: U) { } + fn() { return this; } + constructor(public a: T, private b: U) { } + } + + class D extends C { e: T; } + + var d = new D(1, ''); + var r = d.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = ''; + var r6 = d.y(); // error +} + +//// [instancePropertiesInheritedIntoClassType.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var NonGeneric; +(function (NonGeneric) { + var C = (function () { + function C(a, b) { + this.a = a; + this.b = b; + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + C.prototype.fn = function () { + return this; + }; + return C; + })(); + var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; + })(C); + var d = new D(1, 2); + var r = d.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = 4; + var r6 = d.y(); // error +})(NonGeneric || (NonGeneric = {})); +var Generic; +(function (Generic) { + var C = (function () { + function C(a, b) { + this.a = a; + this.b = b; + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return null; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + C.prototype.fn = function () { + return this; + }; + return C; + })(); + var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; + })(C); + var d = new D(1, ''); + var r = d.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = ''; + var r6 = d.y(); // error +})(Generic || (Generic = {})); diff --git a/tests/baselines/reference/instancePropertyInClassType.js b/tests/baselines/reference/instancePropertyInClassType.js new file mode 100644 index 00000000000..b2df44db6f0 --- /dev/null +++ b/tests/baselines/reference/instancePropertyInClassType.js @@ -0,0 +1,97 @@ +//// [instancePropertyInClassType.ts] +module NonGeneric { + class C { + x: string; + get y() { + return 1; + } + set y(v) { } + fn() { return this; } + constructor(public a: number, private b: number) { } + } + + var c = new C(1, 2); + var r = c.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = 4; + var r6 = c.y(); // error + +} + +module Generic { + class C { + x: T; + get y() { + return null; + } + set y(v: U) { } + fn() { return this; } + constructor(public a: T, private b: U) { } + } + + var c = new C(1, ''); + var r = c.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = ''; + var r6 = c.y(); // error +} + +//// [instancePropertyInClassType.js] +var NonGeneric; +(function (NonGeneric) { + var C = (function () { + function C(a, b) { + this.a = a; + this.b = b; + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return 1; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + C.prototype.fn = function () { + return this; + }; + return C; + })(); + var c = new C(1, 2); + var r = c.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = 4; + var r6 = c.y(); // error +})(NonGeneric || (NonGeneric = {})); +var Generic; +(function (Generic) { + var C = (function () { + function C(a, b) { + this.a = a; + this.b = b; + } + Object.defineProperty(C.prototype, "y", { + get: function () { + return null; + }, + set: function (v) { + }, + enumerable: true, + configurable: true + }); + C.prototype.fn = function () { + return this; + }; + return C; + })(); + var c = new C(1, ''); + var r = c.fn(); + var r2 = r.x; + var r3 = r.y; + r.y = ''; + var r6 = c.y(); // error +})(Generic || (Generic = {})); diff --git a/tests/baselines/reference/instanceofOperatorWithLHSIsObject.js b/tests/baselines/reference/instanceofOperatorWithLHSIsObject.js index 5ccf195cd88..c687027ae9b 100644 --- a/tests/baselines/reference/instanceofOperatorWithLHSIsObject.js +++ b/tests/baselines/reference/instanceofOperatorWithLHSIsObject.js @@ -7,10 +7,13 @@ var x2: Function; var a: {}; var b: Object; var c: C; +var d: string | C; var r1 = a instanceof x1; var r2 = b instanceof x2; -var r3 = c instanceof x1; +var r3 = c instanceof x1; +var r4 = d instanceof x1; + //// [instanceofOperatorWithLHSIsObject.js] var C = (function () { @@ -23,6 +26,8 @@ var x2; var a; var b; var c; +var d; var r1 = a instanceof x1; var r2 = b instanceof x2; var r3 = c instanceof x1; +var r4 = d instanceof x1; diff --git a/tests/baselines/reference/instanceofOperatorWithLHSIsObject.types b/tests/baselines/reference/instanceofOperatorWithLHSIsObject.types index 26aea98028e..9962a23dced 100644 --- a/tests/baselines/reference/instanceofOperatorWithLHSIsObject.types +++ b/tests/baselines/reference/instanceofOperatorWithLHSIsObject.types @@ -20,6 +20,10 @@ var c: C; >c : C >C : C +var d: string | C; +>d : string | C +>C : C + var r1 = a instanceof x1; >r1 : boolean >a instanceof x1 : boolean @@ -38,3 +42,9 @@ var r3 = c instanceof x1; >c : C >x1 : any +var r4 = d instanceof x1; +>r4 : boolean +>d instanceof x1 : boolean +>d : string | C +>x1 : any + diff --git a/tests/baselines/reference/instantiateTypeParameter.js b/tests/baselines/reference/instantiateTypeParameter.js new file mode 100644 index 00000000000..7dcf77366bc --- /dev/null +++ b/tests/baselines/reference/instantiateTypeParameter.js @@ -0,0 +1,7 @@ +//// [instantiateTypeParameter.ts] +interface Foo { + var x: T<>; +} + +//// [instantiateTypeParameter.js] +var x; diff --git a/tests/baselines/reference/intTypeCheck.errors.txt b/tests/baselines/reference/intTypeCheck.errors.txt index 237a4b8e7f2..bd8b2048045 100644 --- a/tests/baselines/reference/intTypeCheck.errors.txt +++ b/tests/baselines/reference/intTypeCheck.errors.txt @@ -1,91 +1,93 @@ -tests/cases/compiler/intTypeCheck.ts(83,5): error TS2386: Overload signatures must all be optional or required. -tests/cases/compiler/intTypeCheck.ts(97,5): error TS2322: Type 'Object' is not assignable to type 'i1'. +tests/cases/compiler/intTypeCheck.ts(35,6): error TS2304: Cannot find name 'p'. +tests/cases/compiler/intTypeCheck.ts(71,6): error TS2304: Cannot find name 'p'. +tests/cases/compiler/intTypeCheck.ts(85,5): error TS2386: Overload signatures must all be optional or required. +tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Object' is not assignable to type 'i1'. Property 'p' is missing in type 'Object'. -tests/cases/compiler/intTypeCheck.ts(98,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(99,5): error TS2322: Type 'Base' is not assignable to type 'i1'. +tests/cases/compiler/intTypeCheck.ts(100,16): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type 'Base' is not assignable to type 'i1'. Property 'p' is missing in type 'Base'. -tests/cases/compiler/intTypeCheck.ts(101,5): error TS2322: Type '() => void' is not assignable to type 'i1'. +tests/cases/compiler/intTypeCheck.ts(103,5): error TS2322: Type '() => void' is not assignable to type 'i1'. Property 'p' is missing in type '() => void'. -tests/cases/compiler/intTypeCheck.ts(104,5): error TS2322: Type 'boolean' is not assignable to type 'i1'. +tests/cases/compiler/intTypeCheck.ts(106,5): error TS2322: Type 'boolean' is not assignable to type 'i1'. Property 'p' is missing in type 'Boolean'. -tests/cases/compiler/intTypeCheck.ts(104,20): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(104,21): error TS2304: Cannot find name 'i1'. -tests/cases/compiler/intTypeCheck.ts(105,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(110,5): error TS2322: Type '{}' is not assignable to type 'i2'. -tests/cases/compiler/intTypeCheck.ts(111,5): error TS2322: Type 'Object' is not assignable to type 'i2'. -tests/cases/compiler/intTypeCheck.ts(112,17): error TS2350: Only a void function can be called with the 'new' keyword. -tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Base' is not assignable to type 'i2'. -tests/cases/compiler/intTypeCheck.ts(118,5): error TS2322: Type 'boolean' is not assignable to type 'i2'. -tests/cases/compiler/intTypeCheck.ts(118,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(118,22): error TS2304: Cannot find name 'i2'. -tests/cases/compiler/intTypeCheck.ts(119,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(124,5): error TS2322: Type '{}' is not assignable to type 'i3'. -tests/cases/compiler/intTypeCheck.ts(125,5): error TS2322: Type 'Object' is not assignable to type 'i3'. -tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Base' is not assignable to type 'i3'. -tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type '() => void' is not assignable to type 'i3'. -tests/cases/compiler/intTypeCheck.ts(132,5): error TS2322: Type 'boolean' is not assignable to type 'i3'. -tests/cases/compiler/intTypeCheck.ts(132,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(132,22): error TS2304: Cannot find name 'i3'. -tests/cases/compiler/intTypeCheck.ts(133,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(139,5): error TS2322: Type 'Object' is not assignable to type 'i4'. +tests/cases/compiler/intTypeCheck.ts(106,20): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(106,21): error TS2304: Cannot find name 'i1'. +tests/cases/compiler/intTypeCheck.ts(107,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(112,5): error TS2322: Type '{}' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(113,5): error TS2322: Type 'Object' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(114,17): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/compiler/intTypeCheck.ts(115,5): error TS2322: Type 'Base' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(120,5): error TS2322: Type 'boolean' is not assignable to type 'i2'. +tests/cases/compiler/intTypeCheck.ts(120,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(120,22): error TS2304: Cannot find name 'i2'. +tests/cases/compiler/intTypeCheck.ts(121,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(126,5): error TS2322: Type '{}' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(127,5): error TS2322: Type 'Object' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(129,5): error TS2322: Type 'Base' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(131,5): error TS2322: Type '() => void' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(134,5): error TS2322: Type 'boolean' is not assignable to type 'i3'. +tests/cases/compiler/intTypeCheck.ts(134,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(134,22): error TS2304: Cannot find name 'i3'. +tests/cases/compiler/intTypeCheck.ts(135,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(141,5): error TS2322: Type 'Object' is not assignable to type 'i4'. Index signature is missing in type 'Object'. -tests/cases/compiler/intTypeCheck.ts(140,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(141,5): error TS2322: Type 'Base' is not assignable to type 'i4'. +tests/cases/compiler/intTypeCheck.ts(142,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(143,5): error TS2322: Type 'Base' is not assignable to type 'i4'. Index signature is missing in type 'Base'. -tests/cases/compiler/intTypeCheck.ts(143,5): error TS2322: Type '() => void' is not assignable to type 'i4'. +tests/cases/compiler/intTypeCheck.ts(145,5): error TS2322: Type '() => void' is not assignable to type 'i4'. Index signature is missing in type '() => void'. -tests/cases/compiler/intTypeCheck.ts(146,5): error TS2322: Type 'boolean' is not assignable to type 'i4'. +tests/cases/compiler/intTypeCheck.ts(148,5): error TS2322: Type 'boolean' is not assignable to type 'i4'. Index signature is missing in type 'Boolean'. -tests/cases/compiler/intTypeCheck.ts(146,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(146,22): error TS2304: Cannot find name 'i4'. -tests/cases/compiler/intTypeCheck.ts(147,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(152,5): error TS2322: Type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }' is not assignable to type 'i5'. - Property 'p' is missing in type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }'. -tests/cases/compiler/intTypeCheck.ts(153,5): error TS2322: Type 'Object' is not assignable to type 'i5'. +tests/cases/compiler/intTypeCheck.ts(148,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(148,22): error TS2304: Cannot find name 'i4'. +tests/cases/compiler/intTypeCheck.ts(149,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(154,5): error TS2322: Type '{}' is not assignable to type 'i5'. + Property 'p' is missing in type '{}'. +tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Object' is not assignable to type 'i5'. Property 'p' is missing in type 'Object'. -tests/cases/compiler/intTypeCheck.ts(154,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(155,5): error TS2322: Type 'Base' is not assignable to type 'i5'. +tests/cases/compiler/intTypeCheck.ts(156,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type 'Base' is not assignable to type 'i5'. Property 'p' is missing in type 'Base'. -tests/cases/compiler/intTypeCheck.ts(157,5): error TS2322: Type '() => void' is not assignable to type 'i5'. +tests/cases/compiler/intTypeCheck.ts(159,5): error TS2322: Type '() => void' is not assignable to type 'i5'. Property 'p' is missing in type '() => void'. -tests/cases/compiler/intTypeCheck.ts(160,5): error TS2322: Type 'boolean' is not assignable to type 'i5'. +tests/cases/compiler/intTypeCheck.ts(162,5): error TS2322: Type 'boolean' is not assignable to type 'i5'. Property 'p' is missing in type 'Boolean'. -tests/cases/compiler/intTypeCheck.ts(160,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(160,22): error TS2304: Cannot find name 'i5'. -tests/cases/compiler/intTypeCheck.ts(161,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(166,5): error TS2322: Type '{}' is not assignable to type 'i6'. -tests/cases/compiler/intTypeCheck.ts(167,5): error TS2322: Type 'Object' is not assignable to type 'i6'. -tests/cases/compiler/intTypeCheck.ts(168,17): error TS2350: Only a void function can be called with the 'new' keyword. -tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Base' is not assignable to type 'i6'. -tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type '() => void' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(162,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(162,22): error TS2304: Cannot find name 'i5'. +tests/cases/compiler/intTypeCheck.ts(163,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(168,5): error TS2322: Type '{}' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(169,5): error TS2322: Type 'Object' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(170,17): error TS2350: Only a void function can be called with the 'new' keyword. +tests/cases/compiler/intTypeCheck.ts(171,5): error TS2322: Type 'Base' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(173,5): error TS2322: Type '() => void' is not assignable to type 'i6'. Type 'void' is not assignable to type 'number'. -tests/cases/compiler/intTypeCheck.ts(174,5): error TS2322: Type 'boolean' is not assignable to type 'i6'. -tests/cases/compiler/intTypeCheck.ts(174,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(174,22): error TS2304: Cannot find name 'i6'. -tests/cases/compiler/intTypeCheck.ts(175,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(180,5): error TS2322: Type '{}' is not assignable to type 'i7'. -tests/cases/compiler/intTypeCheck.ts(181,5): error TS2322: Type 'Object' is not assignable to type 'i7'. -tests/cases/compiler/intTypeCheck.ts(183,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. -tests/cases/compiler/intTypeCheck.ts(185,5): error TS2322: Type '() => void' is not assignable to type 'i7'. -tests/cases/compiler/intTypeCheck.ts(188,5): error TS2322: Type 'boolean' is not assignable to type 'i7'. -tests/cases/compiler/intTypeCheck.ts(188,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(188,22): error TS2304: Cannot find name 'i7'. -tests/cases/compiler/intTypeCheck.ts(189,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(195,5): error TS2322: Type 'Object' is not assignable to type 'i8'. +tests/cases/compiler/intTypeCheck.ts(176,5): error TS2322: Type 'boolean' is not assignable to type 'i6'. +tests/cases/compiler/intTypeCheck.ts(176,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(176,22): error TS2304: Cannot find name 'i6'. +tests/cases/compiler/intTypeCheck.ts(177,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(182,5): error TS2322: Type '{}' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(183,5): error TS2322: Type 'Object' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(185,17): error TS2352: Neither type 'Base' nor type 'i7' is assignable to the other. +tests/cases/compiler/intTypeCheck.ts(187,5): error TS2322: Type '() => void' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(190,5): error TS2322: Type 'boolean' is not assignable to type 'i7'. +tests/cases/compiler/intTypeCheck.ts(190,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(190,22): error TS2304: Cannot find name 'i7'. +tests/cases/compiler/intTypeCheck.ts(191,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(197,5): error TS2322: Type 'Object' is not assignable to type 'i8'. Index signature is missing in type 'Object'. -tests/cases/compiler/intTypeCheck.ts(196,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/compiler/intTypeCheck.ts(197,5): error TS2322: Type 'Base' is not assignable to type 'i8'. +tests/cases/compiler/intTypeCheck.ts(198,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(199,5): error TS2322: Type 'Base' is not assignable to type 'i8'. Index signature is missing in type 'Base'. -tests/cases/compiler/intTypeCheck.ts(199,5): error TS2322: Type '() => void' is not assignable to type 'i8'. +tests/cases/compiler/intTypeCheck.ts(201,5): error TS2322: Type '() => void' is not assignable to type 'i8'. Index signature is missing in type '() => void'. -tests/cases/compiler/intTypeCheck.ts(202,5): error TS2322: Type 'boolean' is not assignable to type 'i8'. +tests/cases/compiler/intTypeCheck.ts(204,5): error TS2322: Type 'boolean' is not assignable to type 'i8'. Index signature is missing in type 'Boolean'. -tests/cases/compiler/intTypeCheck.ts(202,21): error TS1109: Expression expected. -tests/cases/compiler/intTypeCheck.ts(202,22): error TS2304: Cannot find name 'i8'. -tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/compiler/intTypeCheck.ts(204,21): error TS1109: Expression expected. +tests/cases/compiler/intTypeCheck.ts(204,22): error TS2304: Cannot find name 'i8'. +tests/cases/compiler/intTypeCheck.ts(205,17): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -==== tests/cases/compiler/intTypeCheck.ts (67 errors) ==== +==== tests/cases/compiler/intTypeCheck.ts (69 errors) ==== interface i1 { //Property Signatures p; @@ -119,8 +121,11 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit new (p6: string, ...p7: any[]); } interface i4 { - //Index Signatures + // Used to be indexer, now it is a computed property [p]; + ~ +!!! error TS2304: Cannot find name 'p'. + //Index Signatures [p1: string]; [p2: string, p3: number]; } @@ -153,9 +158,12 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit new (...p3: any[]); new (p4: string, p5?: string); new (p6: string, ...p7: any[]); - - //Index Signatures + + // Used to be indexer, now it is a computed property [p]; + ~ +!!! error TS2304: Cannot find name 'p'. + //Index Signatures [p1: string]; [p2: string, p3: number]; @@ -313,8 +321,8 @@ tests/cases/compiler/intTypeCheck.ts(203,17): error TS2351: Cannot use 'new' wit var obj44: i5; var obj45: i5 = {}; ~~~~~ -!!! error TS2322: Type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }' is not assignable to type 'i5'. -!!! error TS2322: Property 'p' is missing in type '{ p1?: any; p2?: string; p4?(): any; p5?(): void; p7?(pa1: any, pa2: any): void; }'. +!!! error TS2322: Type '{}' is not assignable to type 'i5'. +!!! error TS2322: Property 'p' is missing in type '{}'. var obj46: i5 = new Object(); ~~~~~ !!! error TS2322: Type 'Object' is not assignable to type 'i5'. diff --git a/tests/baselines/reference/intTypeCheck.js b/tests/baselines/reference/intTypeCheck.js new file mode 100644 index 00000000000..41f648610b5 --- /dev/null +++ b/tests/baselines/reference/intTypeCheck.js @@ -0,0 +1,348 @@ +//// [intTypeCheck.ts] +interface i1 { + //Property Signatures + p; + p1?; + p2?: string; + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7? (pa1, pa2): void; +} +interface i2 { + //Call Signatures + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); +} +interface i3 { + //Construct Signatures + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); +} +interface i4 { + // Used to be indexer, now it is a computed property + [p]; + //Index Signatures + [p1: string]; + [p2: string, p3: number]; +} +interface i5 extends i1 { } +interface i6 extends i2 { } +interface i7 extends i3 { } +interface i8 extends i4 { } +interface i9 { } + +class Base { foo() { } } + +interface i11 { + //Call Signatures + (); + (): number; + (p); + (p1: string); + (p2?: string); + (...p3: any[]); + (p4: string, p5?: string); + (p6: string, ...p7: any[]); + //(p8?: string, ...p9: any[]); + //(p10:string, p8?: string, ...p9: any[]); + + //Construct Signatures + new (); + new (): number; + new (p: string); + new (p2?: string); + new (...p3: any[]); + new (p4: string, p5?: string); + new (p6: string, ...p7: any[]); + + // Used to be indexer, now it is a computed property + [p]; + //Index Signatures + [p1: string]; + [p2: string, p3: number]; + + //Property Signatures + p; + p1?; + p2?: string; + p3(); + p4? (); + p5? (): void; + p6(pa1): void; + p7(pa1, pa2): void; + p7? (pa1, pa2): void; +} + +var anyVar: any; +// +// Property signatures +// +var obj0: i1; +var obj1: i1 = { + p: null, + p3: function ():any { return 0; }, + p6: function (pa1):any { return 0; }, + p7: function (pa1, pa2):any { return 0; } +}; +var obj2: i1 = new Object(); +var obj3: i1 = new obj0; +var obj4: i1 = new Base; +var obj5: i1 = null; +var obj6: i1 = function () { }; +//var obj7: i1 = function foo() { }; +var obj8: i1 = anyVar; +var obj9: i1 = new anyVar; +var obj10: i1 = new {}; +// +// Call signatures +// +var obj11: i2; +var obj12: i2 = {}; +var obj13: i2 = new Object(); +var obj14: i2 = new obj11; +var obj15: i2 = new Base; +var obj16: i2 = null; +var obj17: i2 = function ():any { return 0; }; +//var obj18: i2 = function foo() { }; +var obj19: i2 = anyVar; +var obj20: i2 = new anyVar; +var obj21: i2 = new {}; +// +// Construct Signatures +// +var obj22: i3; +var obj23: i3 = {}; +var obj24: i3 = new Object(); +var obj25: i3 = new obj22; +var obj26: i3 = new Base; +var obj27: i3 = null; +var obj28: i3 = function () { }; +//var obj29: i3 = function foo() { }; +var obj30: i3 = anyVar; +var obj31: i3 = new anyVar; +var obj32: i3 = new {}; +// +// Index Signatures +// +var obj33: i4; +var obj34: i4 = {}; +var obj35: i4 = new Object(); +var obj36: i4 = new obj33; +var obj37: i4 = new Base; +var obj38: i4 = null; +var obj39: i4 = function () { }; +//var obj40: i4 = function foo() { }; +var obj41: i4 = anyVar; +var obj42: i4 = new anyVar; +var obj43: i4 = new {}; +// +// Interface Derived I1 +// +var obj44: i5; +var obj45: i5 = {}; +var obj46: i5 = new Object(); +var obj47: i5 = new obj44; +var obj48: i5 = new Base; +var obj49: i5 = null; +var obj50: i5 = function () { }; +//var obj51: i5 = function foo() { }; +var obj52: i5 = anyVar; +var obj53: i5 = new anyVar; +var obj54: i5 = new {}; +// +// Interface Derived I2 +// +var obj55: i6; +var obj56: i6 = {}; +var obj57: i6 = new Object(); +var obj58: i6 = new obj55; +var obj59: i6 = new Base; +var obj60: i6 = null; +var obj61: i6 = function () { }; +//var obj62: i6 = function foo() { }; +var obj63: i6 = anyVar; +var obj64: i6 = new anyVar; +var obj65: i6 = new {}; +// +// Interface Derived I3 +// +var obj66: i7; +var obj67: i7 = {}; +var obj68: i7 = new Object(); +var obj69: i7 = new obj66; +var obj70: i7 = new Base; +var obj71: i7 = null; +var obj72: i7 = function () { }; +//var obj73: i7 = function foo() { }; +var obj74: i7 = anyVar; +var obj75: i7 = new anyVar; +var obj76: i7 = new {}; +// +// Interface Derived I4 +// +var obj77: i8; +var obj78: i8 = {}; +var obj79: i8 = new Object(); +var obj80: i8 = new obj77; +var obj81: i8 = new Base; +var obj82: i8 = null; +var obj83: i8 = function () { }; +//var obj84: i8 = function foo() { }; +var obj85: i8 = anyVar; +var obj86: i8 = new anyVar; +var obj87: i8 = new {}; + +//// [intTypeCheck.js] +var Base = (function () { + function Base() { + } + Base.prototype.foo = function () { + }; + return Base; +})(); +var anyVar; +// +// Property signatures +// +var obj0; +var obj1 = { + p: null, + p3: function () { + return 0; + }, + p6: function (pa1) { + return 0; + }, + p7: function (pa1, pa2) { + return 0; + } +}; +var obj2 = new Object(); +var obj3 = new obj0; +var obj4 = new Base; +var obj5 = null; +var obj6 = function () { +}; +//var obj7: i1 = function foo() { }; +var obj8 = anyVar; +var obj9 = new < i1 > anyVar; +var obj10 = new {}; +// +// Call signatures +// +var obj11; +var obj12 = {}; +var obj13 = new Object(); +var obj14 = new obj11; +var obj15 = new Base; +var obj16 = null; +var obj17 = function () { + return 0; +}; +//var obj18: i2 = function foo() { }; +var obj19 = anyVar; +var obj20 = new < i2 > anyVar; +var obj21 = new {}; +// +// Construct Signatures +// +var obj22; +var obj23 = {}; +var obj24 = new Object(); +var obj25 = new obj22; +var obj26 = new Base; +var obj27 = null; +var obj28 = function () { +}; +//var obj29: i3 = function foo() { }; +var obj30 = anyVar; +var obj31 = new < i3 > anyVar; +var obj32 = new {}; +// +// Index Signatures +// +var obj33; +var obj34 = {}; +var obj35 = new Object(); +var obj36 = new obj33; +var obj37 = new Base; +var obj38 = null; +var obj39 = function () { +}; +//var obj40: i4 = function foo() { }; +var obj41 = anyVar; +var obj42 = new < i4 > anyVar; +var obj43 = new {}; +// +// Interface Derived I1 +// +var obj44; +var obj45 = {}; +var obj46 = new Object(); +var obj47 = new obj44; +var obj48 = new Base; +var obj49 = null; +var obj50 = function () { +}; +//var obj51: i5 = function foo() { }; +var obj52 = anyVar; +var obj53 = new < i5 > anyVar; +var obj54 = new {}; +// +// Interface Derived I2 +// +var obj55; +var obj56 = {}; +var obj57 = new Object(); +var obj58 = new obj55; +var obj59 = new Base; +var obj60 = null; +var obj61 = function () { +}; +//var obj62: i6 = function foo() { }; +var obj63 = anyVar; +var obj64 = new < i6 > anyVar; +var obj65 = new {}; +// +// Interface Derived I3 +// +var obj66; +var obj67 = {}; +var obj68 = new Object(); +var obj69 = new obj66; +var obj70 = new Base; +var obj71 = null; +var obj72 = function () { +}; +//var obj73: i7 = function foo() { }; +var obj74 = anyVar; +var obj75 = new < i7 > anyVar; +var obj76 = new {}; +// +// Interface Derived I4 +// +var obj77; +var obj78 = {}; +var obj79 = new Object(); +var obj80 = new obj77; +var obj81 = new Base; +var obj82 = null; +var obj83 = function () { +}; +//var obj84: i8 = function foo() { }; +var obj85 = anyVar; +var obj86 = new < i8 > anyVar; +var obj87 = new {}; diff --git a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt index 35cf2df71ff..425aa3b3e97 100644 --- a/tests/baselines/reference/interfaceAssignmentCompat.errors.txt +++ b/tests/baselines/reference/interfaceAssignmentCompat.errors.txt @@ -1,6 +1,9 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(32,18): error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. + Types of parameters 'a' and 'a' are incompatible. + Type 'IFrenchEye' is not assignable to type 'IEye'. tests/cases/compiler/interfaceAssignmentCompat.ts(37,29): error TS2339: Property '_map' does not exist on type 'typeof Color'. tests/cases/compiler/interfaceAssignmentCompat.ts(42,13): error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. + Property 'coleur' is missing in type 'IEye'. tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEye[]' is not assignable to type 'IFrenchEye[]'. Type 'IEye' is not assignable to type 'IFrenchEye'. @@ -40,6 +43,8 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy x=x.sort(CompareYeux); // parameter mismatch ~~~~~~~~~~~ !!! error TS2345: Argument of type '(a: IFrenchEye, b: IFrenchEye) => number' is not assignable to parameter of type '(a: IEye, b: IEye) => number'. +!!! error TS2345: Types of parameters 'a' and 'a' are incompatible. +!!! error TS2345: Type 'IFrenchEye' is not assignable to type 'IEye'. // type of z inferred from specialized array type var z=x.sort(CompareEyes); // ok @@ -54,6 +59,7 @@ tests/cases/compiler/interfaceAssignmentCompat.ts(44,9): error TS2322: Type 'IEy eeks[j]=z[j]; // nope: element assignment ~~~~~~~ !!! error TS2322: Type 'IEye' is not assignable to type 'IFrenchEye'. +!!! error TS2322: Property 'coleur' is missing in type 'IEye'. } eeks=z; // nope: array assignment ~~~~ diff --git a/tests/baselines/reference/interfaceContextualType.types b/tests/baselines/reference/interfaceContextualType.types index 412a48cfbda..3078ecfdfa4 100644 --- a/tests/baselines/reference/interfaceContextualType.types +++ b/tests/baselines/reference/interfaceContextualType.types @@ -34,27 +34,27 @@ class Bug { >{} : { [x: string]: undefined; } this.values['comments'] = { italic: true }; ->this.values['comments'] = { italic: true } : { italic: boolean; bold?: boolean; } +>this.values['comments'] = { italic: true } : { italic: boolean; } >this.values['comments'] : IOptions >this.values : IMap >this : Bug >values : IMap ->{ italic: true } : { italic: boolean; bold?: boolean; } +>{ italic: true } : { italic: boolean; } >italic : boolean } shouldBeOK() { >shouldBeOK : () => void this.values = { ->this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; bold?: boolean; }; comments: { italic: boolean; bold?: boolean; }; } +>this.values = { comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; } >this.values : IMap >this : Bug >values : IMap ->{ comments: { italic: true } } : { [x: string]: { italic: boolean; bold?: boolean; }; comments: { italic: boolean; bold?: boolean; }; } +>{ comments: { italic: true } } : { [x: string]: { italic: boolean; }; comments: { italic: boolean; }; } comments: { italic: true } ->comments : { italic: boolean; bold?: boolean; } ->{ italic: true } : { italic: boolean; bold?: boolean; } +>comments : { italic: boolean; } +>{ italic: true } : { italic: boolean; } >italic : boolean }; diff --git a/tests/baselines/reference/interfaceDeclaration4.js b/tests/baselines/reference/interfaceDeclaration4.js new file mode 100644 index 00000000000..576479c2beb --- /dev/null +++ b/tests/baselines/reference/interfaceDeclaration4.js @@ -0,0 +1,73 @@ +//// [interfaceDeclaration4.ts] +// Import this module when test harness supports external modules. Also remove the internal module below. +// import Foo = require("interfaceDeclaration5") +module Foo { + export interface I1 { item: string; } + export class C1 { } +} + +class C1 implements Foo.I1 { + public item:string; +} + +// Allowed +interface I2 extends Foo.I1 { + item:string; +} + +// Negative Case +interface I3 extends Foo.I1 { + item:number; +} + +interface I4 extends Foo.I1 { + token:string; +} + +// Err - not implemented item +class C2 implements I4 { + public token: string; +} + +interface I5 extends Foo { } + +// Negative case +interface I6 extends Foo.C1 { } + +class C3 implements Foo.I1 { } + +// Negative case +interface Foo.I1 { } + + +//// [interfaceDeclaration4.js] +// Import this module when test harness supports external modules. Also remove the internal module below. +// import Foo = require("interfaceDeclaration5") +var Foo; +(function (Foo) { + var C1 = (function () { + function C1() { + } + return C1; + })(); + Foo.C1 = C1; +})(Foo || (Foo = {})); +var C1 = (function () { + function C1() { + } + return C1; +})(); +// Err - not implemented item +var C2 = (function () { + function C2() { + } + return C2; +})(); +var C3 = (function () { + function C3() { + } + return C3; +})(); +I1; +{ +} diff --git a/tests/baselines/reference/interfaceExtendingClass.js b/tests/baselines/reference/interfaceExtendingClass.js new file mode 100644 index 00000000000..39db7460915 --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClass.js @@ -0,0 +1,42 @@ +//// [interfaceExtendingClass.ts] +class Foo { + x: string; + y() { } + get Z() { + return 1; + } + [x: string]: Object; +} + +interface I extends Foo { +} + +var i: I; +var r1 = i.x; +var r2 = i.y(); +var r3 = i.Z; + +var f: Foo = i; +i = f; + +//// [interfaceExtendingClass.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.y = function () { + }; + Object.defineProperty(Foo.prototype, "Z", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return Foo; +})(); +var i; +var r1 = i.x; +var r2 = i.y(); +var r3 = i.Z; +var f = i; +i = f; diff --git a/tests/baselines/reference/interfaceExtendingClass2.js b/tests/baselines/reference/interfaceExtendingClass2.js new file mode 100644 index 00000000000..b0958717aa8 --- /dev/null +++ b/tests/baselines/reference/interfaceExtendingClass2.js @@ -0,0 +1,34 @@ +//// [interfaceExtendingClass2.ts] +class Foo { + x: string; + y() { } + get Z() { + return 1; + } + [x: string]: Object; +} + +interface I2 extends Foo { // error + a: { + toString: () => { + return 1; + }; + } + +//// [interfaceExtendingClass2.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.y = function () { + }; + Object.defineProperty(Foo.prototype, "Z", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return Foo; +})(); +return 1; +; diff --git a/tests/baselines/reference/interfaceImplementation5.js b/tests/baselines/reference/interfaceImplementation5.js new file mode 100644 index 00000000000..667c5f045ec --- /dev/null +++ b/tests/baselines/reference/interfaceImplementation5.js @@ -0,0 +1,110 @@ +//// [interfaceImplementation5.ts] +interface I1 { + getset1:number; +} + +class C1 implements I1 { + public get getset1(){return 1;} +} + +class C2 implements I1 { + public set getset1(baz:number){} +} + +class C3 implements I1 { + public get getset1(){return 1;} + public set getset1(baz:number){} +} + +class C4 implements I1 { + public get getset1(){var x:any; return x;} +} + +class C5 implements I1 { + public set getset1(baz:any){} +} + +class C6 implements I1 { + public set getset1(baz:any){} + public get getset1(){var x:any; return x;} +} + + + +//// [interfaceImplementation5.js] +var C1 = (function () { + function C1() { + } + Object.defineProperty(C1.prototype, "getset1", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C1; +})(); +var C2 = (function () { + function C2() { + } + Object.defineProperty(C2.prototype, "getset1", { + set: function (baz) { + }, + enumerable: true, + configurable: true + }); + return C2; +})(); +var C3 = (function () { + function C3() { + } + Object.defineProperty(C3.prototype, "getset1", { + get: function () { + return 1; + }, + set: function (baz) { + }, + enumerable: true, + configurable: true + }); + return C3; +})(); +var C4 = (function () { + function C4() { + } + Object.defineProperty(C4.prototype, "getset1", { + get: function () { + var x; + return x; + }, + enumerable: true, + configurable: true + }); + return C4; +})(); +var C5 = (function () { + function C5() { + } + Object.defineProperty(C5.prototype, "getset1", { + set: function (baz) { + }, + enumerable: true, + configurable: true + }); + return C5; +})(); +var C6 = (function () { + function C6() { + } + Object.defineProperty(C6.prototype, "getset1", { + get: function () { + var x; + return x; + }, + set: function (baz) { + }, + enumerable: true, + configurable: true + }); + return C6; +})(); diff --git a/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.js b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.js new file mode 100644 index 00000000000..a283722d6ad --- /dev/null +++ b/tests/baselines/reference/interfaceMayNotBeExtendedWitACall.js @@ -0,0 +1,11 @@ +//// [interfaceMayNotBeExtendedWitACall.ts] +interface color {} + +interface blue extends color() { // error + +} + + +//// [interfaceMayNotBeExtendedWitACall.js] +(function () { +}); diff --git a/tests/baselines/reference/interfaceNaming1.js b/tests/baselines/reference/interfaceNaming1.js new file mode 100644 index 00000000000..e16f186379b --- /dev/null +++ b/tests/baselines/reference/interfaceNaming1.js @@ -0,0 +1,11 @@ +//// [interfaceNaming1.ts] +interface { } +interface interface{ } +interface & { } + + +//// [interfaceNaming1.js] +interface; +{ +} +interface & {}; diff --git a/tests/baselines/reference/interfaceThatInheritsFromItself.js b/tests/baselines/reference/interfaceThatInheritsFromItself.js new file mode 100644 index 00000000000..59794dc40c7 --- /dev/null +++ b/tests/baselines/reference/interfaceThatInheritsFromItself.js @@ -0,0 +1,16 @@ +//// [interfaceThatInheritsFromItself.ts] +interface Foo extends Foo { // error +} + +interface Foo2 extends Foo2 { // error +} + +interface Foo3 extends Foo3 { // error +} + +interface Bar implements Bar { // error +} + + + +//// [interfaceThatInheritsFromItself.js] diff --git a/tests/baselines/reference/interfaceWithAccessibilityModifiers.js b/tests/baselines/reference/interfaceWithAccessibilityModifiers.js new file mode 100644 index 00000000000..bd29d319466 --- /dev/null +++ b/tests/baselines/reference/interfaceWithAccessibilityModifiers.js @@ -0,0 +1,9 @@ +//// [interfaceWithAccessibilityModifiers.ts] +// Errors +interface Foo { + public a: any; + private b: any; + protected c: any; +} + +//// [interfaceWithAccessibilityModifiers.js] diff --git a/tests/baselines/reference/interfaceWithImplements1.js b/tests/baselines/reference/interfaceWithImplements1.js new file mode 100644 index 00000000000..bc8ccba8192 --- /dev/null +++ b/tests/baselines/reference/interfaceWithImplements1.js @@ -0,0 +1,7 @@ +//// [interfaceWithImplements1.ts] +interface IFoo { } + +interface IBar implements IFoo { +} + +//// [interfaceWithImplements1.js] diff --git a/tests/baselines/reference/interfaceWithPrivateMember.js b/tests/baselines/reference/interfaceWithPrivateMember.js new file mode 100644 index 00000000000..24c2cf9ecf5 --- /dev/null +++ b/tests/baselines/reference/interfaceWithPrivateMember.js @@ -0,0 +1,19 @@ +//// [interfaceWithPrivateMember.ts] +// interfaces do not permit private members, these are errors + +interface I { + private x: string; +} + +interface I2 { + private y: T; +} + +var x: { + private y: string; +} + +//// [interfaceWithPrivateMember.js] +// interfaces do not permit private members, these are errors +var x; +y: string; diff --git a/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.js b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.js new file mode 100644 index 00000000000..b79dfc12a04 --- /dev/null +++ b/tests/baselines/reference/interfacesWithPredefinedTypesAsNames.js @@ -0,0 +1,9 @@ +//// [interfacesWithPredefinedTypesAsNames.ts] +interface any { } +interface number { } +interface string { } +interface boolean { } +interface void {} + +//// [interfacesWithPredefinedTypesAsNames.js] +void {}; diff --git a/tests/baselines/reference/intrinsics.errors.txt b/tests/baselines/reference/intrinsics.errors.txt index e9529d4b9f0..342b84e02b9 100644 --- a/tests/baselines/reference/intrinsics.errors.txt +++ b/tests/baselines/reference/intrinsics.errors.txt @@ -1,12 +1,15 @@ tests/cases/compiler/intrinsics.ts(2,21): error TS2304: Cannot find name 'hasOwnProperty'. +tests/cases/compiler/intrinsics.ts(2,21): error TS4025: Exported variable 'hasOwnProperty' has or is using private name 'hasOwnProperty'. tests/cases/compiler/intrinsics.ts(11,1): error TS2304: Cannot find name '__proto__'. -==== tests/cases/compiler/intrinsics.ts (2 errors) ==== +==== tests/cases/compiler/intrinsics.ts (3 errors) ==== var hasOwnProperty: hasOwnProperty; // Error ~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'hasOwnProperty'. + ~~~~~~~~~~~~~~ +!!! error TS4025: Exported variable 'hasOwnProperty' has or is using private name 'hasOwnProperty'. module m1 { export var __proto__; diff --git a/tests/baselines/reference/invalidBinaryIntegerLiteralAndOctalIntegerLiteral.js b/tests/baselines/reference/invalidBinaryIntegerLiteralAndOctalIntegerLiteral.js new file mode 100644 index 00000000000..a46af16763d --- /dev/null +++ b/tests/baselines/reference/invalidBinaryIntegerLiteralAndOctalIntegerLiteral.js @@ -0,0 +1,17 @@ +//// [invalidBinaryIntegerLiteralAndOctalIntegerLiteral.ts] +// Error +var binary = 0b21010; +var binary1 = 0B21010; +var octal = 0o81010; +var octal = 0O91010; + +//// [invalidBinaryIntegerLiteralAndOctalIntegerLiteral.js] +// Error +var binary = 0; +21010; +var binary1 = 0; +21010; +var octal = 0; +81010; +var octal = 0; +91010; diff --git a/tests/baselines/reference/invalidDoWhileBreakStatements.js b/tests/baselines/reference/invalidDoWhileBreakStatements.js new file mode 100644 index 00000000000..e6617ef98cd --- /dev/null +++ b/tests/baselines/reference/invalidDoWhileBreakStatements.js @@ -0,0 +1,70 @@ +//// [invalidDoWhileBreakStatements.ts] +// All errors + +// naked break not allowed +break; + +// non-existent label +ONE: +do break TWO; while (true) + +// break from inside function +TWO: +do { + var x = () => { + break TWO; + } +}while (true) + +THREE: +do { + var fn = function () { + break THREE; + } +}while (true) + +// break forward +do { + break FIVE; + FIVE: + do { } while (true) +}while (true) + +// label on non-loop statement +NINE: +var y = 12; + +do { + break NINE; +}while (true) + +//// [invalidDoWhileBreakStatements.js] +// All errors +// naked break not allowed +break; +// non-existent label +ONE: do + break TWO; +while (true); +// break from inside function +TWO: do { + var x = function () { + break TWO; + }; +} while (true); +THREE: do { + var fn = function () { + break THREE; + }; +} while (true); +// break forward +do { + break FIVE; + FIVE: do { + } while (true); +} while (true); +// label on non-loop statement +NINE: var y = 12; +do { + break NINE; +} while (true); diff --git a/tests/baselines/reference/invalidDoWhileContinueStatements.js b/tests/baselines/reference/invalidDoWhileContinueStatements.js new file mode 100644 index 00000000000..d32ccfe0074 --- /dev/null +++ b/tests/baselines/reference/invalidDoWhileContinueStatements.js @@ -0,0 +1,70 @@ +//// [invalidDoWhileContinueStatements.ts] +// All errors + +// naked continue not allowed +continue; + +// non-existent label +ONE: +do continue TWO; while (true) + +// continue from inside function +TWO: +do { + var x = () => { + continue TWO; + } +}while (true) + +THREE: +do { + var fn = function () { + continue THREE; + } +}while (true) + +// continue forward +do { + continue FIVE; + FIVE: + do { } while (true) +}while (true) + +// label on non-loop statement +NINE: +var y = 12; + +do { + continue NINE; +}while (true) + +//// [invalidDoWhileContinueStatements.js] +// All errors +// naked continue not allowed +continue; +// non-existent label +ONE: do + continue TWO; +while (true); +// continue from inside function +TWO: do { + var x = function () { + continue TWO; + }; +} while (true); +THREE: do { + var fn = function () { + continue THREE; + }; +} while (true); +// continue forward +do { + continue FIVE; + FIVE: do { + } while (true); +} while (true); +// label on non-loop statement +NINE: var y = 12; +do { + continue NINE; +} while (true); diff --git a/tests/baselines/reference/invalidForBreakStatements.js b/tests/baselines/reference/invalidForBreakStatements.js new file mode 100644 index 00000000000..abcd078ff2d --- /dev/null +++ b/tests/baselines/reference/invalidForBreakStatements.js @@ -0,0 +1,68 @@ +//// [invalidForBreakStatements.ts] +// All errors + +// naked break not allowed +break; + +// non-existent label +ONE: +for(;;) break TWO; + +// break from inside function +TWO: +for(;;) { + var x = () => { + break TWO; + } +} + +THREE: +for(;;) { + var fn = function () { + break THREE; + } +} + +// break forward +for(;;) { + break FIVE; + FIVE: + for (; ;) { } +} +// label on non-loop statement +NINE: +var y = 12; + +for(;;) { + break NINE; +} + +//// [invalidForBreakStatements.js] +// All errors +// naked break not allowed +break; +// non-existent label +ONE: for (;;) + break TWO; +// break from inside function +TWO: for (;;) { + var x = function () { + break TWO; + }; +} +THREE: for (;;) { + var fn = function () { + break THREE; + }; +} +// break forward +for (;;) { + break FIVE; + FIVE: for (;;) { + } +} +// label on non-loop statement +NINE: var y = 12; +for (;;) { + break NINE; +} diff --git a/tests/baselines/reference/invalidForContinueStatements.js b/tests/baselines/reference/invalidForContinueStatements.js new file mode 100644 index 00000000000..af0eba2a59a --- /dev/null +++ b/tests/baselines/reference/invalidForContinueStatements.js @@ -0,0 +1,68 @@ +//// [invalidForContinueStatements.ts] +// All errors + +// naked continue not allowed +continue; + +// non-existent label +ONE: +for(;;) continue TWO; + +// continue from inside function +TWO: +for(;;) { + var x = () => { + continue TWO; + } +} + +THREE: +for(;;) { + var fn = function () { + continue THREE; + } +} + +// continue forward +for(;;) { + continue FIVE; + FIVE: + for (; ;) { } +} +// label on non-loop statement +NINE: +var y = 12; + +for(;;) { + continue NINE; +} + +//// [invalidForContinueStatements.js] +// All errors +// naked continue not allowed +continue; +// non-existent label +ONE: for (;;) + continue TWO; +// continue from inside function +TWO: for (;;) { + var x = function () { + continue TWO; + }; +} +THREE: for (;;) { + var fn = function () { + continue THREE; + }; +} +// continue forward +for (;;) { + continue FIVE; + FIVE: for (;;) { + } +} +// label on non-loop statement +NINE: var y = 12; +for (;;) { + continue NINE; +} diff --git a/tests/baselines/reference/invalidForInBreakStatements.js b/tests/baselines/reference/invalidForInBreakStatements.js new file mode 100644 index 00000000000..bf383613c3b --- /dev/null +++ b/tests/baselines/reference/invalidForInBreakStatements.js @@ -0,0 +1,69 @@ +//// [invalidForInBreakStatements.ts] +// All errors + +// naked break not allowed +break; + +// non-existent label +ONE: +for (var x in {}) break TWO; + +// break from inside function +TWO: +for (var x in {}) { + var fn = () => { + break TWO; + } +} + +THREE: +for (var x in {}) { + var fn = function () { + break THREE; + } +} + +// break forward +for (var x in {}) { + break FIVE; + FIVE: + for (var x in {}) { } +} + +// label on non-loop statement +NINE: +var y = 12; + +for (var x in {}) { + break NINE; +} + +//// [invalidForInBreakStatements.js] +// All errors +// naked break not allowed +break; +// non-existent label +ONE: for (var x in {}) + break TWO; +// break from inside function +TWO: for (var x in {}) { + var fn = function () { + break TWO; + }; +} +THREE: for (var x in {}) { + var fn = function () { + break THREE; + }; +} +// break forward +for (var x in {}) { + break FIVE; + FIVE: for (var x in {}) { + } +} +// label on non-loop statement +NINE: var y = 12; +for (var x in {}) { + break NINE; +} diff --git a/tests/baselines/reference/invalidForInContinueStatements.js b/tests/baselines/reference/invalidForInContinueStatements.js new file mode 100644 index 00000000000..d40dbd80ca0 --- /dev/null +++ b/tests/baselines/reference/invalidForInContinueStatements.js @@ -0,0 +1,69 @@ +//// [invalidForInContinueStatements.ts] +// All errors + +// naked continue not allowed +continue; + +// non-existent label +ONE: +for (var x in {}) continue TWO; + +// continue from inside function +TWO: +for (var x in {}) { + var fn = () => { + continue TWO; + } +} + +THREE: +for (var x in {}) { + var fn = function () { + continue THREE; + } +} + +// continue forward +for (var x in {}) { + continue FIVE; + FIVE: + for (var x in {}) { } +} + +// label on non-loop statement +NINE: +var y = 12; + +for (var x in {}) { + continue NINE; +} + +//// [invalidForInContinueStatements.js] +// All errors +// naked continue not allowed +continue; +// non-existent label +ONE: for (var x in {}) + continue TWO; +// continue from inside function +TWO: for (var x in {}) { + var fn = function () { + continue TWO; + }; +} +THREE: for (var x in {}) { + var fn = function () { + continue THREE; + }; +} +// continue forward +for (var x in {}) { + continue FIVE; + FIVE: for (var x in {}) { + } +} +// label on non-loop statement +NINE: var y = 12; +for (var x in {}) { + continue NINE; +} diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js new file mode 100644 index 00000000000..077d7ddbcdc --- /dev/null +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -0,0 +1,235 @@ +//// [invalidModuleWithStatementsOfEveryKind.ts] +// All of these should be an error + +module Y { + public class A { s: string } + + public class BB extends A { + id: number; + } +} + +module Y2 { + public class AA { s: T } + public interface I { id: number } + + public class B extends AA implements I { id: number } +} + +module Y3 { + public module Module { + class A { s: string } + } +} + +module Y4 { + public enum Color { Blue, Red } +} + +module YY { + private class A { s: string } + + private class BB extends A { + id: number; + } +} + +module YY2 { + private class AA { s: T } + private interface I { id: number } + + private class B extends AA implements I { id: number } +} + +module YY3 { + private module Module { + class A { s: string } + } +} + +module YY4 { + private enum Color { Blue, Red } +} + + +module YYY { + static class A { s: string } + + static class BB extends A { + id: number; + } +} + +module YYY2 { + static class AA { s: T } + static interface I { id: number } + + static class B extends AA implements I { id: number } +} + +module YYY3 { + static module Module { + class A { s: string } + } +} + +module YYY4 { + static enum Color { Blue, Red } +} + + +//// [invalidModuleWithStatementsOfEveryKind.js] +// All of these should be an error +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Y; +(function (Y) { + var A = (function () { + function A() { + } + return A; + })(); + var BB = (function (_super) { + __extends(BB, _super); + function BB() { + _super.apply(this, arguments); + } + return BB; + })(A); +})(Y || (Y = {})); +var Y2; +(function (Y2) { + var AA = (function () { + function AA() { + } + return AA; + })(); + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(AA); +})(Y2 || (Y2 = {})); +var Y3; +(function (Y3) { + var Module; + (function (Module) { + var A = (function () { + function A() { + } + return A; + })(); + })(Module || (Module = {})); +})(Y3 || (Y3 = {})); +var Y4; +(function (Y4) { + var Color; + (function (Color) { + Color[Color["Blue"] = 0] = "Blue"; + Color[Color["Red"] = 1] = "Red"; + })(Color || (Color = {})); +})(Y4 || (Y4 = {})); +var YY; +(function (YY) { + var A = (function () { + function A() { + } + return A; + })(); + var BB = (function (_super) { + __extends(BB, _super); + function BB() { + _super.apply(this, arguments); + } + return BB; + })(A); +})(YY || (YY = {})); +var YY2; +(function (YY2) { + var AA = (function () { + function AA() { + } + return AA; + })(); + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(AA); +})(YY2 || (YY2 = {})); +var YY3; +(function (YY3) { + var Module; + (function (Module) { + var A = (function () { + function A() { + } + return A; + })(); + })(Module || (Module = {})); +})(YY3 || (YY3 = {})); +var YY4; +(function (YY4) { + var Color; + (function (Color) { + Color[Color["Blue"] = 0] = "Blue"; + Color[Color["Red"] = 1] = "Red"; + })(Color || (Color = {})); +})(YY4 || (YY4 = {})); +var YYY; +(function (YYY) { + var A = (function () { + function A() { + } + return A; + })(); + var BB = (function (_super) { + __extends(BB, _super); + function BB() { + _super.apply(this, arguments); + } + return BB; + })(A); +})(YYY || (YYY = {})); +var YYY2; +(function (YYY2) { + var AA = (function () { + function AA() { + } + return AA; + })(); + var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; + })(AA); +})(YYY2 || (YYY2 = {})); +var YYY3; +(function (YYY3) { + var Module; + (function (Module) { + var A = (function () { + function A() { + } + return A; + })(); + })(Module || (Module = {})); +})(YYY3 || (YYY3 = {})); +var YYY4; +(function (YYY4) { + var Color; + (function (Color) { + Color[Color["Blue"] = 0] = "Blue"; + Color[Color["Red"] = 1] = "Red"; + })(Color || (Color = {})); +})(YYY4 || (YYY4 = {})); diff --git a/tests/baselines/reference/invalidModuleWithVarStatements.js b/tests/baselines/reference/invalidModuleWithVarStatements.js new file mode 100644 index 00000000000..4014709d361 --- /dev/null +++ b/tests/baselines/reference/invalidModuleWithVarStatements.js @@ -0,0 +1,58 @@ +//// [invalidModuleWithVarStatements.ts] +// All of these should be an error + +module Y { + public var x: number = 0; +} + +module Y2 { + public function fn(x: string) { } +} + +module Y4 { + static var x: number = 0; +} + +module YY { + static function fn(x: string) { } +} + +module YY2 { + private var x: number = 0; +} + + +module YY3 { + private function fn(x: string) { } +} + + +//// [invalidModuleWithVarStatements.js] +// All of these should be an error +var Y; +(function (Y) { + var x = 0; +})(Y || (Y = {})); +var Y2; +(function (Y2) { + function fn(x) { + } +})(Y2 || (Y2 = {})); +var Y4; +(function (Y4) { + var x = 0; +})(Y4 || (Y4 = {})); +var YY; +(function (YY) { + function fn(x) { + } +})(YY || (YY = {})); +var YY2; +(function (YY2) { + var x = 0; +})(YY2 || (YY2 = {})); +var YY3; +(function (YY3) { + function fn(x) { + } +})(YY3 || (YY3 = {})); diff --git a/tests/baselines/reference/invalidReferenceSyntax1.js b/tests/baselines/reference/invalidReferenceSyntax1.js new file mode 100644 index 00000000000..39ecf8e6ab4 --- /dev/null +++ b/tests/baselines/reference/invalidReferenceSyntax1.js @@ -0,0 +1,13 @@ +//// [invalidReferenceSyntax1.ts] +/// +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/invalidSwitchContinueStatement.js b/tests/baselines/reference/invalidSwitchContinueStatement.js new file mode 100644 index 00000000000..759056ce3e5 --- /dev/null +++ b/tests/baselines/reference/invalidSwitchContinueStatement.js @@ -0,0 +1,15 @@ +//// [invalidSwitchContinueStatement.ts] +// continue is not allowed in a switch statement + +switch (12) { + case 5: + continue; +} + + +//// [invalidSwitchContinueStatement.js] +// continue is not allowed in a switch statement +switch (12) { + case 5: + continue; +} diff --git a/tests/baselines/reference/invalidThrowStatement.js b/tests/baselines/reference/invalidThrowStatement.js new file mode 100644 index 00000000000..4b794ab3d51 --- /dev/null +++ b/tests/baselines/reference/invalidThrowStatement.js @@ -0,0 +1,9 @@ +//// [invalidThrowStatement.ts] +throw; + +export throw null; + + +//// [invalidThrowStatement.js] +throw ; +throw null; diff --git a/tests/baselines/reference/invalidTripleSlashReference.js b/tests/baselines/reference/invalidTripleSlashReference.js new file mode 100644 index 00000000000..c0dcec0d23c --- /dev/null +++ b/tests/baselines/reference/invalidTripleSlashReference.js @@ -0,0 +1,12 @@ +//// [invalidTripleSlashReference.ts] +/// +/// + +// this test doesn't actually give the errors you want due to the way the compiler reports errors +var x = 1; + +//// [invalidTripleSlashReference.js] +/// +/// +// this test doesn't actually give the errors you want due to the way the compiler reports errors +var x = 1; diff --git a/tests/baselines/reference/invalidTryStatements.js b/tests/baselines/reference/invalidTryStatements.js new file mode 100644 index 00000000000..8afadf41b4d --- /dev/null +++ b/tests/baselines/reference/invalidTryStatements.js @@ -0,0 +1,36 @@ +//// [invalidTryStatements.ts] +function fn() { + try { + } catch (x) { + var x: string; // ensure x is 'Any' + } + + // no type annotation allowed + try { } catch (z: any) { } + try { } catch (a: number) { } + try { } catch (y: string) { } +} + + + +//// [invalidTryStatements.js] +function fn() { + try { + } + catch (x) { + var x; // ensure x is 'Any' + } + // no type annotation allowed + try { + } + catch (z) { + } + try { + } + catch (a) { + } + try { + } + catch (y) { + } +} diff --git a/tests/baselines/reference/invalidTryStatements2.js b/tests/baselines/reference/invalidTryStatements2.js new file mode 100644 index 00000000000..d2ef92ac831 --- /dev/null +++ b/tests/baselines/reference/invalidTryStatements2.js @@ -0,0 +1,68 @@ +//// [invalidTryStatements2.ts] +function fn() { + try { + } catch { // syntax error, missing '(x)' + } + + catch(x) { } // error missing try + + finally{ } // potential error; can be absorbed by the 'catch' +} + +function fn2() { + finally { } // error missing try + catch (x) { } // error missing try + + // no error + try { + } + finally { + } + + // error missing try + finally { + } + + // error missing try + catch (x) { + } +} + +//// [invalidTryStatements2.js] +function fn() { + try { + } + catch () { + } + try { + } + catch (x) { + } // error missing try + finally { + } // potential error; can be absorbed by the 'catch' +} +function fn2() { + try { + } + finally { + } // error missing try + try { + } // error missing try + catch (x) { + } // error missing try + // no error + try { + } + finally { + } + // error missing try + try { + } + finally { + } + // error missing try + try { + } + catch (x) { + } +} diff --git a/tests/baselines/reference/invalidTypeOfTarget.js b/tests/baselines/reference/invalidTypeOfTarget.js new file mode 100644 index 00000000000..88128d15e85 --- /dev/null +++ b/tests/baselines/reference/invalidTypeOfTarget.js @@ -0,0 +1,20 @@ +//// [invalidTypeOfTarget.ts] +var x1: typeof {}; +var x2: typeof (): void; +var x3: typeof 1; +var x4: typeof ''; +var x5: typeof []; +var x6: typeof null; +var x7: typeof function f() { }; +var x8: typeof /123/; + +//// [invalidTypeOfTarget.js] +var x1 = {}; +var x2 = ; +var x3 = 1; +var x4 = ''; +var x5; +var x6 = null; +var x7 = function f() { +}; +var x8 = /123/; diff --git a/tests/baselines/reference/invalidUnicodeEscapeSequance.js b/tests/baselines/reference/invalidUnicodeEscapeSequance.js new file mode 100644 index 00000000000..06c7af443e0 --- /dev/null +++ b/tests/baselines/reference/invalidUnicodeEscapeSequance.js @@ -0,0 +1,5 @@ +//// [invalidUnicodeEscapeSequance.ts] +var arg\u003 + +//// [invalidUnicodeEscapeSequance.js] +var arg, u003; diff --git a/tests/baselines/reference/invalidUnicodeEscapeSequance2.js b/tests/baselines/reference/invalidUnicodeEscapeSequance2.js new file mode 100644 index 00000000000..06714db3f7e --- /dev/null +++ b/tests/baselines/reference/invalidUnicodeEscapeSequance2.js @@ -0,0 +1,5 @@ +//// [invalidUnicodeEscapeSequance2.ts] +var arg\uxxxx + +//// [invalidUnicodeEscapeSequance2.js] +var arg, uxxxx; diff --git a/tests/baselines/reference/invalidUnicodeEscapeSequance3.js b/tests/baselines/reference/invalidUnicodeEscapeSequance3.js new file mode 100644 index 00000000000..b6b0307bbe6 --- /dev/null +++ b/tests/baselines/reference/invalidUnicodeEscapeSequance3.js @@ -0,0 +1,6 @@ +//// [invalidUnicodeEscapeSequance3.ts] +a\u + +//// [invalidUnicodeEscapeSequance3.js] +a; +u; diff --git a/tests/baselines/reference/invalidUnicodeEscapeSequance4.js b/tests/baselines/reference/invalidUnicodeEscapeSequance4.js new file mode 100644 index 00000000000..014ebb6eead --- /dev/null +++ b/tests/baselines/reference/invalidUnicodeEscapeSequance4.js @@ -0,0 +1,7 @@ +//// [invalidUnicodeEscapeSequance4.ts] +var a\u0031; // a1 is a valid identifier +var \u0031a; // 1a is an invalid identifier + +//// [invalidUnicodeEscapeSequance4.js] +var a\u0031; // a1 is a valid identifier +var u0031a; // 1a is an invalid identifier diff --git a/tests/baselines/reference/invalidWhileBreakStatements.js b/tests/baselines/reference/invalidWhileBreakStatements.js new file mode 100644 index 00000000000..a8e261f036c --- /dev/null +++ b/tests/baselines/reference/invalidWhileBreakStatements.js @@ -0,0 +1,69 @@ +//// [invalidWhileBreakStatements.ts] +// All errors + +// naked break not allowed +break; + +// non-existent label +ONE: +while (true) break TWO; + +// break from inside function +TWO: +while (true){ + var x = () => { + break TWO; + } +} + +THREE: +while (true) { + var fn = function () { + break THREE; + } +} + +// break forward +while (true) { + break FIVE; + FIVE: + while (true) { } +} + +// label on non-loop statement +NINE: +var y = 12; + +while (true) { + break NINE; +} + +//// [invalidWhileBreakStatements.js] +// All errors +// naked break not allowed +break; +// non-existent label +ONE: while (true) + break TWO; +// break from inside function +TWO: while (true) { + var x = function () { + break TWO; + }; +} +THREE: while (true) { + var fn = function () { + break THREE; + }; +} +// break forward +while (true) { + break FIVE; + FIVE: while (true) { + } +} +// label on non-loop statement +NINE: var y = 12; +while (true) { + break NINE; +} diff --git a/tests/baselines/reference/invalidWhileContinueStatements.js b/tests/baselines/reference/invalidWhileContinueStatements.js new file mode 100644 index 00000000000..544314bf68d --- /dev/null +++ b/tests/baselines/reference/invalidWhileContinueStatements.js @@ -0,0 +1,69 @@ +//// [invalidWhileContinueStatements.ts] +// All errors + +// naked continue not allowed +continue; + +// non-existent label +ONE: +while (true) continue TWO; + +// continue from inside function +TWO: +while (true){ + var x = () => { + continue TWO; + } +} + +THREE: +while (true) { + var fn = function () { + continue THREE; + } +} + +// continue forward +while (true) { + continue FIVE; + FIVE: + while (true) { } +} + +// label on non-loop statement +NINE: +var y = 12; + +while (true) { + continue NINE; +} + +//// [invalidWhileContinueStatements.js] +// All errors +// naked continue not allowed +continue; +// non-existent label +ONE: while (true) + continue TWO; +// continue from inside function +TWO: while (true) { + var x = function () { + continue TWO; + }; +} +THREE: while (true) { + var fn = function () { + continue THREE; + }; +} +// continue forward +while (true) { + continue FIVE; + FIVE: while (true) { + } +} +// label on non-loop statement +NINE: var y = 12; +while (true) { + continue NINE; +} diff --git a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt index 4bf5521d24d..d503f59c602 100644 --- a/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt +++ b/tests/baselines/reference/lastPropertyInLiteralWins.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'. -tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'. -tests/cases/compiler/lastPropertyInLiteralWins.ts(12,6): error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'. +tests/cases/compiler/lastPropertyInLiteralWins.ts(7,6): error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'. Types of property 'thunk' are incompatible. Type '(num: number) => void' is not assignable to type '(str: string) => void'. +tests/cases/compiler/lastPropertyInLiteralWins.ts(8,5): error TS2300: Duplicate identifier 'thunk'. +tests/cases/compiler/lastPropertyInLiteralWins.ts(9,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(13,5): error TS2300: Duplicate identifier 'thunk'. tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate identifier 'thunk'. @@ -15,21 +15,12 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate thing.thunk("str"); } test({ // Should error, as last one wins, and is wrong type + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ thunk: (str: string) => {}, - ~~~~~ -!!! error TS2300: Duplicate identifier 'thunk'. - thunk: (num: number) => {} - ~~~~~ -!!! error TS2300: Duplicate identifier 'thunk'. - }); - - test({ // Should be OK. Last 'thunk' is of correct type - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - thunk: (num: number) => {}, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ !!! error TS2300: Duplicate identifier 'thunk'. - thunk: (str: string) => {} + thunk: (num: number) => {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ !!! error TS2300: Duplicate identifier 'thunk'. @@ -38,4 +29,13 @@ tests/cases/compiler/lastPropertyInLiteralWins.ts(14,5): error TS2300: Duplicate !!! error TS2345: Argument of type '{ thunk: (num: number) => void; }' is not assignable to parameter of type 'Thing'. !!! error TS2345: Types of property 'thunk' are incompatible. !!! error TS2345: Type '(num: number) => void' is not assignable to type '(str: string) => void'. + + test({ // Should be OK. Last 'thunk' is of correct type + thunk: (num: number) => {}, + ~~~~~ +!!! error TS2300: Duplicate identifier 'thunk'. + thunk: (str: string) => {} + ~~~~~ +!!! error TS2300: Duplicate identifier 'thunk'. + }); \ No newline at end of file diff --git a/tests/baselines/reference/letAsIdentifierInStrictMode.js b/tests/baselines/reference/letAsIdentifierInStrictMode.js new file mode 100644 index 00000000000..e844bc1d1dc --- /dev/null +++ b/tests/baselines/reference/letAsIdentifierInStrictMode.js @@ -0,0 +1,17 @@ +//// [letAsIdentifierInStrictMode.ts] +"use strict"; +var let = 10; +var a = 10; +let = 30; +let +a; + +//// [letAsIdentifierInStrictMode.js] +"use strict"; +var ; +let ; +10; +var a = 10; +let ; +30; +let a; diff --git a/tests/baselines/reference/letDeclarations-es5-1.js b/tests/baselines/reference/letDeclarations-es5-1.js new file mode 100644 index 00000000000..24c2c62e58f --- /dev/null +++ b/tests/baselines/reference/letDeclarations-es5-1.js @@ -0,0 +1,15 @@ +//// [letDeclarations-es5-1.ts] + let l1; + let l2: number; + let l3, l4, l5 :string, l6; + let l7 = false; + let l8: number = 23; + let l9 = 0, l10 :string = "", l11 = null; + +//// [letDeclarations-es5-1.js] +let l1; +let l2; +let l3, l4, l5, l6; +let l7 = false; +let l8 = 23; +let l9 = 0, l10 = "", l11 = null; diff --git a/tests/baselines/reference/letDeclarations-es5.js b/tests/baselines/reference/letDeclarations-es5.js new file mode 100644 index 00000000000..d5d1d96d350 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-es5.js @@ -0,0 +1,26 @@ +//// [letDeclarations-es5.ts] + +let l1; +let l2: number; +let l3, l4, l5 :string, l6; + +let l7 = false; +let l8: number = 23; +let l9 = 0, l10 :string = "", l11 = null; + +for(let l11 in {}) { } + +for(let l12 = 0; l12 < 9; l12++) { } + + +//// [letDeclarations-es5.js] +let l1; +let l2; +let l3, l4, l5, l6; +let l7 = false; +let l8 = 23; +let l9 = 0, l10 = "", l11 = null; +for (let l11 in {}) { +} +for (let l12 = 0; l12 < 9; l12++) { +} diff --git a/tests/baselines/reference/letDeclarations-invalidContexts.js b/tests/baselines/reference/letDeclarations-invalidContexts.js new file mode 100644 index 00000000000..f8c3bb04bdb --- /dev/null +++ b/tests/baselines/reference/letDeclarations-invalidContexts.js @@ -0,0 +1,57 @@ +//// [letDeclarations-invalidContexts.ts] + +// Errors, let must be defined inside a block +if (true) + let l1 = 0; +else + let l2 = 0; + +while (true) + let l3 = 0; + +do + let l4 = 0; +while (true); + +var obj; +with (obj) + let l5 = 0; + +for (var i = 0; i < 10; i++) + let l6 = 0; + +for (var i2 in {}) + let l7 = 0; + +if (true) + label: let l8 = 0; + +while (false) + label2: label3: label4: let l9 = 0; + + + + + +//// [letDeclarations-invalidContexts.js] +// Errors, let must be defined inside a block +if (true) + let l1 = 0; +else + let l2 = 0; +while (true) + let l3 = 0; +do + let l4 = 0; +while (true); +var obj; +with (obj) + let l5 = 0; +for (var i = 0; i < 10; i++) + let l6 = 0; +for (var i2 in {}) + let l7 = 0; +if (true) + label: let l8 = 0; +while (false) + label2: label3: label4: let l9 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes-duplicates.js b/tests/baselines/reference/letDeclarations-scopes-duplicates.js new file mode 100644 index 00000000000..c7d2ef9863a --- /dev/null +++ b/tests/baselines/reference/letDeclarations-scopes-duplicates.js @@ -0,0 +1,140 @@ +//// [letDeclarations-scopes-duplicates.ts] + +// Errors: redeclaration +let var1 = 0; +let var1 = 0; // error + +let var2 = 0; +const var2 = 0; + +const var3 = 0; +let var3 = 0; + +const var4 = 0; +const var4 = 0; + +var var5 = 0; +let var5 = 0; + +let var6 = 0; +var var6 = 0; + +{ + let var7 = 0; + let var7 = 0; + { + let var8 = 0; + const var8 = 0; + } +} + +switch (0) { + default: + let var9 = 0; + let var9 = 0; +} + +try { + const var10 = 0; + const var10 = 0; +} +catch (e) { + let var11 = 0; + let var11 = 0; +} + +function F1() { + let var12; + let var12; +} + +// OK +var var20 = 0; + +var var20 = 0 +{ + let var20 = 0; + { + let var20 = 0; + } +} + +switch (0) { + default: + let var20 = 0; +} + +try { + let var20 = 0; +} +catch (e) { + let var20 = 0; +} + +function F() { + let var20; +} + + + +//// [letDeclarations-scopes-duplicates.js] +// Errors: redeclaration +let var1 = 0; +let var1 = 0; // error +let var2 = 0; +const var2 = 0; +const var3 = 0; +let var3 = 0; +const var4 = 0; +const var4 = 0; +var var5 = 0; +let var5 = 0; +let var6 = 0; +var var6 = 0; +{ + let var7 = 0; + let var7 = 0; + { + let var8 = 0; + const var8 = 0; + } +} +switch (0) { + default: + let var9 = 0; + let var9 = 0; +} +try { + const var10 = 0; + const var10 = 0; +} +catch (e) { + let var11 = 0; + let var11 = 0; +} +function F1() { + let var12; + let var12; +} +// OK +var var20 = 0; +var var20 = 0; +{ + let var20 = 0; + { + let var20 = 0; + } +} +switch (0) { + default: + let var20 = 0; +} +try { + let var20 = 0; +} +catch (e) { + let var20 = 0; +} +function F() { + let var20; +} diff --git a/tests/baselines/reference/letDeclarations-scopes-duplicates2.js b/tests/baselines/reference/letDeclarations-scopes-duplicates2.js new file mode 100644 index 00000000000..9b35bd81c76 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-scopes-duplicates2.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/letDeclarations-scopes-duplicates2.ts] //// + +//// [file1.ts] + +let var1 = 0; + +//// [file2.ts] +let var1 = 0; + +//// [file1.js] +let var1 = 0; +//// [file2.js] +let var1 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes-duplicates3.js b/tests/baselines/reference/letDeclarations-scopes-duplicates3.js new file mode 100644 index 00000000000..e74caf37219 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-scopes-duplicates3.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/letDeclarations-scopes-duplicates3.ts] //// + +//// [file1.ts] + +let var1 = 0; + +//// [file2.ts] +const var1 = 0; + +//// [file1.js] +let var1 = 0; +//// [file2.js] +const var1 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes-duplicates4.js b/tests/baselines/reference/letDeclarations-scopes-duplicates4.js new file mode 100644 index 00000000000..ac338e31c72 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-scopes-duplicates4.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/letDeclarations-scopes-duplicates4.ts] //// + +//// [file1.ts] + +const var1 = 0; + +//// [file2.ts] +let var1 = 0; + +//// [file1.js] +const var1 = 0; +//// [file2.js] +let var1 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes-duplicates5.js b/tests/baselines/reference/letDeclarations-scopes-duplicates5.js new file mode 100644 index 00000000000..2424c91ab90 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-scopes-duplicates5.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/letDeclarations-scopes-duplicates5.ts] //// + +//// [file1.ts] + +const var1 = 0; + +//// [file2.ts] +const var1 = 0; + +//// [file1.js] +const var1 = 0; +//// [file2.js] +const var1 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes-duplicates6.js b/tests/baselines/reference/letDeclarations-scopes-duplicates6.js new file mode 100644 index 00000000000..24edc0b7bde --- /dev/null +++ b/tests/baselines/reference/letDeclarations-scopes-duplicates6.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/letDeclarations-scopes-duplicates6.ts] //// + +//// [file1.ts] + +var var1 = 0; + +//// [file2.ts] +let var1 = 0; + +//// [file1.js] +var var1 = 0; +//// [file2.js] +let var1 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes-duplicates7.js b/tests/baselines/reference/letDeclarations-scopes-duplicates7.js new file mode 100644 index 00000000000..4cbc359e2c2 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-scopes-duplicates7.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/letDeclarations-scopes-duplicates7.ts] //// + +//// [file1.ts] + +let var1 = 0; + +//// [file2.ts] +var var1 = 0; + +//// [file1.js] +let var1 = 0; +//// [file2.js] +var var1 = 0; diff --git a/tests/baselines/reference/letDeclarations-scopes.js b/tests/baselines/reference/letDeclarations-scopes.js index d0f70693d7c..fc721807994 100644 --- a/tests/baselines/reference/letDeclarations-scopes.js +++ b/tests/baselines/reference/letDeclarations-scopes.js @@ -205,6 +205,7 @@ for (let l = 0; n = l; l++) { } for (let l in {}) { } +// Try/catch/finally try { let l = 0; n = l; @@ -217,12 +218,14 @@ finally { let l = 0; n = l; } +// Switch switch (0) { case 0: let l = 0; n = l; break; } +// blocks { let l = 0; n = l; @@ -236,7 +239,7 @@ function F() { let l = 0; n = l; } -var F2 = function () { +var F2 = () => { let l = 0; n = l; }; @@ -286,7 +289,7 @@ var o = { let l = 0; n = l; }, - f2: function () { + f2: () => { let l = 0; n = l; } diff --git a/tests/baselines/reference/letDeclarations-useBeforeDefinition.js b/tests/baselines/reference/letDeclarations-useBeforeDefinition.js new file mode 100644 index 00000000000..be1f9a127f4 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-useBeforeDefinition.js @@ -0,0 +1,24 @@ +//// [letDeclarations-useBeforeDefinition.ts] + +{ + l1; + let l1; +} + +var v1; +{ + v1; + let v1 = 0; +} + + +//// [letDeclarations-useBeforeDefinition.js] +{ + l1; + let l1; +} +var v1; +{ + v1; + let v1 = 0; +} diff --git a/tests/baselines/reference/letDeclarations-useBeforeDefinition2.js b/tests/baselines/reference/letDeclarations-useBeforeDefinition2.js new file mode 100644 index 00000000000..35560edd1c8 --- /dev/null +++ b/tests/baselines/reference/letDeclarations-useBeforeDefinition2.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/letDeclarations-useBeforeDefinition2.ts] //// + +//// [file1.ts] + +l; + +//// [file2.ts] +const l = 0; + +//// [out.js] +l; +const l = 0; diff --git a/tests/baselines/reference/letDeclarations-validContexts.js b/tests/baselines/reference/letDeclarations-validContexts.js index fe9ed903bf5..f6d404135f6 100644 --- a/tests/baselines/reference/letDeclarations-validContexts.js +++ b/tests/baselines/reference/letDeclarations-validContexts.js @@ -173,6 +173,7 @@ if (true) { while (false) { label2: label3: label4: let l9 = 0; } +// Try/catch/finally try { let l10 = 0; } @@ -182,6 +183,7 @@ catch (e) { finally { let l12 = 0; } +// Switch switch (0) { case 0: let l13 = 0; @@ -190,6 +192,7 @@ switch (0) { let l14 = 0; break; } +// blocks { let l15 = 0; { @@ -203,7 +206,7 @@ let l18 = 0; function F() { let l19 = 0; } -var F2 = function () { +var F2 = () => { let l20 = 0; }; var F3 = function () { @@ -243,10 +246,11 @@ var o = { f() { let l28 = 0; }, - f2: function () { + f2: () => { let l29 = 0; } }; +// labels label: let l30 = 0; { label2: let l31 = 0; diff --git a/tests/baselines/reference/libMembers.js b/tests/baselines/reference/libMembers.js new file mode 100644 index 00000000000..38d1356ccc3 --- /dev/null +++ b/tests/baselines/reference/libMembers.js @@ -0,0 +1,36 @@ +//// [libMembers.ts] +var s="hello"; +s.substring(0); +s.substring(3,4); +s.subby(12); // error unresolved +String.fromCharCode(12); +module M { + export class C { + } + var a=new C[]; + a.length; + a.push(new C()); + (new C()).prototype; +} + + + +//// [libMembers.js] +var s = "hello"; +s.substring(0); +s.substring(3, 4); +s.subby(12); // error unresolved +String.fromCharCode(12); +var M; +(function (M) { + var C = (function () { + function C() { + } + return C; + })(); + M.C = C; + var a = new C[]; + a.length; + a.push(new C()); + (new C()).prototype; +})(M || (M = {})); diff --git a/tests/baselines/reference/literals.js b/tests/baselines/reference/literals.js new file mode 100644 index 00000000000..b92e11c13ce --- /dev/null +++ b/tests/baselines/reference/literals.js @@ -0,0 +1,74 @@ +//// [literals.ts] + +//typeof null is Null +//typeof true is Boolean +//typeof false is Boolean +//typeof numeric literal is Number +//typeof string literal is String +//typeof regex literal is Regex + +var nu = null / null; +var u = undefined / undefined; + +var b: boolean; +var b = true; +var b = false; + +var n: number; +var n = 1; +var n = 1.0; +var n = 1e4; +var n = 001; // Error in ES5 +var n = 0x1; +var n = -1; +var n = -1.0; +var n = -1e-4; +var n = -003; // Error in ES5 +var n = -0x1; + +var s: string; +var s = ''; +var s = ""; +var s = 'foo\ + bar'; +var s = "foo\ + bar"; + +var r: RegExp; +var r = /what/; +var r = /\\\\/; + + +//// [literals.js] +//typeof null is Null +//typeof true is Boolean +//typeof false is Boolean +//typeof numeric literal is Number +//typeof string literal is String +//typeof regex literal is Regex +var nu = null / null; +var u = undefined / undefined; +var b; +var b = true; +var b = false; +var n; +var n = 1; +var n = 1.0; +var n = 1e4; +var n = 001; // Error in ES5 +var n = 0x1; +var n = -1; +var n = -1.0; +var n = -1e-4; +var n = -003; // Error in ES5 +var n = -0x1; +var s; +var s = ''; +var s = ""; +var s = 'foo\ + bar'; +var s = "foo\ + bar"; +var r; +var r = /what/; +var r = /\\\\/; diff --git a/tests/baselines/reference/logicalNotOperatorInvalidOperations.js b/tests/baselines/reference/logicalNotOperatorInvalidOperations.js new file mode 100644 index 00000000000..7b16f2ef36f --- /dev/null +++ b/tests/baselines/reference/logicalNotOperatorInvalidOperations.js @@ -0,0 +1,23 @@ +//// [logicalNotOperatorInvalidOperations.ts] +// Unary operator ! +var b: number; + +// operand before ! +var BOOLEAN1 = b!; //expect error + +// miss parentheses +var BOOLEAN2 = !b + b; + +// miss an operand +var BOOLEAN3 =!; + +//// [logicalNotOperatorInvalidOperations.js] +// Unary operator ! +var b; +// operand before ! +var BOOLEAN1 = b; +!; //expect error +// miss parentheses +var BOOLEAN2 = !b + b; +// miss an operand +var BOOLEAN3 = !; diff --git a/tests/baselines/reference/logicalOrOperatorWithEveryType.types.pull b/tests/baselines/reference/logicalOrOperatorWithEveryType.types.pull new file mode 100644 index 00000000000..e0d75463414 --- /dev/null +++ b/tests/baselines/reference/logicalOrOperatorWithEveryType.types.pull @@ -0,0 +1,618 @@ +=== tests/cases/conformance/expressions/binaryOperators/logicalOrOperator/logicalOrOperatorWithEveryType.ts === +// The || operator permits the operands to be of any type. +// If the || expression is not contextually typed, the right operand is contextually typed +// by the type of the left operand and the result is of the best common type of the two +// operand types. + +enum E { a, b, c } +>E : E +>a : E +>b : E +>c : E + +var a1: any; +>a1 : any + +var a2: boolean; +>a2 : boolean + +var a3: number +>a3 : number + +var a4: string; +>a4 : string + +var a5: void; +>a5 : void + +var a6: E; +>a6 : E +>E : E + +var a7: {a: string}; +>a7 : { a: string; } +>a : string + +var a8: string[]; +>a8 : string[] + +var ra1 = a1 || a1; // any || any is any +>ra1 : any +>a1 || a1 : any +>a1 : any +>a1 : any + +var ra2 = a2 || a1; // boolean || any is any +>ra2 : any +>a2 || a1 : any +>a2 : boolean +>a1 : any + +var ra3 = a3 || a1; // number || any is any +>ra3 : any +>a3 || a1 : any +>a3 : number +>a1 : any + +var ra4 = a4 || a1; // string || any is any +>ra4 : any +>a4 || a1 : any +>a4 : string +>a1 : any + +var ra5 = a5 || a1; // void || any is any +>ra5 : any +>a5 || a1 : any +>a5 : void +>a1 : any + +var ra6 = a6 || a1; // enum || any is any +>ra6 : any +>a6 || a1 : any +>a6 : E +>a1 : any + +var ra7 = a7 || a1; // object || any is any +>ra7 : any +>a7 || a1 : any +>a7 : { a: string; } +>a1 : any + +var ra8 = a8 || a1; // array || any is any +>ra8 : any +>a8 || a1 : any +>a8 : string[] +>a1 : any + +var ra9 = null || a1; // null || any is any +>ra9 : any +>null || a1 : any +>a1 : any + +var ra10 = undefined || a1; // undefined || any is any +>ra10 : any +>undefined || a1 : any +>undefined : undefined +>a1 : any + +var rb1 = a1 || a2; // any || boolean is any +>rb1 : any +>a1 || a2 : any +>a1 : any +>a2 : boolean + +var rb2 = a2 || a2; // boolean || boolean is boolean +>rb2 : boolean +>a2 || a2 : boolean +>a2 : boolean +>a2 : boolean + +var rb3 = a3 || a2; // number || boolean is number | boolean +>rb3 : number | boolean +>a3 || a2 : number | boolean +>a3 : number +>a2 : boolean + +var rb4 = a4 || a2; // string || boolean is string | boolean +>rb4 : string | boolean +>a4 || a2 : string | boolean +>a4 : string +>a2 : boolean + +var rb5 = a5 || a2; // void || boolean is void | boolean +>rb5 : boolean | void +>a5 || a2 : boolean | void +>a5 : void +>a2 : boolean + +var rb6 = a6 || a2; // enum || boolean is E | boolean +>rb6 : boolean | E +>a6 || a2 : boolean | E +>a6 : E +>a2 : boolean + +var rb7 = a7 || a2; // object || boolean is object | boolean +>rb7 : boolean | { a: string; } +>a7 || a2 : boolean | { a: string; } +>a7 : { a: string; } +>a2 : boolean + +var rb8 = a8 || a2; // array || boolean is array | boolean +>rb8 : boolean | string[] +>a8 || a2 : boolean | string[] +>a8 : string[] +>a2 : boolean + +var rb9 = null || a2; // null || boolean is boolean +>rb9 : boolean +>null || a2 : boolean +>a2 : boolean + +var rb10= undefined || a2; // undefined || boolean is boolean +>rb10 : boolean +>undefined || a2 : boolean +>undefined : undefined +>a2 : boolean + +var rc1 = a1 || a3; // any || number is any +>rc1 : any +>a1 || a3 : any +>a1 : any +>a3 : number + +var rc2 = a2 || a3; // boolean || number is boolean | number +>rc2 : number | boolean +>a2 || a3 : number | boolean +>a2 : boolean +>a3 : number + +var rc3 = a3 || a3; // number || number is number +>rc3 : number +>a3 || a3 : number +>a3 : number +>a3 : number + +var rc4 = a4 || a3; // string || number is string | number +>rc4 : string | number +>a4 || a3 : string | number +>a4 : string +>a3 : number + +var rc5 = a5 || a3; // void || number is void | number +>rc5 : number | void +>a5 || a3 : number | void +>a5 : void +>a3 : number + +var rc6 = a6 || a3; // enum || number is number +>rc6 : number +>a6 || a3 : number +>a6 : E +>a3 : number + +var rc7 = a7 || a3; // object || number is object | number +>rc7 : number | { a: string; } +>a7 || a3 : number | { a: string; } +>a7 : { a: string; } +>a3 : number + +var rc8 = a8 || a3; // array || number is array | number +>rc8 : number | string[] +>a8 || a3 : number | string[] +>a8 : string[] +>a3 : number + +var rc9 = null || a3; // null || number is number +>rc9 : number +>null || a3 : number +>a3 : number + +var rc10 = undefined || a3; // undefined || number is number +>rc10 : number +>undefined || a3 : number +>undefined : undefined +>a3 : number + +var rd1 = a1 || a4; // any || string is any +>rd1 : any +>a1 || a4 : any +>a1 : any +>a4 : string + +var rd2 = a2 || a4; // boolean || string is boolean | string +>rd2 : string | boolean +>a2 || a4 : string | boolean +>a2 : boolean +>a4 : string + +var rd3 = a3 || a4; // number || string is number | string +>rd3 : string | number +>a3 || a4 : string | number +>a3 : number +>a4 : string + +var rd4 = a4 || a4; // string || string is string +>rd4 : string +>a4 || a4 : string +>a4 : string +>a4 : string + +var rd5 = a5 || a4; // void || string is void | string +>rd5 : string | void +>a5 || a4 : string | void +>a5 : void +>a4 : string + +var rd6 = a6 || a4; // enum || string is enum | string +>rd6 : string | E +>a6 || a4 : string | E +>a6 : E +>a4 : string + +var rd7 = a7 || a4; // object || string is object | string +>rd7 : string | { a: string; } +>a7 || a4 : string | { a: string; } +>a7 : { a: string; } +>a4 : string + +var rd8 = a8 || a4; // array || string is array | string +>rd8 : string | string[] +>a8 || a4 : string | string[] +>a8 : string[] +>a4 : string + +var rd9 = null || a4; // null || string is string +>rd9 : string +>null || a4 : string +>a4 : string + +var rd10 = undefined || a4; // undefined || string is string +>rd10 : string +>undefined || a4 : string +>undefined : undefined +>a4 : string + +var re1 = a1 || a5; // any || void is any +>re1 : any +>a1 || a5 : any +>a1 : any +>a5 : void + +var re2 = a2 || a5; // boolean || void is boolean | void +>re2 : boolean | void +>a2 || a5 : boolean | void +>a2 : boolean +>a5 : void + +var re3 = a3 || a5; // number || void is number | void +>re3 : number | void +>a3 || a5 : number | void +>a3 : number +>a5 : void + +var re4 = a4 || a5; // string || void is string | void +>re4 : string | void +>a4 || a5 : string | void +>a4 : string +>a5 : void + +var re5 = a5 || a5; // void || void is void +>re5 : void +>a5 || a5 : void +>a5 : void +>a5 : void + +var re6 = a6 || a5; // enum || void is enum | void +>re6 : void | E +>a6 || a5 : void | E +>a6 : E +>a5 : void + +var re7 = a7 || a5; // object || void is object | void +>re7 : void | { a: string; } +>a7 || a5 : void | { a: string; } +>a7 : { a: string; } +>a5 : void + +var re8 = a8 || a5; // array || void is array | void +>re8 : void | string[] +>a8 || a5 : void | string[] +>a8 : string[] +>a5 : void + +var re9 = null || a5; // null || void is void +>re9 : void +>null || a5 : void +>a5 : void + +var re10 = undefined || a5; // undefined || void is void +>re10 : void +>undefined || a5 : void +>undefined : undefined +>a5 : void + +var rg1 = a1 || a6; // any || enum is any +>rg1 : any +>a1 || a6 : any +>a1 : any +>a6 : E + +var rg2 = a2 || a6; // boolean || enum is boolean | enum +>rg2 : boolean | E +>a2 || a6 : boolean | E +>a2 : boolean +>a6 : E + +var rg3 = a3 || a6; // number || enum is number +>rg3 : number +>a3 || a6 : number +>a3 : number +>a6 : E + +var rg4 = a4 || a6; // string || enum is string | enum +>rg4 : string | E +>a4 || a6 : string | E +>a4 : string +>a6 : E + +var rg5 = a5 || a6; // void || enum is void | enum +>rg5 : void | E +>a5 || a6 : void | E +>a5 : void +>a6 : E + +var rg6 = a6 || a6; // enum || enum is E +>rg6 : E +>a6 || a6 : E +>a6 : E +>a6 : E + +var rg7 = a7 || a6; // object || enum is object | enum +>rg7 : E | { a: string; } +>a7 || a6 : E | { a: string; } +>a7 : { a: string; } +>a6 : E + +var rg8 = a8 || a6; // array || enum is array | enum +>rg8 : E | string[] +>a8 || a6 : E | string[] +>a8 : string[] +>a6 : E + +var rg9 = null || a6; // null || enum is E +>rg9 : E +>null || a6 : E +>a6 : E + +var rg10 = undefined || a6; // undefined || enum is E +>rg10 : E +>undefined || a6 : E +>undefined : undefined +>a6 : E + +var rh1 = a1 || a7; // any || object is any +>rh1 : any +>a1 || a7 : any +>a1 : any +>a7 : { a: string; } + +var rh2 = a2 || a7; // boolean || object is boolean | object +>rh2 : boolean | { a: string; } +>a2 || a7 : boolean | { a: string; } +>a2 : boolean +>a7 : { a: string; } + +var rh3 = a3 || a7; // number || object is number | object +>rh3 : number | { a: string; } +>a3 || a7 : number | { a: string; } +>a3 : number +>a7 : { a: string; } + +var rh4 = a4 || a7; // string || object is string | object +>rh4 : string | { a: string; } +>a4 || a7 : string | { a: string; } +>a4 : string +>a7 : { a: string; } + +var rh5 = a5 || a7; // void || object is void | object +>rh5 : void | { a: string; } +>a5 || a7 : void | { a: string; } +>a5 : void +>a7 : { a: string; } + +var rh6 = a6 || a7; // enum || object is enum | object +>rh6 : E | { a: string; } +>a6 || a7 : E | { a: string; } +>a6 : E +>a7 : { a: string; } + +var rh7 = a7 || a7; // object || object is object +>rh7 : { a: string; } +>a7 || a7 : { a: string; } +>a7 : { a: string; } +>a7 : { a: string; } + +var rh8 = a8 || a7; // array || object is array | object +>rh8 : { a: string; } | string[] +>a8 || a7 : { a: string; } | string[] +>a8 : string[] +>a7 : { a: string; } + +var rh9 = null || a7; // null || object is object +>rh9 : { a: string; } +>null || a7 : { a: string; } +>a7 : { a: string; } + +var rh10 = undefined || a7; // undefined || object is object +>rh10 : { a: string; } +>undefined || a7 : { a: string; } +>undefined : undefined +>a7 : { a: string; } + +var ri1 = a1 || a8; // any || array is any +>ri1 : any +>a1 || a8 : any +>a1 : any +>a8 : string[] + +var ri2 = a2 || a8; // boolean || array is boolean | array +>ri2 : boolean | string[] +>a2 || a8 : boolean | string[] +>a2 : boolean +>a8 : string[] + +var ri3 = a3 || a8; // number || array is number | array +>ri3 : number | string[] +>a3 || a8 : number | string[] +>a3 : number +>a8 : string[] + +var ri4 = a4 || a8; // string || array is string | array +>ri4 : string | string[] +>a4 || a8 : string | string[] +>a4 : string +>a8 : string[] + +var ri5 = a5 || a8; // void || array is void | array +>ri5 : void | string[] +>a5 || a8 : void | string[] +>a5 : void +>a8 : string[] + +var ri6 = a6 || a8; // enum || array is enum | array +>ri6 : E | string[] +>a6 || a8 : E | string[] +>a6 : E +>a8 : string[] + +var ri7 = a7 || a8; // object || array is object | array +>ri7 : { a: string; } | string[] +>a7 || a8 : { a: string; } | string[] +>a7 : { a: string; } +>a8 : string[] + +var ri8 = a8 || a8; // array || array is array +>ri8 : string[] +>a8 || a8 : string[] +>a8 : string[] +>a8 : string[] + +var ri9 = null || a8; // null || array is array +>ri9 : string[] +>null || a8 : string[] +>a8 : string[] + +var ri10 = undefined || a8; // undefined || array is array +>ri10 : string[] +>undefined || a8 : string[] +>undefined : undefined +>a8 : string[] + +var rj1 = a1 || null; // any || null is any +>rj1 : any +>a1 || null : any +>a1 : any + +var rj2 = a2 || null; // boolean || null is boolean +>rj2 : boolean +>a2 || null : boolean +>a2 : boolean + +var rj3 = a3 || null; // number || null is number +>rj3 : number +>a3 || null : number +>a3 : number + +var rj4 = a4 || null; // string || null is string +>rj4 : string +>a4 || null : string +>a4 : string + +var rj5 = a5 || null; // void || null is void +>rj5 : void +>a5 || null : void +>a5 : void + +var rj6 = a6 || null; // enum || null is E +>rj6 : E +>a6 || null : E +>a6 : E + +var rj7 = a7 || null; // object || null is object +>rj7 : { a: string; } +>a7 || null : { a: string; } +>a7 : { a: string; } + +var rj8 = a8 || null; // array || null is array +>rj8 : string[] +>a8 || null : string[] +>a8 : string[] + +var rj9 = null || null; // null || null is any +>rj9 : any +>null || null : null + +var rj10 = undefined || null; // undefined || null is any +>rj10 : any +>undefined || null : null +>undefined : undefined + +var rf1 = a1 || undefined; // any || undefined is any +>rf1 : any +>a1 || undefined : any +>a1 : any +>undefined : undefined + +var rf2 = a2 || undefined; // boolean || undefined is boolean +>rf2 : boolean +>a2 || undefined : boolean +>a2 : boolean +>undefined : undefined + +var rf3 = a3 || undefined; // number || undefined is number +>rf3 : number +>a3 || undefined : number +>a3 : number +>undefined : undefined + +var rf4 = a4 || undefined; // string || undefined is string +>rf4 : string +>a4 || undefined : string +>a4 : string +>undefined : undefined + +var rf5 = a5 || undefined; // void || undefined is void +>rf5 : void +>a5 || undefined : void +>a5 : void +>undefined : undefined + +var rf6 = a6 || undefined; // enum || undefined is E +>rf6 : E +>a6 || undefined : E +>a6 : E +>undefined : undefined + +var rf7 = a7 || undefined; // object || undefined is object +>rf7 : { a: string; } +>a7 || undefined : { a: string; } +>a7 : { a: string; } +>undefined : undefined + +var rf8 = a8 || undefined; // array || undefined is array +>rf8 : string[] +>a8 || undefined : string[] +>a8 : string[] +>undefined : undefined + +var rf9 = null || undefined; // null || undefined is any +>rf9 : any +>null || undefined : null +>undefined : undefined + +var rf10 = undefined || undefined; // undefined || undefined is any +>rf10 : any +>undefined || undefined : undefined +>undefined : undefined +>undefined : undefined + diff --git a/tests/baselines/reference/maxConstraints.errors.txt b/tests/baselines/reference/maxConstraints.errors.txt index 1c3844d6974..16ae5bd2063 100644 --- a/tests/baselines/reference/maxConstraints.errors.txt +++ b/tests/baselines/reference/maxConstraints.errors.txt @@ -1,5 +1,6 @@ tests/cases/compiler/maxConstraints.ts(5,6): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. + Property 'compareTo' is missing in type 'Number'. ==== tests/cases/compiler/maxConstraints.ts (2 errors) ==== @@ -14,4 +15,5 @@ tests/cases/compiler/maxConstraints.ts(8,22): error TS2345: Argument of type 'nu var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. \ No newline at end of file +!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'Comparable'. +!!! error TS2345: Property 'compareTo' is missing in type 'Number'. \ No newline at end of file diff --git a/tests/baselines/reference/memberOverride.errors.txt b/tests/baselines/reference/memberOverride.errors.txt index 0fd0fb57e67..b4974e69e53 100644 --- a/tests/baselines/reference/memberOverride.errors.txt +++ b/tests/baselines/reference/memberOverride.errors.txt @@ -1,9 +1,8 @@ tests/cases/compiler/memberOverride.ts(4,5): error TS2300: Duplicate identifier 'a'. tests/cases/compiler/memberOverride.ts(5,5): error TS2300: Duplicate identifier 'a'. -tests/cases/compiler/memberOverride.ts(8,5): error TS2322: Type 'string' is not assignable to type 'number'. -==== tests/cases/compiler/memberOverride.ts (3 errors) ==== +==== tests/cases/compiler/memberOverride.ts (2 errors) ==== // An object initialiser accepts the first definition for the same property with a different type signature // Should compile, since the second declaration of a overrides the first var x = { @@ -15,6 +14,4 @@ tests/cases/compiler/memberOverride.ts(8,5): error TS2322: Type 'string' is not !!! error TS2300: Duplicate identifier 'a'. } - var n: number = x.a; - ~ -!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file + var n: number = x.a; \ No newline at end of file diff --git a/tests/baselines/reference/mergedModuleDeclarationCodeGen.js b/tests/baselines/reference/mergedModuleDeclarationCodeGen.js new file mode 100644 index 00000000000..88b949dd920 --- /dev/null +++ b/tests/baselines/reference/mergedModuleDeclarationCodeGen.js @@ -0,0 +1,42 @@ +//// [mergedModuleDeclarationCodeGen.ts] +export module X { + export module Y { + class A { + constructor(Y: any) { + new B(); + } + } + } +} +export module X { + export module Y { + export class B { + } + } +} + +//// [mergedModuleDeclarationCodeGen.js] +var X; +(function (X) { + var Y; + (function (_Y) { + var A = (function () { + function A(Y) { + new _Y.B(); + } + return A; + })(); + })(Y = X.Y || (X.Y = {})); +})(X = exports.X || (exports.X = {})); +var X; +(function (X) { + var Y; + (function (Y) { + var B = (function () { + function B() { + } + return B; + })(); + Y.B = B; + })(Y = X.Y || (X.Y = {})); +})(X = exports.X || (exports.X = {})); diff --git a/tests/baselines/reference/methodInAmbientClass1.js b/tests/baselines/reference/methodInAmbientClass1.js new file mode 100644 index 00000000000..73b79b3464c --- /dev/null +++ b/tests/baselines/reference/methodInAmbientClass1.js @@ -0,0 +1,7 @@ +//// [methodInAmbientClass1.ts] + declare class Foo { + fn(): boolean { + } + } + +//// [methodInAmbientClass1.js] diff --git a/tests/baselines/reference/missingArgument1.js b/tests/baselines/reference/missingArgument1.js new file mode 100644 index 00000000000..eed0d9b11d6 --- /dev/null +++ b/tests/baselines/reference/missingArgument1.js @@ -0,0 +1,5 @@ +//// [missingArgument1.ts] +foo(a,,b); + +//// [missingArgument1.js] +foo(a, , b); diff --git a/tests/baselines/reference/modifierOnParameter1.js b/tests/baselines/reference/modifierOnParameter1.js new file mode 100644 index 00000000000..69b54a09384 --- /dev/null +++ b/tests/baselines/reference/modifierOnParameter1.js @@ -0,0 +1,11 @@ +//// [modifierOnParameter1.ts] +class C { + constructor(declare p) { } +} + +//// [modifierOnParameter1.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/modifiersOnInterfaceIndexSignature1.js b/tests/baselines/reference/modifiersOnInterfaceIndexSignature1.js new file mode 100644 index 00000000000..1e91071e36a --- /dev/null +++ b/tests/baselines/reference/modifiersOnInterfaceIndexSignature1.js @@ -0,0 +1,6 @@ +//// [modifiersOnInterfaceIndexSignature1.ts] +interface I { + public [a: string]: number; +} + +//// [modifiersOnInterfaceIndexSignature1.js] diff --git a/tests/baselines/reference/moduleKeywordRepeatError.js b/tests/baselines/reference/moduleKeywordRepeatError.js new file mode 100644 index 00000000000..8ec656f22ae --- /dev/null +++ b/tests/baselines/reference/moduleKeywordRepeatError.js @@ -0,0 +1,10 @@ +//// [moduleKeywordRepeatError.ts] +// "module.module { }" should raise a syntax error + +module.module { } + +//// [moduleKeywordRepeatError.js] +// "module.module { }" should raise a syntax error +module.module; +{ +} diff --git a/tests/baselines/reference/moduleProperty1.js b/tests/baselines/reference/moduleProperty1.js new file mode 100644 index 00000000000..3848203a66f --- /dev/null +++ b/tests/baselines/reference/moduleProperty1.js @@ -0,0 +1,26 @@ +//// [moduleProperty1.ts] +module M { + var x=10; // variable local to this module body + var y=x; // property visible only in module + export var z=y; // property visible to any code +} + +module M2 { + var x = 10; // variable local to this module body + private y = x; // can't use private in modules + export var z = y; // property visible to any code +} + +//// [moduleProperty1.js] +var M; +(function (M) { + var x = 10; // variable local to this module body + var y = x; // property visible only in module + M.z = y; // property visible to any code +})(M || (M = {})); +var M2; +(function (M2) { + var x = 10; // variable local to this module body + y = x; // can't use private in modules + M2.z = y; // property visible to any code +})(M2 || (M2 = {})); diff --git a/tests/baselines/reference/moduleScoping.js b/tests/baselines/reference/moduleScoping.js new file mode 100644 index 00000000000..cbe435e570c --- /dev/null +++ b/tests/baselines/reference/moduleScoping.js @@ -0,0 +1,40 @@ +//// [tests/cases/conformance/externalModules/moduleScoping.ts] //// + +//// [file1.ts] +var v1 = "sausages"; // Global scope + +//// [file2.ts] +var v2 = 42; // Global scope +var v4 = () => 5; + +//// [file3.ts] +export var v3 = true; +var v2 = [1,2,3]; // Module scope. Should not appear in global scope + +//// [file4.ts] +import file3 = require('./file3'); +var t1 = v1; +var t2 = v2; +var t3 = file3.v3; +var v4 = {a: true, b: NaN}; // Should shadow global v2 in this module + +//// [file5.ts] +var x = v2; // Should be global v2 of type number again + + +//// [file1.js] +var v1 = "sausages"; // Global scope +//// [file2.js] +var v2 = 42; // Global scope +var v4 = function () { return 5; }; +//// [file3.js] +exports.v3 = true; +var v2 = [1, 2, 3]; // Module scope. Should not appear in global scope +//// [file4.js] +var file3 = require('./file3'); +var t1 = v1; +var t2 = v2; +var t3 = file3.v3; +var v4 = { a: true, b: NaN }; // Should shadow global v2 in this module +//// [file5.js] +var x = v2; // Should be global v2 of type number again diff --git a/tests/baselines/reference/moduledecl.js b/tests/baselines/reference/moduledecl.js new file mode 100644 index 00000000000..4a27e0fbe1f --- /dev/null +++ b/tests/baselines/reference/moduledecl.js @@ -0,0 +1,512 @@ +//// [moduledecl.ts] +module a { +} + +module b.a { +} + +module c.a.b { + import ma = a; +} + +module mImport { + import d = a; + import e = b.a; + import d1 = a; + import e1 = b.a; +} + +module m0 { + function f1() { + } + + function f2(s: string); + function f2(n: number); + function f2(ns: any) { + } + + class c1 { + public a : ()=>string; + private b: ()=>number; + private static s1; + public static s2; + } + + interface i1 { + () : Object; + [n: number]: c1; + } + + import m2 = a; + import m3 = b; + import m4 = b.a; + import m5 = c; + import m6 = c.a; + import m7 = c.a.b; +} + +module m1 { + export function f1() { + } + + export function f2(s: string); + export function f2(n: number); + export function f2(ns: any) { + } + + export class c1 { + public a: () =>string; + private b: () =>number; + private static s1; + public static s2; + + public d() { + return "Hello"; + } + + public e: { x: number; y: string; }; + constructor (public n, public n2: number, private n3, private n4: string) { + } + } + + export interface i1 { + () : Object; + [n: number]: c1; + } + + import m2 = a; + import m3 = b; + import m4 = b.a; + import m5 = c; + import m6 = c.a; + import m7 = c.a.b; +} + +module m { + export module m2 { + var a = 10; + export var b: number; + } + + export module m3 { + export var c: number; + } +} + +module m { + + export module m25 { + export module m5 { + export var c: number; + } + } +} + +module m13 { + export module m4 { + export module m2 { + export module m3 { + export var c: number; + } + } + + export function f() { + return 20; + } + } +} + +declare module m4 { + export var b; +} + +declare module m5 { + export var c; +} + +declare module m43 { + export var b; +} + +declare module m55 { + export var c; +} + +declare module "m3" { + export var b: number; +} + +module exportTests { + export class C1_public { + private f2() { + return 30; + } + + public f3() { + return "string"; + } + } + class C2_private { + private f2() { + return 30; + } + + public f3() { + return "string"; + } + } + + export class C3_public { + private getC2_private() { + return new C2_private(); + } + private setC2_private(arg: C2_private) { + } + private get c2() { + return new C2_private(); + } + public getC1_public() { + return new C1_public(); + } + public setC1_public(arg: C1_public) { + } + public get c1() { + return new C1_public(); + } + } +} + +declare module mAmbient { + class C { + public myProp: number; + } + + function foo() : C; + var aVar: C; + interface B { + x: number; + y: C; + } + enum e { + x, + y, + z + } + + module m3 { + class C { + public myProp: number; + } + + function foo(): C; + var aVar: C; + interface B { + x: number; + y: C; + } + enum e { + x, + y, + z + } + } +} + +function foo() { + return mAmbient.foo(); +} + +var cVar = new mAmbient.C(); +var aVar = mAmbient.aVar; +var bB: mAmbient.B; +var eVar: mAmbient.e; + +function m3foo() { + return mAmbient.m3.foo(); +} + +var m3cVar = new mAmbient.m3.C(); +var m3aVar = mAmbient.m3.aVar; +var m3bB: mAmbient.m3.B; +var m3eVar: mAmbient.m3.e; + + + +//// [moduledecl.js] +var m0; +(function (m0) { + function f1() { + } + function f2(ns) { + } + var c1 = (function () { + function c1() { + } + return c1; + })(); +})(m0 || (m0 = {})); +var m1; +(function (m1) { + function f1() { + } + m1.f1 = f1; + function f2(ns) { + } + m1.f2 = f2; + var c1 = (function () { + function c1(n, n2, n3, n4) { + this.n = n; + this.n2 = n2; + this.n3 = n3; + this.n4 = n4; + } + c1.prototype.d = function () { + return "Hello"; + }; + return c1; + })(); + m1.c1 = c1; +})(m1 || (m1 = {})); +var m; +(function (m) { + var m2; + (function (m2) { + var a = 10; + m2.b; + })(m2 = m.m2 || (m.m2 = {})); + var m3; + (function (m3) { + m3.c; + })(m3 = m.m3 || (m.m3 = {})); +})(m || (m = {})); +var m; +(function (m) { + var m25; + (function (m25) { + var m5; + (function (m5) { + m5.c; + })(m5 = m25.m5 || (m25.m5 = {})); + })(m25 = m.m25 || (m.m25 = {})); +})(m || (m = {})); +var m13; +(function (m13) { + var m4; + (function (m4) { + var m2; + (function (m2) { + var m3; + (function (m3) { + m3.c; + })(m3 = m2.m3 || (m2.m3 = {})); + })(m2 = m4.m2 || (m4.m2 = {})); + function f() { + return 20; + } + m4.f = f; + })(m4 = m13.m4 || (m13.m4 = {})); +})(m13 || (m13 = {})); +var exportTests; +(function (exportTests) { + var C1_public = (function () { + function C1_public() { + } + C1_public.prototype.f2 = function () { + return 30; + }; + C1_public.prototype.f3 = function () { + return "string"; + }; + return C1_public; + })(); + exportTests.C1_public = C1_public; + var C2_private = (function () { + function C2_private() { + } + C2_private.prototype.f2 = function () { + return 30; + }; + C2_private.prototype.f3 = function () { + return "string"; + }; + return C2_private; + })(); + var C3_public = (function () { + function C3_public() { + } + C3_public.prototype.getC2_private = function () { + return new C2_private(); + }; + C3_public.prototype.setC2_private = function (arg) { + }; + Object.defineProperty(C3_public.prototype, "c2", { + get: function () { + return new C2_private(); + }, + enumerable: true, + configurable: true + }); + C3_public.prototype.getC1_public = function () { + return new C1_public(); + }; + C3_public.prototype.setC1_public = function (arg) { + }; + Object.defineProperty(C3_public.prototype, "c1", { + get: function () { + return new C1_public(); + }, + enumerable: true, + configurable: true + }); + return C3_public; + })(); + exportTests.C3_public = C3_public; +})(exportTests || (exportTests = {})); +function foo() { + return mAmbient.foo(); +} +var cVar = new mAmbient.C(); +var aVar = mAmbient.aVar; +var bB; +var eVar; +function m3foo() { + return mAmbient.m3.foo(); +} +var m3cVar = new mAmbient.m3.C(); +var m3aVar = mAmbient.m3.aVar; +var m3bB; +var m3eVar; + + +//// [moduledecl.d.ts] +declare module a { +} +declare module b.a { +} +declare module c.a.b { +} +declare module mImport { +} +declare module m0 { +} +declare module m1 { + function f1(): void; + function f2(s: string): any; + function f2(n: number): any; + class c1 { + n: any; + n2: number; + private n3; + private n4; + a: () => string; + private b; + private static s1; + static s2: any; + d(): string; + e: { + x: number; + y: string; + }; + constructor(n: any, n2: number, n3: any, n4: string); + } + interface i1 { + (): Object; + [n: number]: c1; + } +} +declare module m { + module m2 { + var b: number; + } + module m3 { + var c: number; + } +} +declare module m { + module m25 { + module m5 { + var c: number; + } + } +} +declare module m13 { + module m4 { + module m2 { + module m3 { + var c: number; + } + } + function f(): number; + } +} +declare module m4 { + var b: any; +} +declare module m5 { + var c: any; +} +declare module m43 { + var b: any; +} +declare module m55 { + var c: any; +} +declare module "m3" { + var b: number; +} +declare module exportTests { + class C1_public { + private f2(); + f3(): string; + } + class C3_public { + private getC2_private(); + private setC2_private(arg); + private c2; + getC1_public(): C1_public; + setC1_public(arg: C1_public): void; + c1: C1_public; + } +} +declare module mAmbient { + class C { + myProp: number; + } + function foo(): C; + var aVar: C; + interface B { + x: number; + y: C; + } + enum e { + x, + y, + z, + } + module m3 { + class C { + myProp: number; + } + function foo(): C; + var aVar: C; + interface B { + x: number; + y: C; + } + enum e { + x, + y, + z, + } + } +} +declare function foo(): mAmbient.C; +declare var cVar: mAmbient.C; +declare var aVar: mAmbient.C; +declare var bB: mAmbient.B; +declare var eVar: mAmbient.e; +declare function m3foo(): mAmbient.m3.C; +declare var m3cVar: mAmbient.m3.C; +declare var m3aVar: mAmbient.m3.C; +declare var m3bB: mAmbient.m3.B; +declare var m3eVar: mAmbient.m3.e; diff --git a/tests/baselines/reference/multipleClassPropertyModifiers.js b/tests/baselines/reference/multipleClassPropertyModifiers.js new file mode 100644 index 00000000000..7dec786c447 --- /dev/null +++ b/tests/baselines/reference/multipleClassPropertyModifiers.js @@ -0,0 +1,14 @@ +//// [multipleClassPropertyModifiers.ts] +class C { + public static p1; + static public p2; + private static p3; + static private p4; +} + +//// [multipleClassPropertyModifiers.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/multipleClassPropertyModifiersErrors.js b/tests/baselines/reference/multipleClassPropertyModifiersErrors.js new file mode 100644 index 00000000000..191476e9a62 --- /dev/null +++ b/tests/baselines/reference/multipleClassPropertyModifiersErrors.js @@ -0,0 +1,17 @@ +//// [multipleClassPropertyModifiersErrors.ts] +class C { + public public p1; + private private p2; + static static p3; + public private p4; + private public p5; + public static p6; + private static p7; +} + +//// [multipleClassPropertyModifiersErrors.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js new file mode 100644 index 00000000000..9cab77f3dba --- /dev/null +++ b/tests/baselines/reference/multipleInheritance.js @@ -0,0 +1,121 @@ +//// [multipleInheritance.ts] +class B1 { + public x; +} + +class B2 { + public x; +} + +class C extends B1, B2 { // duplicate member +} + +class D1 extends B1 { +} + +class D2 extends B2 { +} + +class E extends D1, D2 { // nope, duplicate member +} + +class N { + public y:number; +} + +class ND extends N { // any is assignable to number + public y; +} + +class Good { + public f:() => number = function() { return 0; } + public g() { return 0; } +} + +class Baad extends Good { + public f(): number { return 0; } + public g(n:number) { return 0; } +} + + +//// [multipleInheritance.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var B1 = (function () { + function B1() { + } + return B1; +})(); +var B2 = (function () { + function B2() { + } + return B2; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(B1); +var D1 = (function (_super) { + __extends(D1, _super); + function D1() { + _super.apply(this, arguments); + } + return D1; +})(B1); +var D2 = (function (_super) { + __extends(D2, _super); + function D2() { + _super.apply(this, arguments); + } + return D2; +})(B2); +var E = (function (_super) { + __extends(E, _super); + function E() { + _super.apply(this, arguments); + } + return E; +})(D1); +var N = (function () { + function N() { + } + return N; +})(); +var ND = (function (_super) { + __extends(ND, _super); + function ND() { + _super.apply(this, arguments); + } + return ND; +})(N); +var Good = (function () { + function Good() { + this.f = function () { + return 0; + }; + } + Good.prototype.g = function () { + return 0; + }; + return Good; +})(); +var Baad = (function (_super) { + __extends(Baad, _super); + function Baad() { + _super.apply(this, arguments); + } + Baad.prototype.f = function () { + return 0; + }; + Baad.prototype.g = function (n) { + return 0; + }; + return Baad; +})(Good); diff --git a/tests/baselines/reference/negateOperatorInvalidOperations.js b/tests/baselines/reference/negateOperatorInvalidOperations.js new file mode 100644 index 00000000000..d7aa6154eb2 --- /dev/null +++ b/tests/baselines/reference/negateOperatorInvalidOperations.js @@ -0,0 +1,25 @@ +//// [negateOperatorInvalidOperations.ts] +// Unary operator - + +// operand before - +var NUMBER1 = var NUMBER-; //expect error + +// invalid expressions +var NUMBER2 = -(null - undefined); +var NUMBER3 = -(null - null); +var NUMBER4 = -(undefined - undefined); + +// miss operand +var NUMBER =-; + +//// [negateOperatorInvalidOperations.js] +// Unary operator - +// operand before - +var NUMBER1 = ; +var NUMBER = -; //expect error +// invalid expressions +var NUMBER2 = -(null - undefined); +var NUMBER3 = -(null - null); +var NUMBER4 = -(undefined - undefined); +// miss operand +var NUMBER = -; diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js new file mode 100644 index 00000000000..c7f0ffe34fc --- /dev/null +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -0,0 +1,42 @@ +//// [nestedClassDeclaration.ts] +// nested classes are not allowed + +class C { + x: string; + class C2 { + } +} + +function foo() { + class C3 { + } +} + +var x = { + class C4 { + } +} + + +//// [nestedClassDeclaration.js] +// nested classes are not allowed +var C = (function () { + function C() { + } + return C; +})(); +var C2 = (function () { + function C2() { + } + return C2; +})(); +function foo() { +} +var C3 = (function () { + function C3() { + } + return C3; +})(); +var x = { + class: C4 +}, _a = void 0; diff --git a/tests/baselines/reference/newExpressionWithCast.js b/tests/baselines/reference/newExpressionWithCast.js new file mode 100644 index 00000000000..6ce025a4267 --- /dev/null +++ b/tests/baselines/reference/newExpressionWithCast.js @@ -0,0 +1,29 @@ +//// [newExpressionWithCast.ts] + +function Test() { } +// valid but error with noImplicitAny +var test = new Test(); + +function Test2() { } +// parse error +var test2 = new Test2(); + +function Test3() { } +// valid with noImplicitAny +var test3 = new (Test3)(); + + + +//// [newExpressionWithCast.js] +function Test() { +} +// valid but error with noImplicitAny +var test = new Test(); +function Test2() { +} +// parse error +var test2 = new < any > Test2(); +function Test3() { +} +// valid with noImplicitAny +var test3 = new Test3(); diff --git a/tests/baselines/reference/newMissingIdentifier.js b/tests/baselines/reference/newMissingIdentifier.js new file mode 100644 index 00000000000..0b19a8d187b --- /dev/null +++ b/tests/baselines/reference/newMissingIdentifier.js @@ -0,0 +1,6 @@ +//// [newMissingIdentifier.ts] +var x = new (); + + +//// [newMissingIdentifier.js] +var x = new (); diff --git a/tests/baselines/reference/newOperator.js b/tests/baselines/reference/newOperator.js new file mode 100644 index 00000000000..95dc410142e --- /dev/null +++ b/tests/baselines/reference/newOperator.js @@ -0,0 +1,92 @@ +//// [newOperator.ts] +interface ifc { } +// Attempting to 'new' an interface yields poor error +var i = new ifc(); + +// Parens are optional +var x = new Date; +var y = new Date(); + +// Target is not a class or var, good error +var t1 = new 53(); +var t2 = new ''(); +new string; + +// Use in LHS of expression? +(new Date()).toString(); + +// Various spacing +var t3 = new string[]( ); +var t4 = +new +string +[ + ] + ( + ); + +// Unresolved symbol +var f = new q(); + +// not legal +var t5 = new new Date; + +// Can be an expression +new String; + + +module M { + export class T { + x: number; + } +} + +class S { + public get xs(): M.T[] { + return new M.T[]; + } +} + + +//// [newOperator.js] +// Attempting to 'new' an interface yields poor error +var i = new ifc(); +// Parens are optional +var x = new Date; +var y = new Date(); +// Target is not a class or var, good error +var t1 = new 53(); +var t2 = new ''(); +new string; +// Use in LHS of expression? +(new Date()).toString(); +// Various spacing +var t3 = new string[](); +var t4 = new string[](); +// Unresolved symbol +var f = new q(); +// not legal +var t5 = new new Date; +// Can be an expression +new String; +var M; +(function (M) { + var T = (function () { + function T() { + } + return T; + })(); + M.T = T; +})(M || (M = {})); +var S = (function () { + function S() { + } + Object.defineProperty(S.prototype, "xs", { + get: function () { + return new M.T[]; + }, + enumerable: true, + configurable: true + }); + return S; +})(); diff --git a/tests/baselines/reference/newOperatorErrorCases.js b/tests/baselines/reference/newOperatorErrorCases.js new file mode 100644 index 00000000000..8a44d51fb5c --- /dev/null +++ b/tests/baselines/reference/newOperatorErrorCases.js @@ -0,0 +1,71 @@ +//// [newOperatorErrorCases.ts] + +class C0 { + +} +class C1 { + constructor(n: number, s: string) { } +} + +class T { + constructor(n?: T) { } +} + +var anyCtor: { + new (): any; +}; + +var anyCtor1: { + new (n): any; +}; + +interface nestedCtor { + new (): nestedCtor; +} +var nestedCtor: nestedCtor; + +// Construct expression with no parentheses for construct signature with > 0 parameters +var b = new C0 32, ''; // Parse error + +// Generic construct expression with no parentheses +var c1 = new T; +var c1: T<{}>; +var c2 = new T; // Parse error + + +// Construct expression of non-void returning function +function fnNumber(): number { return 32; } +var s = new fnNumber(); // Error + + +//// [newOperatorErrorCases.js] +var C0 = (function () { + function C0() { + } + return C0; +})(); +var C1 = (function () { + function C1(n, s) { + } + return C1; +})(); +var T = (function () { + function T(n) { + } + return T; +})(); +var anyCtor; +var anyCtor1; +var nestedCtor; +// Construct expression with no parentheses for construct signature with > 0 parameters +var b = new C0; +32, ''; // Parse error +// Generic construct expression with no parentheses +var c1 = new T; +var c1; +var c2 = new T(); // Parse error +// Construct expression of non-void returning function +function fnNumber() { + return 32; +} +var s = new fnNumber(); // Error diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInAccessors.js b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInAccessors.js new file mode 100644 index 00000000000..727b1b6087a --- /dev/null +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInAccessors.js @@ -0,0 +1,98 @@ +//// [noCollisionThisExpressionAndLocalVarInAccessors.ts] +class class1 { + get a(): number { + var x2 = { + doStuff: (callback) => () => { + var _this = 2; + return callback(_this); + } + } + + return 10; + } + set a(val: number) { + var x2 = { + doStuff: (callback) => () => { + var _this = 2; + return callback(_this); + } + } + + } +} + +class class2 { + get a(): number { + var _this = 2; + var x2 = { + doStuff: (callback) => () => { + return callback(_this); + } + } + + return 10; + } + set a(val: number) { + var _this = 2; + var x2 = { + doStuff: (callback) => () => { + return callback(_this); + } + } + + } +} + +//// [noCollisionThisExpressionAndLocalVarInAccessors.js] +var class1 = (function () { + function class1() { + } + Object.defineProperty(class1.prototype, "a", { + get: function () { + var x2 = { + doStuff: function (callback) { return function () { + var _this = 2; + return callback(_this); + }; } + }; + return 10; + }, + set: function (val) { + var x2 = { + doStuff: function (callback) { return function () { + var _this = 2; + return callback(_this); + }; } + }; + }, + enumerable: true, + configurable: true + }); + return class1; +})(); +var class2 = (function () { + function class2() { + } + Object.defineProperty(class2.prototype, "a", { + get: function () { + var _this = 2; + var x2 = { + doStuff: function (callback) { return function () { + return callback(_this); + }; } + }; + return 10; + }, + set: function (val) { + var _this = 2; + var x2 = { + doStuff: function (callback) { return function () { + return callback(_this); + }; } + }; + }, + enumerable: true, + configurable: true + }); + return class2; +})(); diff --git a/tests/baselines/reference/numLit.js b/tests/baselines/reference/numLit.js new file mode 100644 index 00000000000..aaec91cde5d --- /dev/null +++ b/tests/baselines/reference/numLit.js @@ -0,0 +1,12 @@ +//// [numLit.ts] +1..toString(); +1.0.toString(); +1.toString(); +1.+2.0 + 3. ; + +//// [numLit.js] +1..toString(); +1.0.toString(); +1.; +toString(); +1. + 2.0 + 3.; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.js new file mode 100644 index 00000000000..339f674b9da --- /dev/null +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations.js @@ -0,0 +1,151 @@ +//// [numericIndexerConstrainsPropertyDeclarations.ts] +// String indexer types constrain the types of named properties in their containing type + +interface MyNumber extends Number { + foo: number; +} + +class C { + [x: number]: string; + + constructor() { } // ok + + a: string; // ok + b: number; // ok + c: () => {} // ok + "d": string; // ok + "e": number; // ok + 1.0: string; // ok + 2.0: number; // error + "3.0": string; // ok + "4.0": number; // error + 3.0: MyNumber // error + + get X() { // ok + return ''; + } + set X(v) { } // ok + + foo() { + return ''; + } + + static sa: number; // ok + static sb: string; // ok + + static foo() { } // ok + static get X() { // ok + return 1; + } +} + +interface I { + [x: number]: string; + + a: string; // ok + b: number; // ok + c: () => {} // ok + "d": string; // ok + "e": number; // ok + 1.0: string; // ok + 2.0: number; // error + (): string; // ok + (x): number // ok + foo(): string; // ok + "3.0": string; // ok + "4.0": number; // error + f: MyNumber; // error +} + +var a: { + [x: number]: string; + + a: string; // ok + b: number; // ok + c: () => {} // ok + "d": string; // ok + "e": number; // ok + 1.0: string; // ok + 2.0: number; // error + (): string; // ok + (x): number // ok + foo(): string; // ok + "3.0": string; // ok + "4.0": number; // error + f: MyNumber; // error +} + +// error +var b: { [x: number]: string; } = { + a: '', + b: 1, + c: () => { }, + "d": '', + "e": 1, + 1.0: '', + 2.0: 1, + "3.0": '', + "4.0": 1, + f: null, + + get X() { + return ''; + }, + set X(v) { }, + foo() { + return ''; + } +} + +//// [numericIndexerConstrainsPropertyDeclarations.js] +// String indexer types constrain the types of named properties in their containing type +var C = (function () { + function C() { + } // ok + Object.defineProperty(C.prototype, "X", { + get: function () { + return ''; + }, + set: function (v) { + } // ok + , + enumerable: true, + configurable: true + }); + C.prototype.foo = function () { + return ''; + }; + C.foo = function () { + }; // ok + Object.defineProperty(C, "X", { + get: function () { + return 1; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var a; +// error +var b = { + a: '', + b: 1, + c: function () { + }, + "d": '', + "e": 1, + 1.0: '', + 2.0: 1, + "3.0": '', + "4.0": 1, + f: null, + get X() { + return ''; + }, + set X(v) { + }, + foo: function () { + return ''; + } +}; diff --git a/tests/baselines/reference/numericNamedPropertyDuplicates.js b/tests/baselines/reference/numericNamedPropertyDuplicates.js new file mode 100644 index 00000000000..e4340d629ea --- /dev/null +++ b/tests/baselines/reference/numericNamedPropertyDuplicates.js @@ -0,0 +1,34 @@ +//// [numericNamedPropertyDuplicates.ts] +class C { + 1: number; + 1.0: number; + static 2: number; + static 2: number; +} + +interface I { + 2: number; + 2.: number; +} + +var a: { + 1: number; + 1: number; +} + +var b = { + 2: 1 + 2: 1 +} + +//// [numericNamedPropertyDuplicates.js] +var C = (function () { + function C() { + } + return C; +})(); +var a; +var b = { + 2: 1, + 2: 1 +}; diff --git a/tests/baselines/reference/objectCreationExpressionInFunctionParameter.js b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.js new file mode 100644 index 00000000000..55ac0c530e6 --- /dev/null +++ b/tests/baselines/reference/objectCreationExpressionInFunctionParameter.js @@ -0,0 +1,18 @@ +//// [objectCreationExpressionInFunctionParameter.ts] +class A { + constructor(public a1: string) { + } +} +function foo(x = new A(123)) { //should error, 123 is not string +}} + +//// [objectCreationExpressionInFunctionParameter.js] +var A = (function () { + function A(a1) { + this.a1 = a1; + } + return A; +})(); +function foo(x) { + if (x === void 0) { x = new A(123); } +} diff --git a/tests/baselines/reference/objectLitArrayDeclNoNew.js b/tests/baselines/reference/objectLitArrayDeclNoNew.js new file mode 100644 index 00000000000..a52ff55fc4d --- /dev/null +++ b/tests/baselines/reference/objectLitArrayDeclNoNew.js @@ -0,0 +1,49 @@ +//// [objectLitArrayDeclNoNew.ts] +declare var console; +"use strict"; +module Test { + export interface IState { + } + + export interface IToken { + } + + export interface ILineTokens { + tokens: IToken[]; + endState: IState; + } + + export class Gar { + public moo: number = 0; + } + + export function bug(): ILineTokens { + var state:IState= null; + return { + tokens: Gar[],//IToken[], // Missing new. Correct syntax is: tokens: new IToken[] + endState: state + }; + } + } +} + +//// [objectLitArrayDeclNoNew.js] +"use strict"; +var Test; +(function (Test) { + var Gar = (function () { + function Gar() { + this.moo = 0; + } + return Gar; + })(); + Test.Gar = Gar; + function bug() { + var state = null; + return { + tokens: Gar[], + endState: state + }; + } + Test.bug = bug; +})(Test || (Test = {})); diff --git a/tests/baselines/reference/objectLitGetterSetter.types b/tests/baselines/reference/objectLitGetterSetter.types index bbb7ee10140..92decfd4068 100644 --- a/tests/baselines/reference/objectLitGetterSetter.types +++ b/tests/baselines/reference/objectLitGetterSetter.types @@ -11,8 +11,8 @@ >obj : {} >({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : PropertyDescriptor >PropertyDescriptor : PropertyDescriptor ->({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : { get: () => number; set: (v: any) => void; configurable?: boolean; enumerable?: boolean; value?: any; writable?: boolean; } ->{ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } } : { get: () => number; set: (v: any) => void; configurable?: boolean; enumerable?: boolean; value?: any; writable?: boolean; } +>({ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } }) : { get: () => number; set: (v: any) => void; } +>{ get: function () { eval("public = 1;"); return 11; }, set: function (v) { } } : { get: () => number; set: (v: any) => void; } get: function () { >get : () => number diff --git a/tests/baselines/reference/objectLitPropertyScoping.js b/tests/baselines/reference/objectLitPropertyScoping.js new file mode 100644 index 00000000000..b9615081e3f --- /dev/null +++ b/tests/baselines/reference/objectLitPropertyScoping.js @@ -0,0 +1,33 @@ +//// [objectLitPropertyScoping.ts] +// Should compile, x and y should not be picked up from the properties + +function makePoint(x: number, y: number) { + return { + get x() { + return x; + }, + get y() { + return y; + }, + dist: function () { + return Math.sqrt(x * x + y * y); + } + } +}; + +//// [objectLitPropertyScoping.js] +// Should compile, x and y should not be picked up from the properties +function makePoint(x, y) { + return { + get x() { + return x; + }, + get y() { + return y; + }, + dist: function () { + return Math.sqrt(x * x + y * y); + } + }; +} +; diff --git a/tests/baselines/reference/objectLiteralContextualTyping.types b/tests/baselines/reference/objectLiteralContextualTyping.types index 495e8df1438..32c9e91b2c7 100644 --- a/tests/baselines/reference/objectLiteralContextualTyping.types +++ b/tests/baselines/reference/objectLiteralContextualTyping.types @@ -24,7 +24,7 @@ var x = foo({ name: "Sprocket" }); >x : string >foo({ name: "Sprocket" }) : string >foo : { (item: Item): string; (item: any): number; } ->{ name: "Sprocket" } : { name: string; description?: string; } +>{ name: "Sprocket" } : { name: string; } >name : string var x: string; @@ -74,7 +74,7 @@ var b = bar({}); >b : {} >bar({}) : {} >bar : (param: { x?: T; }) => T ->{} : { x?: {}; } +>{} : {} var b: {}; >b : {} diff --git a/tests/baselines/reference/objectLiteralErrors.js b/tests/baselines/reference/objectLiteralErrors.js new file mode 100644 index 00000000000..2a72e8a2a77 --- /dev/null +++ b/tests/baselines/reference/objectLiteralErrors.js @@ -0,0 +1,138 @@ +//// [objectLiteralErrors.ts] + +// Multiple properties with the same name +var e1 = { a: 0, a: 0 }; +var e2 = { a: '', a: '' }; +var e3 = { a: 0, a: '' }; +var e4 = { a: true, a: false }; +var e5 = { a: {}, a: {} }; +var e6 = { a: 0, 'a': 0 }; +var e7 = { 'a': 0, a: 0 }; +var e8 = { 'a': 0, "a": 0 }; +var e9 = { 'a': 0, 'a': 0 }; +var e10 = { "a": 0, 'a': 0 }; +var e11 = { 1.0: 0, '1': 0 }; +var e12 = { 0: 0, 0: 0 }; +var e13 = { 0: 0, 0: 0 }; +var e14 = { 0: 0, 0x0: 0 }; +var e14 = { 0: 0, 000: 0 }; +var e15 = { "100": 0, 1e2: 0 }; +var e16 = { 0x20: 0, 3.2e1: 0 }; +var e17 = { a: 0, b: 1, a: 0 }; + +// Accessor and property with the same name +var f1 = { a: 0, get a() { return 0; } }; +var f2 = { a: '', get a() { return ''; } }; +var f3 = { a: 0, get a() { return ''; } }; +var f4 = { a: true, get a() { return false; } }; +var f5 = { a: {}, get a() { return {}; } }; +var f6 = { a: 0, get 'a'() { return 0; } }; +var f7 = { 'a': 0, get a() { return 0; } }; +var f8 = { 'a': 0, get "a"() { return 0; } }; +var f9 = { 'a': 0, get 'a'() { return 0; } }; +var f10 = { "a": 0, get 'a'() { return 0; } }; +var f11 = { 1.0: 0, get '1'() { return 0; } }; +var f12 = { 0: 0, get 0() { return 0; } }; +var f13 = { 0: 0, get 0() { return 0; } }; +var f14 = { 0: 0, get 0x0() { return 0; } }; +var f14 = { 0: 0, get 000() { return 0; } }; +var f15 = { "100": 0, get 1e2() { return 0; } }; +var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; +var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; + +// Get and set accessor with mismatched type annotations +var g1 = { get a(): number { return 4; }, set a(n: string) { } }; +var g2 = { get a() { return 4; }, set a(n: string) { } }; +var g3 = { get a(): number { return undefined; }, set a(n: string) { } }; + + +//// [objectLiteralErrors.js] +// Multiple properties with the same name +var e1 = { a: 0, a: 0 }; +var e2 = { a: '', a: '' }; +var e3 = { a: 0, a: '' }; +var e4 = { a: true, a: false }; +var e5 = { a: {}, a: {} }; +var e6 = { a: 0, 'a': 0 }; +var e7 = { 'a': 0, a: 0 }; +var e8 = { 'a': 0, "a": 0 }; +var e9 = { 'a': 0, 'a': 0 }; +var e10 = { "a": 0, 'a': 0 }; +var e11 = { 1.0: 0, '1': 0 }; +var e12 = { 0: 0, 0: 0 }; +var e13 = { 0: 0, 0: 0 }; +var e14 = { 0: 0, 0x0: 0 }; +var e14 = { 0: 0, 000: 0 }; +var e15 = { "100": 0, 1e2: 0 }; +var e16 = { 0x20: 0, 3.2e1: 0 }; +var e17 = { a: 0, b: 1, a: 0 }; +// Accessor and property with the same name +var f1 = { a: 0, get a() { + return 0; +} }; +var f2 = { a: '', get a() { + return ''; +} }; +var f3 = { a: 0, get a() { + return ''; +} }; +var f4 = { a: true, get a() { + return false; +} }; +var f5 = { a: {}, get a() { + return {}; +} }; +var f6 = { a: 0, get 'a'() { + return 0; +} }; +var f7 = { 'a': 0, get a() { + return 0; +} }; +var f8 = { 'a': 0, get "a"() { + return 0; +} }; +var f9 = { 'a': 0, get 'a'() { + return 0; +} }; +var f10 = { "a": 0, get 'a'() { + return 0; +} }; +var f11 = { 1.0: 0, get '1'() { + return 0; +} }; +var f12 = { 0: 0, get 0() { + return 0; +} }; +var f13 = { 0: 0, get 0() { + return 0; +} }; +var f14 = { 0: 0, get 0x0() { + return 0; +} }; +var f14 = { 0: 0, get 000() { + return 0; +} }; +var f15 = { "100": 0, get 1e2() { + return 0; +} }; +var f16 = { 0x20: 0, get 3.2e1() { + return 0; +} }; +var f17 = { a: 0, get b() { + return 1; +}, get a() { + return 0; +} }; +// Get and set accessor with mismatched type annotations +var g1 = { get a() { + return 4; +}, set a(n) { +} }; +var g2 = { get a() { + return 4; +}, set a(n) { +} }; +var g3 = { get a() { + return undefined; +}, set a(n) { +} }; diff --git a/tests/baselines/reference/objectLiteralErrorsES3.js b/tests/baselines/reference/objectLiteralErrorsES3.js new file mode 100644 index 00000000000..5b98da0039d --- /dev/null +++ b/tests/baselines/reference/objectLiteralErrorsES3.js @@ -0,0 +1,18 @@ +//// [objectLiteralErrorsES3.ts] + +var e1 = { get a() { return 4; } }; +var e2 = { set a(n) { } }; +var e3 = { get a() { return ''; }, set a(n) { } }; + + + +//// [objectLiteralErrorsES3.js] +var e1 = { get a() { + return 4; +} }; +var e2 = { set a(n) { +} }; +var e3 = { get a() { + return ''; +}, set a(n) { +} }; diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.js b/tests/baselines/reference/objectLiteralGettersAndSetters.js new file mode 100644 index 00000000000..b602650ef8d --- /dev/null +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.js @@ -0,0 +1,220 @@ +//// [objectLiteralGettersAndSetters.ts] +// Get and set accessor with the same name +var sameName1a = { get 'a'() { return ''; }, set a(n) { var p = n; var p: string; } }; +var sameName2a = { get 0.0() { return ''; }, set 0(n) { var p = n; var p: string; } }; +var sameName3a = { get 0x20() { return ''; }, set 3.2e1(n) { var p = n; var p: string; } }; +var sameName4a = { get ''() { return ''; }, set ""(n) { var p = n; var p: string; } }; +var sameName5a = { get '\t'() { return ''; }, set '\t'(n) { var p = n; var p: string; } }; +var sameName6a = { get 'a'() { return ''; }, set a(n) { var p = n; var p: string; } }; + +// PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody} +var callSig1 = { num(n: number) { return '' } }; +var callSig1: { num: (n: number) => string; }; +var callSig2 = { num: function (n: number) { return '' } }; +var callSig2: { num: (n: number) => string; }; +var callSig3 = { num: (n: number) => '' }; +var callSig3: { num: (n: number) => string; }; + +// Get accessor only, type of the property is the annotated return type of the get accessor +var getter1 = { get x(): string { return undefined; } }; +var getter1: { x: string; } + +// Get accessor only, type of the property is the inferred return type of the get accessor +var getter2 = { get x() { return ''; } }; +var getter2: { x: string; } + +// Set accessor only, type of the property is the param type of the set accessor +var setter1 = { set x(n: number) { } }; +var setter1: { x: number }; + +// Set accessor only, type of the property is Any for an unannotated set accessor +var setter2 = { set x(n) { } }; +var setter2: { x: any }; + +var anyVar: any; +// Get and set accessor with matching type annotations +var sameType1 = { get x(): string { return undefined; }, set x(n: string) { } }; +var sameType2 = { get x(): Array { return undefined; }, set x(n: number[]) { } }; +var sameType3 = { get x(): any { return undefined; }, set x(n: typeof anyVar) { } }; +var sameType4 = { get x(): Date { return undefined; }, set x(n: Date) { } }; + +// Type of unannotated get accessor return type is the type annotation of the set accessor param +var setParamType1 = { + set n(x: (t: string) => void) { }, + get n() { return (t) => { + var p: string; + var p = t; + } + } +}; +var setParamType2 = { + get n() { return (t) => { + var p: string; + var p = t; + } + }, + set n(x: (t: string) => void) { } +}; + +// Type of unannotated set accessor parameter is the return type annotation of the get accessor +var getParamType1 = { + set n(x) { + var y = x; + var y: string; + }, + get n() { return ''; } +}; +var getParamType2 = { + get n() { return ''; }, + set n(x) { + var y = x; + var y: string; + } +}; + +// Type of unannotated accessors is the inferred return type of the get accessor +var getParamType3 = { + get n() { return ''; }, + set n(x) { + var y = x; + var y: string; + } +}; + + + +//// [objectLiteralGettersAndSetters.js] +// Get and set accessor with the same name +var sameName1a = { get 'a'() { + return ''; +}, set a(n) { + var p = n; + var p; +} }; +var sameName2a = { get 0.0() { + return ''; +}, set 0(n) { + var p = n; + var p; +} }; +var sameName3a = { get 0x20() { + return ''; +}, set 3.2e1(n) { + var p = n; + var p; +} }; +var sameName4a = { get ''() { + return ''; +}, set ""(n) { + var p = n; + var p; +} }; +var sameName5a = { get '\t'() { + return ''; +}, set '\t'(n) { + var p = n; + var p; +} }; +var sameName6a = { get 'a'() { + return ''; +}, set a(n) { + var p = n; + var p; +} }; +// PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody} +var callSig1 = { num: function (n) { + return ''; +} }; +var callSig1; +var callSig2 = { num: function (n) { + return ''; +} }; +var callSig2; +var callSig3 = { num: function (n) { return ''; } }; +var callSig3; +// Get accessor only, type of the property is the annotated return type of the get accessor +var getter1 = { get x() { + return undefined; +} }; +var getter1; +// Get accessor only, type of the property is the inferred return type of the get accessor +var getter2 = { get x() { + return ''; +} }; +var getter2; +// Set accessor only, type of the property is the param type of the set accessor +var setter1 = { set x(n) { +} }; +var setter1; +// Set accessor only, type of the property is Any for an unannotated set accessor +var setter2 = { set x(n) { +} }; +var setter2; +var anyVar; +// Get and set accessor with matching type annotations +var sameType1 = { get x() { + return undefined; +}, set x(n) { +} }; +var sameType2 = { get x() { + return undefined; +}, set x(n) { +} }; +var sameType3 = { get x() { + return undefined; +}, set x(n) { +} }; +var sameType4 = { get x() { + return undefined; +}, set x(n) { +} }; +// Type of unannotated get accessor return type is the type annotation of the set accessor param +var setParamType1 = { + set n(x) { + }, + get n() { + return function (t) { + var p; + var p = t; + }; + } +}; +var setParamType2 = { + get n() { + return function (t) { + var p; + var p = t; + }; + }, + set n(x) { + } +}; +// Type of unannotated set accessor parameter is the return type annotation of the get accessor +var getParamType1 = { + set n(x) { + var y = x; + var y; + }, + get n() { + return ''; + } +}; +var getParamType2 = { + get n() { + return ''; + }, + set n(x) { + var y = x; + var y; + } +}; +// Type of unannotated accessors is the inferred return type of the get accessor +var getParamType3 = { + get n() { + return ''; + }, + set n(x) { + var y = x; + var y; + } +}; diff --git a/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.js b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.js new file mode 100644 index 00000000000..2cbb76b200d --- /dev/null +++ b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.js @@ -0,0 +1,13 @@ +//// [objectLiteralIndexerNoImplicitAny.ts] +interface I { + [s: string]: any; +} + +var x: I = { + p: null +} + +//// [objectLiteralIndexerNoImplicitAny.js] +var x = { + p: null +}; diff --git a/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types new file mode 100644 index 00000000000..14bcc6f5b62 --- /dev/null +++ b/tests/baselines/reference/objectLiteralIndexerNoImplicitAny.types @@ -0,0 +1,16 @@ +=== tests/cases/compiler/objectLiteralIndexerNoImplicitAny.ts === +interface I { +>I : I + + [s: string]: any; +>s : string +} + +var x: I = { +>x : I +>I : I +>{ p: null} : { [x: string]: null; p: null; } + + p: null +>p : null +} diff --git a/tests/baselines/reference/objectLiteralMemberWithModifiers2.js b/tests/baselines/reference/objectLiteralMemberWithModifiers2.js new file mode 100644 index 00000000000..fd8e0a68430 --- /dev/null +++ b/tests/baselines/reference/objectLiteralMemberWithModifiers2.js @@ -0,0 +1,6 @@ +//// [objectLiteralMemberWithModifiers2.ts] +var v = { public get foo() { } } + +//// [objectLiteralMemberWithModifiers2.js] +var v = { get foo() { +} }; diff --git a/tests/baselines/reference/objectLiteralMemberWithQuestionMark1.js b/tests/baselines/reference/objectLiteralMemberWithQuestionMark1.js new file mode 100644 index 00000000000..7d646cfab8e --- /dev/null +++ b/tests/baselines/reference/objectLiteralMemberWithQuestionMark1.js @@ -0,0 +1,6 @@ +//// [objectLiteralMemberWithQuestionMark1.ts] +var v = { foo?() { } } + +//// [objectLiteralMemberWithQuestionMark1.js] +var v = { foo: function () { +} }; diff --git a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js new file mode 100644 index 00000000000..2ad13950b14 --- /dev/null +++ b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js @@ -0,0 +1,6 @@ +//// [objectLiteralMemberWithoutBlock1.ts] +var v = { foo(); } + +//// [objectLiteralMemberWithoutBlock1.js] +var v = { foo: function () { +} }; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js new file mode 100644 index 00000000000..84a5a9342d0 --- /dev/null +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js @@ -0,0 +1,24 @@ +//// [objectLiteralShorthandPropertiesAssignmentError.ts] +var id: number = 10000; +var name: string = "my name"; + +var person: { b: string; id: number } = { name, id }; // error +var person1: { name, id }; // error: can't use short-hand property assignment in type position +function foo(name: string, id: number): { id: string, name: number } { return { name, id }; } // error +function bar(obj: { name: string; id: boolean }) { } +bar({ name, id }); // error + + + +//// [objectLiteralShorthandPropertiesAssignmentError.js] +var id = 10000; +var name = "my name"; +var person = { name: name, id: id }; // error +var person1 = name, id; +; // error: can't use short-hand property assignment in type position +function foo(name, id) { + return { name: name, id: id }; +} // error +function bar(obj) { +} +bar({ name: name, id: id }); // error diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js new file mode 100644 index 00000000000..b008644116b --- /dev/null +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js @@ -0,0 +1,23 @@ +//// [objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.ts] +var id: number = 10000; +var name: string = "my name"; + +var person: { b: string; id: number } = { name, id }; // error +function bar(name: string, id: number): { name: number, id: string } { return { name, id }; } // error +function foo(name: string, id: number): { name: string, id: number } { return { name, id }; } // error +var person1: { name, id }; // error : Can't use shorthand in the type position +var person2: { name: string, id: number } = bar("hello", 5); + +//// [objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js] +var id = 10000; +var name = "my name"; +var person = { name: name, id: id }; // error +function bar(name, id) { + return { name: name, id: id }; +} // error +function foo(name, id) { + return { name: name, id: id }; +} // error +var person1 = name, id; +; // error : Can't use shorthand in the type position +var person2 = bar("hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.js b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.js new file mode 100644 index 00000000000..79e7882796f --- /dev/null +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.js @@ -0,0 +1,43 @@ +//// [objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.ts] +// errors +var y = { + "stringLiteral", + 42, + get e, + set f, + this, + super, + var, + class, + typeof +}; + +var x = { + a.b, + a["ss"], + a[1], +}; + +var v = { class }; // error + +//// [objectLiteralShorthandPropertiesErrorFromNotUsingIdentifier.js] +// errors +var y = { + "stringLiteral": , + 42: , + get e() { + }, + set f() { + }, + this: , + super: , + var: , + class: , + typeof: +}; +var x = { + a: .b, + a: ["ss"], + a: [1] +}; +var v = { class: }; // error diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js new file mode 100644 index 00000000000..010afbc4b9e --- /dev/null +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesErrorWithModule.js @@ -0,0 +1,32 @@ +//// [objectLiteralShorthandPropertiesErrorWithModule.ts] +// module export +var x = "Foo"; +module m { + export var x; +} + +module n { + var z = 10000; + export var y = { + m.x // error + }; +} + +m.y.x; + + +//// [objectLiteralShorthandPropertiesErrorWithModule.js] +// module export +var x = "Foo"; +var m; +(function (m) { + m.x; +})(m || (m = {})); +var n; +(function (n) { + var z = 10000; + n.y = { + m: .x // error + }; +})(n || (n = {})); +m.y.x; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesFunctionArgument2.errors.txt b/tests/baselines/reference/objectLiteralShorthandPropertiesFunctionArgument2.errors.txt index 44426a8afb0..00ac59319ec 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesFunctionArgument2.errors.txt +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesFunctionArgument2.errors.txt @@ -1,4 +1,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesFunctionArgument2.ts(7,5): error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ a: string; id: number; }'. + Property 'a' is missing in type '{ name: string; id: number; }'. ==== tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPropertiesFunctionArgument2.ts (1 errors) ==== @@ -11,4 +12,5 @@ tests/cases/conformance/es6/shorthandPropertyAssignment/objectLiteralShorthandPr foo(person); // error ~~~~~~ !!! error TS2345: Argument of type '{ name: string; id: number; }' is not assignable to parameter of type '{ a: string; id: number; }'. +!!! error TS2345: Property 'a' is missing in type '{ name: string; id: number; }'. \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralWithGetAccessorInsideFunction.js b/tests/baselines/reference/objectLiteralWithGetAccessorInsideFunction.js new file mode 100644 index 00000000000..58216c786ae --- /dev/null +++ b/tests/baselines/reference/objectLiteralWithGetAccessorInsideFunction.js @@ -0,0 +1,19 @@ +//// [objectLiteralWithGetAccessorInsideFunction.ts] +function bar() { + var x = { + get _extraOccluded() { + var occluded = 0; + return occluded; + }, + } +} + +//// [objectLiteralWithGetAccessorInsideFunction.js] +function bar() { + var x = { + get _extraOccluded() { + var occluded = 0; + return occluded; + } + }; +} diff --git a/tests/baselines/reference/objectTypeLiteralSyntax2.js b/tests/baselines/reference/objectTypeLiteralSyntax2.js new file mode 100644 index 00000000000..c0da0ed83d6 --- /dev/null +++ b/tests/baselines/reference/objectTypeLiteralSyntax2.js @@ -0,0 +1,19 @@ +//// [objectTypeLiteralSyntax2.ts] +var x: { + foo: string, + bar: string +} + +// ASI makes this work +var y: { + foo: string + bar: string +} + +var z: { foo: string bar: string } + +//// [objectTypeLiteralSyntax2.js] +var x; +// ASI makes this work +var y; +var z; diff --git a/tests/baselines/reference/objectTypeWithOptionalProperty1.js b/tests/baselines/reference/objectTypeWithOptionalProperty1.js new file mode 100644 index 00000000000..8f949733a49 --- /dev/null +++ b/tests/baselines/reference/objectTypeWithOptionalProperty1.js @@ -0,0 +1,9 @@ +//// [objectTypeWithOptionalProperty1.ts] + var b = { + x?: 1 // error + } + +//// [objectTypeWithOptionalProperty1.js] +var b = { + x: 1 // error +}; diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties.js b/tests/baselines/reference/objectTypesWithOptionalProperties.js new file mode 100644 index 00000000000..c2177e63762 --- /dev/null +++ b/tests/baselines/reference/objectTypesWithOptionalProperties.js @@ -0,0 +1,43 @@ +//// [objectTypesWithOptionalProperties.ts] +// Basic uses of optional properties + +var a: { + x?: number; // ok +} + +interface I { + x?: number; // ok +} + +class C { + x?: number; // error +} + +interface I2 { + x?: T; // ok +} + +class C2 { + x?: T; // error +} + +var b = { + x?: 1 // error +} + +//// [objectTypesWithOptionalProperties.js] +// Basic uses of optional properties +var a; +var C = (function () { + function C() { + } + return C; +})(); +var C2 = (function () { + function C2() { + } + return C2; +})(); +var b = { + x: 1 // error +}; diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js new file mode 100644 index 00000000000..3faa10447b6 --- /dev/null +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -0,0 +1,48 @@ +//// [objectTypesWithOptionalProperties2.ts] +// Illegal attempts to define optional methods + +var a: { + x()?: number; // error +} + +interface I { + x()?: number; // error +} + +class C { + x()?: number; // error +} + +interface I2 { + x()?: T; // error +} + +class C2 { + x()?: T; // error +} + + +var b = { + x()?: 1 // error +} + +//// [objectTypesWithOptionalProperties2.js] +// Illegal attempts to define optional methods +var a; +var C = (function () { + function C() { + } + C.prototype.x = ; + return C; +})(); +var C2 = (function () { + function C2() { + } + C2.prototype.x = ; + return C2; +})(); +var b = { + x: function () { + }, + 1: // error +}; diff --git a/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.js b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.js new file mode 100644 index 00000000000..b47901b2f0c --- /dev/null +++ b/tests/baselines/reference/objectTypesWithPredefinedTypesAsName2.js @@ -0,0 +1,13 @@ +//// [objectTypesWithPredefinedTypesAsName2.ts] +// it is an error to use a predefined type as a type name + +class void {} // parse error unlike the others + +//// [objectTypesWithPredefinedTypesAsName2.js] +// it is an error to use a predefined type as a type name +var = (function () { + function () { + } + return ; +})(); +void {}; // parse error unlike the others diff --git a/tests/baselines/reference/octalIntegerLiteralError.js b/tests/baselines/reference/octalIntegerLiteralError.js new file mode 100644 index 00000000000..068978d2657 --- /dev/null +++ b/tests/baselines/reference/octalIntegerLiteralError.js @@ -0,0 +1,23 @@ +//// [octalIntegerLiteralError.ts] +// error +var oct1 = 0O13334823; +var oct2 = 0o34318592; + +var obj1 = { + 0O45436: "hi", + 19230: "Hello", + "19230": "world", +}; + + +//// [octalIntegerLiteralError.js] +// error +var oct1 = 5852; +823; +var oct2 = 1817; +8592; +var obj1 = { + 19230: "hi", + 19230: "Hello", + "19230": "world" +}; diff --git a/tests/baselines/reference/octalLiteralInStrictModeES3.js b/tests/baselines/reference/octalLiteralInStrictModeES3.js new file mode 100644 index 00000000000..9519503ed36 --- /dev/null +++ b/tests/baselines/reference/octalLiteralInStrictModeES3.js @@ -0,0 +1,7 @@ +//// [octalLiteralInStrictModeES3.ts] +"use strict"; +03; + +//// [octalLiteralInStrictModeES3.js] +"use strict"; +03; diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.types b/tests/baselines/reference/optionalAccessorsInInterface1.types index f1dcd854f75..c426cdba178 100644 --- a/tests/baselines/reference/optionalAccessorsInInterface1.types +++ b/tests/baselines/reference/optionalAccessorsInInterface1.types @@ -21,7 +21,7 @@ defineMyProperty({}, "name", { get: function () { return 5; } }); >defineMyProperty({}, "name", { get: function () { return 5; } }) : any >defineMyProperty : (o: any, p: string, attributes: MyPropertyDescriptor) => any >{} : {} ->{ get: function () { return 5; } } : { get: () => number; set?(v: any): void; } +>{ get: function () { return 5; } } : { get: () => number; } >get : () => number >function () { return 5; } : () => number @@ -47,7 +47,7 @@ defineMyProperty2({}, "name", { get: function () { return 5; } }); >defineMyProperty2({}, "name", { get: function () { return 5; } }) : any >defineMyProperty2 : (o: any, p: string, attributes: MyPropertyDescriptor2) => any >{} : {} ->{ get: function () { return 5; } } : { get: () => number; set?: (v: any) => void; } +>{ get: function () { return 5; } } : { get: () => number; } >get : () => number >function () { return 5; } : () => number diff --git a/tests/baselines/reference/optionalArgsWithDefaultValues.js b/tests/baselines/reference/optionalArgsWithDefaultValues.js new file mode 100644 index 00000000000..12ab7c9f330 --- /dev/null +++ b/tests/baselines/reference/optionalArgsWithDefaultValues.js @@ -0,0 +1,37 @@ +//// [optionalArgsWithDefaultValues.ts] +function foo(x: number, y?:boolean=false, z?=0) {} + +class CCC { + public foo(x: number, y?:boolean=false, z?=0) {} + static foo2(x: number, y?:boolean=false, z?=0) {} +} + +var a = (x?=0) => { return 1; }; +var b = (x, y?:number = 2) => { x; }; + +//// [optionalArgsWithDefaultValues.js] +function foo(x, y, z) { + if (y === void 0) { y = false; } + if (z === void 0) { z = 0; } +} +var CCC = (function () { + function CCC() { + } + CCC.prototype.foo = function (x, y, z) { + if (y === void 0) { y = false; } + if (z === void 0) { z = 0; } + }; + CCC.foo2 = function (x, y, z) { + if (y === void 0) { y = false; } + if (z === void 0) { z = 0; } + }; + return CCC; +})(); +var a = function (x) { + if (x === void 0) { x = 0; } + return 1; +}; +var b = function (x, y) { + if (y === void 0) { y = 2; } + x; +}; diff --git a/tests/baselines/reference/optionalBindingParameters1.errors.txt b/tests/baselines/reference/optionalBindingParameters1.errors.txt index a2961fb9651..78fc1cbddf1 100644 --- a/tests/baselines/reference/optionalBindingParameters1.errors.txt +++ b/tests/baselines/reference/optionalBindingParameters1.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(2,14): error TS2463: A binding pattern parameter cannot be optional in an implementation signature. tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'. + Types of property '0' are incompatible. + Type 'boolean' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts (2 errors) ==== @@ -14,4 +16,6 @@ tests/cases/conformance/es6/destructuring/optionalBindingParameters1.ts(8,5): er foo([false, 0, ""]); ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'. \ No newline at end of file +!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'. +!!! error TS2345: Types of property '0' are incompatible. +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt b/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt index 5999ec514b0..312603d2c2e 100644 --- a/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt +++ b/tests/baselines/reference/optionalBindingParametersInOverloads1.errors.txt @@ -1,4 +1,6 @@ tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts(9,5): error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'. + Types of property '0' are incompatible. + Type 'boolean' is not assignable to type 'string'. ==== tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1.ts (1 errors) ==== @@ -12,4 +14,6 @@ tests/cases/conformance/es6/destructuring/optionalBindingParametersInOverloads1. foo([false, 0, ""]); ~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'. \ No newline at end of file +!!! error TS2345: Argument of type '[boolean, number, string]' is not assignable to parameter of type '[string, number, boolean]'. +!!! error TS2345: Types of property '0' are incompatible. +!!! error TS2345: Type 'boolean' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js new file mode 100644 index 00000000000..942b95d245e --- /dev/null +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -0,0 +1,270 @@ +//// [optionalParamArgsTest.ts] +// Optional parameter and default argument tests + +// Key: +// Cx - "Class x" +// My - "Method x" +// Az - "Argument z" +// E.g., C1M1A1 = "Class 1, Method 1, Argument 1" + +interface I1 { + C1M1():number; + C1M2(C1M2A1:number):number; + C1M3(C1M3A1?:number,C1M3A2?:number):number; + C1M4(C1M4A1:number,C1M4A2?:number):number; +} + +// test basic configurations +class C1 { + constructor(v: number = 1, p: number = 0) { } + public n:number = 0; + + public C1M1() { return 0; } // returning C1M1A1 will result in "Unresolved symbol C1M1A1" + + public C1M2(C1M2A1:number) { return C1M2A1; } // will return C1M1A2 without complaint + + // C1M3 contains all optional parameters + public C1M3(C1M3A1:number=0,C1M3A2:number=C1M3A1) {return C1M3A1 + C1M3A2; } + + // C1M4 contains a mix of optional and non-optional parameters + public C1M4(C1M4A1:number,C1M4A2?:number) { return C1M4A1 + C1M4A2; } + + public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3?:number) { return C1M5A1 + C1M5A2; } + + // Negative test + // "Optional parameters may only be followed by other optional parameters" + public C1M5(C1M5A1:number,C1M5A2:number=0,C1M5A3:number) { return C1M5A1 + C1M5A2; } +} + +class C2 extends C1 { + constructor(v2: number = 6) { + super(v2); + } +} + + +function F1() { return 0; } +function F2(F2A1:number) { return F2A1; } +function F3(F3A1=0,F3A2=F3A1) {return F3A1 + F3A2; } +function F4(F4A1:number,F4A2?:number) { return F4A1 + F4A2; } + +var L1 = function() {return 0;} +var L2 = function (L2A1:number) { return L2A1; } +var L3 = function (L3A1=0,L3A2=L3A1) {return L3A1 + L3A2; } +var L4 = function (L4A1:number,L4A2?:number) { return L4A1 + L4A2; } + +var c1o1:C1 = new C1(5); +var i1o1:I1 = new C1(5); +// Valid +c1o1.C1M1(); +var f1v1=F1(); +var l1v1=L1(); + +// Valid +c1o1.C1M2(1); +i1o1.C1M2(1); +var f2v1=F2(1); +var l2v1=L2(1); + +// Valid +c1o1.C1M3(1,2); +i1o1.C1M3(1,2); +var f3v1=F3(1,2); +var l3v1=L3(1,2); + +// Valid +c1o1.C1M4(1,2); +i1o1.C1M4(1,2); +var f4v1=F4(1,2); +var l4v1=L4(1,2); + +// Valid +c1o1.C1M3(1); +i1o1.C1M3(1); +var f3v2=F3(1); +var l3v2=L3(1); + +// Valid +c1o1.C1M3(); +i1o1.C1M3(); +var f3v3=F3(); +var l3v3=L3(); + +// Valid +c1o1.C1M4(1); +i1o1.C1M4(1); +var f4v2=F4(1); +var l4v2=L4(1); + +// Negative tests - we expect these cases to fail +c1o1.C1M1(1); +i1o1.C1M1(1); +F1(1); +L1(1); +c1o1.C1M2(); +i1o1.C1M2(); +F2(); +L2(); +c1o1.C1M2(1,2); +i1o1.C1M2(1,2); +F2(1,2); +L2(1,2); +c1o1.C1M3(1,2,3); +i1o1.C1M3(1,2,3); +F3(1,2,3); +L3(1,2,3); +c1o1.C1M4(); +i1o1.C1M4(); +F4(); +L4(); + +function fnOpt1(id: number, children: number[] = [], expectedPath: number[] = [], isRoot?: boolean): void {} +function fnOpt2(id: number, children?: number[], expectedPath?: number[], isRoot?: boolean): void {} +fnOpt1(1, [2, 3], [1], true); +fnOpt2(1, [2, 3], [1], true); + + +//// [optionalParamArgsTest.js] +// Optional parameter and default argument tests +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +// test basic configurations +var C1 = (function () { + function C1(v, p) { + if (v === void 0) { v = 1; } + if (p === void 0) { p = 0; } + this.n = 0; + } + C1.prototype.C1M1 = function () { + return 0; + }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" + C1.prototype.C1M2 = function (C1M2A1) { + return C1M2A1; + }; // will return C1M1A2 without complaint + // C1M3 contains all optional parameters + C1.prototype.C1M3 = function (C1M3A1, C1M3A2) { + if (C1M3A1 === void 0) { C1M3A1 = 0; } + if (C1M3A2 === void 0) { C1M3A2 = C1M3A1; } + return C1M3A1 + C1M3A2; + }; + // C1M4 contains a mix of optional and non-optional parameters + C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { + return C1M4A1 + C1M4A2; + }; + C1.prototype.C1M5 = function (C1M5A1, C1M5A2, C1M5A3) { + if (C1M5A2 === void 0) { C1M5A2 = 0; } + return C1M5A1 + C1M5A2; + }; + // Negative test + // "Optional parameters may only be followed by other optional parameters" + C1.prototype.C1M5 = function (C1M5A1, C1M5A2, C1M5A3) { + if (C1M5A2 === void 0) { C1M5A2 = 0; } + return C1M5A1 + C1M5A2; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2(v2) { + if (v2 === void 0) { v2 = 6; } + _super.call(this, v2); + } + return C2; +})(C1); +function F1() { + return 0; +} +function F2(F2A1) { + return F2A1; +} +function F3(F3A1, F3A2) { + if (F3A1 === void 0) { F3A1 = 0; } + if (F3A2 === void 0) { F3A2 = F3A1; } + return F3A1 + F3A2; +} +function F4(F4A1, F4A2) { + return F4A1 + F4A2; +} +var L1 = function () { + return 0; +}; +var L2 = function (L2A1) { + return L2A1; +}; +var L3 = function (L3A1, L3A2) { + if (L3A1 === void 0) { L3A1 = 0; } + if (L3A2 === void 0) { L3A2 = L3A1; } + return L3A1 + L3A2; +}; +var L4 = function (L4A1, L4A2) { + return L4A1 + L4A2; +}; +var c1o1 = new C1(5); +var i1o1 = new C1(5); +// Valid +c1o1.C1M1(); +var f1v1 = F1(); +var l1v1 = L1(); +// Valid +c1o1.C1M2(1); +i1o1.C1M2(1); +var f2v1 = F2(1); +var l2v1 = L2(1); +// Valid +c1o1.C1M3(1, 2); +i1o1.C1M3(1, 2); +var f3v1 = F3(1, 2); +var l3v1 = L3(1, 2); +// Valid +c1o1.C1M4(1, 2); +i1o1.C1M4(1, 2); +var f4v1 = F4(1, 2); +var l4v1 = L4(1, 2); +// Valid +c1o1.C1M3(1); +i1o1.C1M3(1); +var f3v2 = F3(1); +var l3v2 = L3(1); +// Valid +c1o1.C1M3(); +i1o1.C1M3(); +var f3v3 = F3(); +var l3v3 = L3(); +// Valid +c1o1.C1M4(1); +i1o1.C1M4(1); +var f4v2 = F4(1); +var l4v2 = L4(1); +// Negative tests - we expect these cases to fail +c1o1.C1M1(1); +i1o1.C1M1(1); +F1(1); +L1(1); +c1o1.C1M2(); +i1o1.C1M2(); +F2(); +L2(); +c1o1.C1M2(1, 2); +i1o1.C1M2(1, 2); +F2(1, 2); +L2(1, 2); +c1o1.C1M3(1, 2, 3); +i1o1.C1M3(1, 2, 3); +F3(1, 2, 3); +L3(1, 2, 3); +c1o1.C1M4(); +i1o1.C1M4(); +F4(); +L4(); +function fnOpt1(id, children, expectedPath, isRoot) { + if (children === void 0) { children = []; } + if (expectedPath === void 0) { expectedPath = []; } +} +function fnOpt2(id, children, expectedPath, isRoot) { +} +fnOpt1(1, [2, 3], [1], true); +fnOpt2(1, [2, 3], [1], true); diff --git a/tests/baselines/reference/optionalPropertiesSyntax.js b/tests/baselines/reference/optionalPropertiesSyntax.js new file mode 100644 index 00000000000..21a572757ec --- /dev/null +++ b/tests/baselines/reference/optionalPropertiesSyntax.js @@ -0,0 +1,38 @@ +//// [optionalPropertiesSyntax.ts] +interface fnSigs { + //functions signatures can be optional + fn(): void; + fn?(): void; //err + fn2?(): void; +} + +interface callSig { + //Call signatures can't be optional + (): any; + ()?: any; //err + ?(): any; //err +} + +interface constructSig { + //Construct signatures can't be optional + new (): any; + new ()?: any; //err + new ?(): any; //err +} + +interface propertySig { + //Property signatures can be optional + prop: any; + prop?: any; + prop2?: any; +} + +interface indexSig { + //Index signatures can't be optional + [idx: number]: any; + [idx: number]?: any; //err + ? [idx: number]: any; //err + [idx?: number]: any; //err +} + +//// [optionalPropertiesSyntax.js] diff --git a/tests/baselines/reference/optionalPropertiesTest.errors.txt b/tests/baselines/reference/optionalPropertiesTest.errors.txt index a904911e232..a4b721e92ef 100644 --- a/tests/baselines/reference/optionalPropertiesTest.errors.txt +++ b/tests/baselines/reference/optionalPropertiesTest.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/optionalPropertiesTest.ts(14,1): error TS2322: Type '{ name: string; print?(): void; }' is not assignable to type 'IFoo'. - Property 'id' is missing in type '{ name: string; print?(): void; }'. +tests/cases/compiler/optionalPropertiesTest.ts(14,1): error TS2322: Type '{ name: string; }' is not assignable to type 'IFoo'. + Property 'id' is missing in type '{ name: string; }'. tests/cases/compiler/optionalPropertiesTest.ts(25,5): error TS2322: Type '{}' is not assignable to type 'i1'. Property 'M' is missing in type '{}'. tests/cases/compiler/optionalPropertiesTest.ts(26,5): error TS2322: Type '{}' is not assignable to type 'i3'. @@ -24,8 +24,8 @@ tests/cases/compiler/optionalPropertiesTest.ts(40,1): error TS2322: Type 'i2' is foo = { id: 1234, name: "test" }; // Ok foo = { name: "test" }; // Error, id missing ~~~ -!!! error TS2322: Type '{ name: string; print?(): void; }' is not assignable to type 'IFoo'. -!!! error TS2322: Property 'id' is missing in type '{ name: string; print?(): void; }'. +!!! error TS2322: Type '{ name: string; }' is not assignable to type 'IFoo'. +!!! error TS2322: Property 'id' is missing in type '{ name: string; }'. foo = {id: 1234, print:()=>{}} // Ok var s = foo.name || "default"; diff --git a/tests/baselines/reference/optionalSetterParam.js b/tests/baselines/reference/optionalSetterParam.js new file mode 100644 index 00000000000..4b9b7f01360 --- /dev/null +++ b/tests/baselines/reference/optionalSetterParam.js @@ -0,0 +1,19 @@ +//// [optionalSetterParam.ts] +class foo { + + public set bar(param?:any) { } +} + + +//// [optionalSetterParam.js] +var foo = (function () { + function foo() { + } + Object.defineProperty(foo.prototype, "bar", { + set: function (param) { + }, + enumerable: true, + configurable: true + }); + return foo; +})(); diff --git a/tests/baselines/reference/overEagerReturnTypeSpecialization.js b/tests/baselines/reference/overEagerReturnTypeSpecialization.js index 18c61a2aa78..67d2005eca9 100644 --- a/tests/baselines/reference/overEagerReturnTypeSpecialization.js +++ b/tests/baselines/reference/overEagerReturnTypeSpecialization.js @@ -16,5 +16,7 @@ var r2: I1 = v1.func(num => num.toString()) // Correctly returns an I1 +.func(function (str) { return str.length; }); // should error +var r2 = v1.func(function (num) { return num.toString(); }) // Correctly returns an I1 +.func(function (str) { return str.length; }); // should be ok diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types index f597c93bdda..311cf971b61 100644 --- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries.types @@ -105,17 +105,17 @@ var a1 = a.a({}); >a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } >a : A >a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } ->{} : { r?: any; } +>{} : {} var a1 = a({}); >a1 : Opt3 >a({}) : Opt3 >a : A ->{} : { r?: any; } +>{} : {} var a1 = new a({}); >a1 : Opt3 >new a({}) : Opt3 >a : A ->{} : { r?: any; } +>{} : {} diff --git a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types index a854c159e0c..e67ff2f8de6 100644 --- a/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types +++ b/tests/baselines/reference/overloadBindingAcrossDeclarationBoundaries2.types @@ -108,17 +108,17 @@ var a1 = a.a({}); >a.a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } >a : A >a : { (o: Opt1): Opt1; (o: Opt2): Opt2; (o: Opt3): Opt3; (o: Opt4): Opt4; } ->{} : { r?: any; } +>{} : {} var a1 = a({}); >a1 : Opt3 >a({}) : Opt3 >a : A ->{} : { r?: any; } +>{} : {} var a1 = new a({}); >a1 : Opt3 >new a({}) : Opt3 >a : A ->{} : { r?: any; } +>{} : {} diff --git a/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js new file mode 100644 index 00000000000..48e52ba0967 --- /dev/null +++ b/tests/baselines/reference/overloadOnConstAsTypeAnnotation.js @@ -0,0 +1,9 @@ +//// [overloadOnConstAsTypeAnnotation.ts] +var f: (x: 'hi') => number = ('hi') => { return 1; }; + +//// [overloadOnConstAsTypeAnnotation.js] +var f = ('hi'); +{ + return 1; +} +; diff --git a/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt b/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt index 03901cf67a4..9fc11b681c7 100644 --- a/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt +++ b/tests/baselines/reference/overloadResolutionOverCTLambda.errors.txt @@ -1,8 +1,10 @@ tests/cases/compiler/overloadResolutionOverCTLambda.ts(2,5): error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'. + Type 'number' is not assignable to type 'boolean'. ==== tests/cases/compiler/overloadResolutionOverCTLambda.ts (1 errors) ==== function foo(b: (item: number) => boolean) { } foo(a => a); // can not convert (number)=>bool to (number)=>number ~~~~~~ -!!! error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'. \ No newline at end of file +!!! error TS2345: Argument of type '(a: number) => number' is not assignable to parameter of type '(item: number) => boolean'. +!!! error TS2345: Type 'number' is not assignable to type 'boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadingStaticFunctionsInFunctions.js b/tests/baselines/reference/overloadingStaticFunctionsInFunctions.js new file mode 100644 index 00000000000..7e926a6250a --- /dev/null +++ b/tests/baselines/reference/overloadingStaticFunctionsInFunctions.js @@ -0,0 +1,15 @@ +//// [overloadingStaticFunctionsInFunctions.ts] +function boo { + static test() + static test(name:string) + static test(name?:any){ } +} + +//// [overloadingStaticFunctionsInFunctions.js] +function boo() { + test(); + test(name, string); + test(name ? : any); + { + } +} diff --git a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt index 4a119c5ca22..ed504fd410d 100644 --- a/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt +++ b/tests/baselines/reference/overloadresolutionWithConstraintCheckingDeferred.errors.txt @@ -1,8 +1,11 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(14,37): error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'. + Property 'x' is missing in type 'D'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,5): error TS2322: Type 'string' is not assignable to type 'number'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(16,38): error TS2344: Type 'D' does not satisfy the constraint 'A'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(18,27): error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. + Types of parameters 'x' and 'x' are incompatible. + Type 'D' is not assignable to type 'B'. tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): error TS2344: Type 'D' does not satisfy the constraint 'A'. @@ -25,6 +28,7 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): !!! error TS2322: Type 'string' is not assignable to type 'number'. ~ !!! error TS2345: Argument of type 'D' is not assignable to parameter of type 'A'. +!!! error TS2345: Property 'x' is missing in type 'D'. var result2: number = foo(x => new G(x)); // x has type D, new G(x) fails, so first overload is picked. ~~~~~~~ @@ -43,4 +47,6 @@ tests/cases/compiler/overloadresolutionWithConstraintCheckingDeferred.ts(19,12): }); ~ !!! error TS2345: Argument of type '(x: D) => G' is not assignable to parameter of type '(x: B) => any'. +!!! error TS2345: Types of parameters 'x' and 'x' are incompatible. +!!! error TS2345: Type 'D' is not assignable to type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt index bd918de55fe..55fe8ed4fde 100644 --- a/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt +++ b/tests/baselines/reference/overloadsWithProvisionalErrors.errors.txt @@ -1,6 +1,8 @@ tests/cases/compiler/overloadsWithProvisionalErrors.ts(6,6): error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. + Type '{}' is not assignable to type '{ a: number; b: number; }'. tests/cases/compiler/overloadsWithProvisionalErrors.ts(7,17): error TS2304: Cannot find name 'blah'. tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,6): error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. + Type '{ a: any; }' is not assignable to type '{ a: number; b: number; }'. tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cannot find name 'blah'. @@ -13,11 +15,13 @@ tests/cases/compiler/overloadsWithProvisionalErrors.ts(8,17): error TS2304: Cann func(s => ({})); // Error for no applicable overload (object type is missing a and b) ~~~~~~~~~ !!! error TS2345: Argument of type '(s: string) => {}' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +!!! error TS2345: Type '{}' is not assignable to type '{ a: number; b: number; }'. func(s => ({ a: blah, b: 3 })); // Only error inside the function, but not outside (since it would be applicable if not for the provisional error) ~~~~ !!! error TS2304: Cannot find name 'blah'. func(s => ({ a: blah })); // Two errors here, one for blah not being defined, and one for the overload since it would not be applicable anyway ~~~~~~~~~~~~~~~~~~ !!! error TS2345: Argument of type '(s: string) => { a: any; }' is not assignable to parameter of type '(s: string) => { a: number; b: number; }'. +!!! error TS2345: Type '{ a: any; }' is not assignable to type '{ a: number; b: number; }'. ~~~~ !!! error TS2304: Cannot find name 'blah'. \ No newline at end of file diff --git a/tests/baselines/reference/parenthesizedContexualTyping1.types b/tests/baselines/reference/parenthesizedContexualTyping1.types index 60020fd8eb2..925347ed1b3 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping1.types +++ b/tests/baselines/reference/parenthesizedContexualTyping1.types @@ -220,11 +220,11 @@ var l = fun(((Math.random() < 0.5 ? ((x => x)) : ((x => undefined)))), ((x => x) >x => undefined : (x: number) => any >x : number >undefined : undefined ->((x => x)) : (x: number) => number ->(x => x) : (x: number) => number ->x => x : (x: number) => number ->x : number ->x : number +>((x => x)) : (x: any) => any +>(x => x) : (x: any) => any +>x => x : (x: any) => any +>x : any +>x : any var lambda1: (x: number) => number = x => x; >lambda1 : (x: number) => number diff --git a/tests/baselines/reference/parenthesizedContexualTyping3.js b/tests/baselines/reference/parenthesizedContexualTyping3.js index 69784d14ce4..cc6dbd44f88 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping3.js +++ b/tests/baselines/reference/parenthesizedContexualTyping3.js @@ -25,11 +25,11 @@ var h = tempFun `${ (x => x) } ${ (((x => x))) } ${ undefined }` function tempFun(tempStrs, g, x) { return g(x); } -var a = tempFun `${function (x) { return x; }} ${10}`; -var b = tempFun `${(function (x) { return x; })} ${10}`; -var c = tempFun `${((function (x) { return x; }))} ${10}`; -var d = tempFun `${function (x) { return x; }} ${function (x) { return x; }} ${10}`; -var e = tempFun `${function (x) { return x; }} ${(function (x) { return x; })} ${10}`; -var f = tempFun `${function (x) { return x; }} ${((function (x) { return x; }))} ${10}`; -var g = tempFun `${(function (x) { return x; })} ${(((function (x) { return x; })))} ${10}`; -var h = tempFun `${(function (x) { return x; })} ${(((function (x) { return x; })))} ${undefined}`; +var a = tempFun `${x => { return x; }} ${10}`; +var b = tempFun `${(x => { return x; })} ${10}`; +var c = tempFun `${((x => { return x; }))} ${10}`; +var d = tempFun `${x => { return x; }} ${x => { return x; }} ${10}`; +var e = tempFun `${x => { return x; }} ${(x => { return x; })} ${10}`; +var f = tempFun `${x => { return x; }} ${((x => { return x; }))} ${10}`; +var g = tempFun `${(x => { return x; })} ${(((x => { return x; })))} ${10}`; +var h = tempFun `${(x => { return x; })} ${(((x => { return x; })))} ${undefined}`; diff --git a/tests/baselines/reference/parse1.js b/tests/baselines/reference/parse1.js new file mode 100644 index 00000000000..08af81bda17 --- /dev/null +++ b/tests/baselines/reference/parse1.js @@ -0,0 +1,12 @@ +//// [parse1.ts] +var bar = 42; +function foo() { + bar. +} + + +//// [parse1.js] +var bar = 42; +function foo() { + bar.; +} diff --git a/tests/baselines/reference/parse2.js b/tests/baselines/reference/parse2.js new file mode 100644 index 00000000000..69bc1e9e5e4 --- /dev/null +++ b/tests/baselines/reference/parse2.js @@ -0,0 +1,9 @@ +//// [parse2.ts] +function foo() { + foo( +} + +//// [parse2.js] +function foo() { + foo(); +} diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js new file mode 100644 index 00000000000..d08a4920171 --- /dev/null +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -0,0 +1,18 @@ +//// [parseErrorInHeritageClause1.ts] +class C extends A # { +} + +//// [parseErrorInHeritageClause1.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parseIncompleteBinaryExpression1.js b/tests/baselines/reference/parseIncompleteBinaryExpression1.js new file mode 100644 index 00000000000..f136e318ae4 --- /dev/null +++ b/tests/baselines/reference/parseIncompleteBinaryExpression1.js @@ -0,0 +1,5 @@ +//// [parseIncompleteBinaryExpression1.ts] +var v = || b; + +//// [parseIncompleteBinaryExpression1.js] +var v = || b; diff --git a/tests/baselines/reference/parser0_004152.js b/tests/baselines/reference/parser0_004152.js new file mode 100644 index 00000000000..cce49f68fcc --- /dev/null +++ b/tests/baselines/reference/parser0_004152.js @@ -0,0 +1,14 @@ +//// [parser0_004152.ts] +export class Game { + private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0); + private prevConfig: SeedCoords[][]; +} + +//// [parser0_004152.js] +var Game = (function () { + function Game() { + this.position = new DisplayPosition([]); + } + return Game; +})(); +exports.Game = Game; diff --git a/tests/baselines/reference/parser10.1.1-8gs.js b/tests/baselines/reference/parser10.1.1-8gs.js new file mode 100644 index 00000000000..85227fab116 --- /dev/null +++ b/tests/baselines/reference/parser10.1.1-8gs.js @@ -0,0 +1,37 @@ +//// [parser10.1.1-8gs.ts] +/// Copyright (c) 2012 Ecma International. All rights reserved. +/// Ecma International makes this code available under the terms and conditions set +/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +/// "Use Terms"). Any redistribution of this code must retain the above +/// copyright and this notice and otherwise comply with the Use Terms. + +/** + * @path ch10/10.1/10.1.1/10.1.1-8gs.js + * @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears twice in the code + * @noStrict + * @negative ^((?!NotEarlyError).)*$ + */ + +"use strict"; +"use strict"; +throw NotEarlyError; +var public = 1; + + +//// [parser10.1.1-8gs.js] +/// Copyright (c) 2012 Ecma International. All rights reserved. +/// Ecma International makes this code available under the terms and conditions set +/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the +/// "Use Terms"). Any redistribution of this code must retain the above +/// copyright and this notice and otherwise comply with the Use Terms. +/** + * @path ch10/10.1/10.1.1/10.1.1-8gs.js + * @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears twice in the code + * @noStrict + * @negative ^((?!NotEarlyError).)*$ + */ +"use strict"; +"use strict"; +throw NotEarlyError; +var ; +1; diff --git a/tests/baselines/reference/parser509546.js b/tests/baselines/reference/parser509546.js new file mode 100644 index 00000000000..5524a4d606f --- /dev/null +++ b/tests/baselines/reference/parser509546.js @@ -0,0 +1,13 @@ +//// [parser509546.ts] +export class Logger { + public +} + + +//// [parser509546.js] +var Logger = (function () { + function Logger() { + } + return Logger; +})(); +exports.Logger = Logger; diff --git a/tests/baselines/reference/parser509546_1.js b/tests/baselines/reference/parser509546_1.js new file mode 100644 index 00000000000..d0e32feb1ca --- /dev/null +++ b/tests/baselines/reference/parser509546_1.js @@ -0,0 +1,13 @@ +//// [parser509546_1.ts] +export class Logger { + public +} + + +//// [parser509546_1.js] +var Logger = (function () { + function Logger() { + } + return Logger; +})(); +exports.Logger = Logger; diff --git a/tests/baselines/reference/parser509546_2.js b/tests/baselines/reference/parser509546_2.js new file mode 100644 index 00000000000..976bbd1e471 --- /dev/null +++ b/tests/baselines/reference/parser509546_2.js @@ -0,0 +1,16 @@ +//// [parser509546_2.ts] +"use strict"; + +export class Logger { + public +} + + +//// [parser509546_2.js] +"use strict"; +var Logger = (function () { + function Logger() { + } + return Logger; +})(); +exports.Logger = Logger; diff --git a/tests/baselines/reference/parser509618.js b/tests/baselines/reference/parser509618.js new file mode 100644 index 00000000000..d2e894ac364 --- /dev/null +++ b/tests/baselines/reference/parser509618.js @@ -0,0 +1,7 @@ +//// [parser509618.ts] +declare module ambiModule { + interface i1 { }; +} + + +//// [parser509618.js] diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js new file mode 100644 index 00000000000..0d5a96884f3 --- /dev/null +++ b/tests/baselines/reference/parser509630.js @@ -0,0 +1,28 @@ +//// [parser509630.ts] +class Type { + public examples = [ // typing here +} +class Any extends Type { +} + + +//// [parser509630.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Type = (function () { + function Type() { + this.examples = []; // typing here + } + return Type; +})(); +var Any = (function (_super) { + __extends(Any, _super); + function Any() { + _super.apply(this, arguments); + } + return Any; +})(Type); diff --git a/tests/baselines/reference/parser509667.js b/tests/baselines/reference/parser509667.js new file mode 100644 index 00000000000..21e0bc55ce4 --- /dev/null +++ b/tests/baselines/reference/parser509667.js @@ -0,0 +1,27 @@ +//// [parser509667.ts] +class Foo { + f1() { + if (this. + } + + f2() { + } + + f3() { + } +} + +//// [parser509667.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.f1 = function () { + if (this.) + ; + }; + Foo.prototype.f2 = function () { + }; + Foo.prototype.f3 = function () { + }; + return Foo; +})(); diff --git a/tests/baselines/reference/parser509668.js b/tests/baselines/reference/parser509668.js new file mode 100644 index 00000000000..63c5d8a1a95 --- /dev/null +++ b/tests/baselines/reference/parser509668.js @@ -0,0 +1,17 @@ +//// [parser509668.ts] +class Foo3 { + // Doesn't work, but should + constructor (public ...args: string[]) { } +} + +//// [parser509668.js] +var Foo3 = (function () { + // Doesn't work, but should + function Foo3(public) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + } + return Foo3; +})(); diff --git a/tests/baselines/reference/parser509669.js b/tests/baselines/reference/parser509669.js new file mode 100644 index 00000000000..e4ce2b90312 --- /dev/null +++ b/tests/baselines/reference/parser509669.js @@ -0,0 +1,10 @@ +//// [parser509669.ts] +function foo():any { + return ():void {}; +} + +//// [parser509669.js] +function foo() { + return function () { + }; +} diff --git a/tests/baselines/reference/parser512084.js b/tests/baselines/reference/parser512084.js new file mode 100644 index 00000000000..967c8db3cb0 --- /dev/null +++ b/tests/baselines/reference/parser512084.js @@ -0,0 +1,10 @@ +//// [parser512084.ts] +class foo { + + +//// [parser512084.js] +var foo = (function () { + function foo() { + } + return foo; +})(); diff --git a/tests/baselines/reference/parser512097.js b/tests/baselines/reference/parser512097.js new file mode 100644 index 00000000000..f507b86ccd7 --- /dev/null +++ b/tests/baselines/reference/parser512097.js @@ -0,0 +1,10 @@ +//// [parser512097.ts] +var tt = { aa; } // After this point, no useful parsing occurs in the entire file + +if (true) { +} + +//// [parser512097.js] +var tt = { aa: }; +if (true) { +} diff --git a/tests/baselines/reference/parser512325.js b/tests/baselines/reference/parser512325.js new file mode 100644 index 00000000000..14cbcddd86b --- /dev/null +++ b/tests/baselines/reference/parser512325.js @@ -0,0 +1,6 @@ +//// [parser512325.ts] +var tt = (a, (b, c)) => a+b+c; + +//// [parser512325.js] +var tt = (a, (b, c)); +a + b + c; diff --git a/tests/baselines/reference/parser519458.js b/tests/baselines/reference/parser519458.js new file mode 100644 index 00000000000..3c294d593ff --- /dev/null +++ b/tests/baselines/reference/parser519458.js @@ -0,0 +1,8 @@ +//// [parser519458.ts] +import rect = module("rect"); var bar = new rect.Rect(); + + +//// [parser519458.js] +var rect = module; +("rect"); +var bar = new rect.Rect(); diff --git a/tests/baselines/reference/parser521128.js b/tests/baselines/reference/parser521128.js new file mode 100644 index 00000000000..e16cbad6c33 --- /dev/null +++ b/tests/baselines/reference/parser521128.js @@ -0,0 +1,7 @@ +//// [parser521128.ts] +module.module { } + +//// [parser521128.js] +module.module; +{ +} diff --git a/tests/baselines/reference/parser536727.errors.txt b/tests/baselines/reference/parser536727.errors.txt index a25859f78a1..4204e62c93b 100644 --- a/tests/baselines/reference/parser536727.errors.txt +++ b/tests/baselines/reference/parser536727.errors.txt @@ -1,5 +1,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(7,5): error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'. + Type '(x: string) => string' is not assignable to type 'string'. tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(8,5): error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'. + Type '(x: string) => string' is not assignable to type 'string'. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts (2 errors) ==== @@ -12,7 +14,9 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser536727.ts(8,5): foo(() => g); ~~~~~~~ !!! error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type '(x: string) => string' is not assignable to type 'string'. foo(x); ~ !!! error TS2345: Argument of type '() => (x: string) => string' is not assignable to parameter of type '(x: string) => string'. +!!! error TS2345: Type '(x: string) => string' is not assignable to type 'string'. \ No newline at end of file diff --git a/tests/baselines/reference/parser566700.js b/tests/baselines/reference/parser566700.js new file mode 100644 index 00000000000..6c3628058b2 --- /dev/null +++ b/tests/baselines/reference/parser566700.js @@ -0,0 +1,5 @@ +//// [parser566700.ts] +var v = ()({}); + +//// [parser566700.js] +var v = ()({}); diff --git a/tests/baselines/reference/parser585151.js b/tests/baselines/reference/parser585151.js new file mode 100644 index 00000000000..16085ab3f16 --- /dev/null +++ b/tests/baselines/reference/parser585151.js @@ -0,0 +1,13 @@ +//// [parser585151.ts] +class Foo2 { + var icecream = "chocolate"; +} + + +//// [parser585151.js] +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var icecream = "chocolate"; diff --git a/tests/baselines/reference/parser618973.js b/tests/baselines/reference/parser618973.js new file mode 100644 index 00000000000..e52c9667e76 --- /dev/null +++ b/tests/baselines/reference/parser618973.js @@ -0,0 +1,15 @@ +//// [parser618973.ts] +export export class Foo { + public Bar() { + } +} + +//// [parser618973.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.Bar = function () { + }; + return Foo; +})(); +exports.Foo = Foo; diff --git a/tests/baselines/reference/parser642331_1.js b/tests/baselines/reference/parser642331_1.js new file mode 100644 index 00000000000..d4de3c04d1d --- /dev/null +++ b/tests/baselines/reference/parser642331_1.js @@ -0,0 +1,15 @@ +//// [parser642331_1.ts] +"use strict"; + +class test { + constructor (static) { } +} + + +//// [parser642331_1.js] +"use strict"; +var test = (function () { + function test() { + } + return test; +})(); diff --git a/tests/baselines/reference/parser645086_1.js b/tests/baselines/reference/parser645086_1.js new file mode 100644 index 00000000000..6036616e37c --- /dev/null +++ b/tests/baselines/reference/parser645086_1.js @@ -0,0 +1,6 @@ +//// [parser645086_1.ts] +var v = /[]/]/ + +//// [parser645086_1.js] +var v = /[]/; +/; diff --git a/tests/baselines/reference/parser645086_2.js b/tests/baselines/reference/parser645086_2.js new file mode 100644 index 00000000000..d4ed8be1486 --- /dev/null +++ b/tests/baselines/reference/parser645086_2.js @@ -0,0 +1,6 @@ +//// [parser645086_2.ts] +var v = /[^]/]/ + +//// [parser645086_2.js] +var v = /[^]/; +/; diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic1.js b/tests/baselines/reference/parserAccessibilityAfterStatic1.js new file mode 100644 index 00000000000..263efaf5dd2 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic1.js @@ -0,0 +1,13 @@ +//// [parserAccessibilityAfterStatic1.ts] +class Outer +{ +static public intI: number; +} + + +//// [parserAccessibilityAfterStatic1.js] +var Outer = (function () { + function Outer() { + } + return Outer; +})(); diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic10.js b/tests/baselines/reference/parserAccessibilityAfterStatic10.js new file mode 100644 index 00000000000..feded66fe95 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic10.js @@ -0,0 +1,15 @@ +//// [parserAccessibilityAfterStatic10.ts] +class Outer +{ +static public intI() {} +} + + +//// [parserAccessibilityAfterStatic10.js] +var Outer = (function () { + function Outer() { + } + Outer.intI = function () { + }; + return Outer; +})(); diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic6.js b/tests/baselines/reference/parserAccessibilityAfterStatic6.js new file mode 100644 index 00000000000..de4fc048785 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic6.js @@ -0,0 +1,11 @@ +//// [parserAccessibilityAfterStatic6.ts] +class Outer +{ +static public + +//// [parserAccessibilityAfterStatic6.js] +var Outer = (function () { + function Outer() { + } + return Outer; +})(); diff --git a/tests/baselines/reference/parserAccessibilityAfterStatic7.js b/tests/baselines/reference/parserAccessibilityAfterStatic7.js new file mode 100644 index 00000000000..a2bc5c7fba3 --- /dev/null +++ b/tests/baselines/reference/parserAccessibilityAfterStatic7.js @@ -0,0 +1,15 @@ +//// [parserAccessibilityAfterStatic7.ts] +class Outer +{ +static public intI() {} +} + + +//// [parserAccessibilityAfterStatic7.js] +var Outer = (function () { + function Outer() { + } + Outer.intI = function () { + }; + return Outer; +})(); diff --git a/tests/baselines/reference/parserAccessors5.js b/tests/baselines/reference/parserAccessors5.js new file mode 100644 index 00000000000..7e96492a392 --- /dev/null +++ b/tests/baselines/reference/parserAccessors5.js @@ -0,0 +1,6 @@ +//// [parserAccessors5.ts] +declare class C { + get foo() { return 0; } +} + +//// [parserAccessors5.js] diff --git a/tests/baselines/reference/parserAccessors6.js b/tests/baselines/reference/parserAccessors6.js new file mode 100644 index 00000000000..3767441a633 --- /dev/null +++ b/tests/baselines/reference/parserAccessors6.js @@ -0,0 +1,6 @@ +//// [parserAccessors6.ts] +declare class C { + set foo(v) { } +} + +//// [parserAccessors6.js] diff --git a/tests/baselines/reference/parserAccessors7.js b/tests/baselines/reference/parserAccessors7.js new file mode 100644 index 00000000000..2703480ef53 --- /dev/null +++ b/tests/baselines/reference/parserAccessors7.js @@ -0,0 +1,6 @@ +//// [parserAccessors7.ts] +var v = { get foo(v: number) { } }; + +//// [parserAccessors7.js] +var v = { get foo(v) { +} }; diff --git a/tests/baselines/reference/parserAccessors8.js b/tests/baselines/reference/parserAccessors8.js new file mode 100644 index 00000000000..609fde320dc --- /dev/null +++ b/tests/baselines/reference/parserAccessors8.js @@ -0,0 +1,6 @@ +//// [parserAccessors8.ts] +var v = { set foo() { } } + +//// [parserAccessors8.js] +var v = { set foo() { +} }; diff --git a/tests/baselines/reference/parserAccessors9.js b/tests/baselines/reference/parserAccessors9.js new file mode 100644 index 00000000000..07c9d5cbc1e --- /dev/null +++ b/tests/baselines/reference/parserAccessors9.js @@ -0,0 +1,6 @@ +//// [parserAccessors9.ts] +var v = { set foo(a, b) { } } + +//// [parserAccessors9.js] +var v = { set foo(a, b) { +} }; diff --git a/tests/baselines/reference/parserArgumentList1.js b/tests/baselines/reference/parserArgumentList1.js new file mode 100644 index 00000000000..d33e8931d18 --- /dev/null +++ b/tests/baselines/reference/parserArgumentList1.js @@ -0,0 +1,14 @@ +//// [parserArgumentList1.ts] +export function removeClass (node:HTMLElement, className:string) { + node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) { + return leftDelimiter.length + rightDelimiter.length === 2 ? ' ' : ''; + }); +} + +//// [parserArgumentList1.js] +function removeClass(node, className) { + node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) { + return leftDelimiter.length + rightDelimiter.length === 2 ? ' ' : ''; + }); +} +exports.removeClass = removeClass; diff --git a/tests/baselines/reference/parserArrowFunctionExpression2.js b/tests/baselines/reference/parserArrowFunctionExpression2.js new file mode 100644 index 00000000000..5059cf32182 --- /dev/null +++ b/tests/baselines/reference/parserArrowFunctionExpression2.js @@ -0,0 +1,7 @@ +//// [parserArrowFunctionExpression2.ts] +a = () => { } || a + +//// [parserArrowFunctionExpression2.js] +a = function () { +}; + || a; diff --git a/tests/baselines/reference/parserArrowFunctionExpression3.js b/tests/baselines/reference/parserArrowFunctionExpression3.js new file mode 100644 index 00000000000..68ea230d87b --- /dev/null +++ b/tests/baselines/reference/parserArrowFunctionExpression3.js @@ -0,0 +1,6 @@ +//// [parserArrowFunctionExpression3.ts] +a = (() => { } || a) + +//// [parserArrowFunctionExpression3.js] +a = (function () { +}) || a; diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js new file mode 100644 index 00000000000..64c8f5c0612 --- /dev/null +++ b/tests/baselines/reference/parserAstSpans1.js @@ -0,0 +1,412 @@ +//// [parserAstSpans1.ts] +/** i1 is interface with properties*/ +interface i1 { + /** i1_p1*/ + i1_p1: number; + /** i1_f1*/ + i1_f1(): void; + /** i1_l1*/ + i1_l1: () => void; + i1_nc_p1: number; + i1_nc_f1(): void; + i1_nc_l1: () => void; + p1: number; + f1(): void; + l1: () => void; + nc_p1: number; + nc_f1(): void; + nc_l1: () => void; +} +class c1 implements i1 { + public i1_p1: number; + public i1_f1() { + } + public i1_l1: () => void; + public i1_nc_p1: number; + public i1_nc_f1() { + } + public i1_nc_l1: () => void; + /** c1_p1*/ + public p1: number; + /** c1_f1*/ + public f1() { + } + /** c1_l1*/ + public l1: () => void; + /** c1_nc_p1*/ + public nc_p1: number; + /** c1_nc_f1*/ + public nc_f1() { + } + /** c1_nc_l1*/ + public nc_l1: () => void; +} +var i1_i: i1; +i1_i.i1_f1(); +i1_i.i1_nc_f1(); +i1_i.f1(); +i1_i.nc_f1(); +i1_i.i1_l1(); +i1_i.i1_nc_l1(); +i1_i.l1(); +i1_i.nc_l1(); +var c1_i = new c1(); +c1_i.i1_f1(); +c1_i.i1_nc_f1(); +c1_i.f1(); +c1_i.nc_f1(); +c1_i.i1_l1(); +c1_i.i1_nc_l1(); +c1_i.l1(); +c1_i.nc_l1(); +// assign to interface +i1_i = c1_i; +i1_i.i1_f1(); +i1_i.i1_nc_f1(); +i1_i.f1(); +i1_i.nc_f1(); +i1_i.i1_l1(); +i1_i.i1_nc_l1(); +i1_i.l1(); +i1_i.nc_l1(); + +class c2 { + /** c2 c2_p1*/ + public c2_p1: number; + /** c2 c2_f1*/ + public c2_f1() { + } + /** c2 c2_prop*/ + public get c2_prop() { + return 10; + } + public c2_nc_p1: number; + public c2_nc_f1() { + } + public get c2_nc_prop() { + return 10; + } + /** c2 p1*/ + public p1: number; + /** c2 f1*/ + public f1() { + } + /** c2 prop*/ + public get prop() { + return 10; + } + public nc_p1: number; + public nc_f1() { + } + public get nc_prop() { + return 10; + } + /** c2 constructor*/ + constructor(a: number) { + this.c2_p1 = a; + } +} +class c3 extends c2 { + constructor() { + super(10); + this.p1 = super.c2_p1; + } + /** c3 p1*/ + public p1: number; + /** c3 f1*/ + public f1() { + } + /** c3 prop*/ + public get prop() { + return 10; + } + public nc_p1: number; + public nc_f1() { + } + public get nc_prop() { + return 10; + } +} +var c2_i = new c2(10); +var c3_i = new c3(); +c2_i.c2_f1(); +c2_i.c2_nc_f1(); +c2_i.f1(); +c2_i.nc_f1(); +c3_i.c2_f1(); +c3_i.c2_nc_f1(); +c3_i.f1(); +c3_i.nc_f1(); +// assign +c2_i = c3_i; +c2_i.c2_f1(); +c2_i.c2_nc_f1(); +c2_i.f1(); +c2_i.nc_f1(); +class c4 extends c2 { +} +var c4_i = new c4(10); + +interface i2 { + /** i2_p1*/ + i2_p1: number; + /** i2_f1*/ + i2_f1(): void; + /** i2_l1*/ + i2_l1: () => void; + i2_nc_p1: number; + i2_nc_f1(): void; + i2_nc_l1: () => void; + /** i2 p1*/ + p1: number; + /** i2 f1*/ + f1(): void; + /** i2 l1*/ + l1: () => void; + nc_p1: number; + nc_f1(): void; + nc_l1: () => void; +} +interface i3 extends i2 { + /** i3 p1*/ + p1: number; + /** i3 f1*/ + f1(): void; + /** i3 l1*/ + l1: () => void; + nc_p1: number; + nc_f1(): void; + nc_l1: () => void; +} +var i2_i: i2; +var i3_i: i3; +i2_i.i2_f1(); +i2_i.i2_nc_f1(); +i2_i.f1(); +i2_i.nc_f1(); +i2_i.i2_l1(); +i2_i.i2_nc_l1(); +i2_i.l1(); +i2_i.nc_l1(); +i3_i.i2_f1(); +i3_i.i2_nc_f1(); +i3_i.f1(); +i3_i.nc_f1(); +i3_i.i2_l1(); +i3_i.i2_nc_l1(); +i3_i.l1(); +i3_i.nc_l1(); +// assign to interface +i2_i = i3_i; +i2_i.i2_f1(); +i2_i.i2_nc_f1(); +i2_i.f1(); +i2_i.nc_f1(); +i2_i.i2_l1(); +i2_i.i2_nc_l1(); +i2_i.l1(); +i2_i.nc_l1(); + +/**c5 class*/ +class c5 { + public b: number; +} +class c6 extends c5 { + public d; + constructor() { + super(); + this.d = super.b; + } +} + +//// [parserAstSpans1.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var c1 = (function () { + function c1() { + } + c1.prototype.i1_f1 = function () { + }; + c1.prototype.i1_nc_f1 = function () { + }; + /** c1_f1*/ + c1.prototype.f1 = function () { + }; + /** c1_nc_f1*/ + c1.prototype.nc_f1 = function () { + }; + return c1; +})(); +var i1_i; +i1_i.i1_f1(); +i1_i.i1_nc_f1(); +i1_i.f1(); +i1_i.nc_f1(); +i1_i.i1_l1(); +i1_i.i1_nc_l1(); +i1_i.l1(); +i1_i.nc_l1(); +var c1_i = new c1(); +c1_i.i1_f1(); +c1_i.i1_nc_f1(); +c1_i.f1(); +c1_i.nc_f1(); +c1_i.i1_l1(); +c1_i.i1_nc_l1(); +c1_i.l1(); +c1_i.nc_l1(); +// assign to interface +i1_i = c1_i; +i1_i.i1_f1(); +i1_i.i1_nc_f1(); +i1_i.f1(); +i1_i.nc_f1(); +i1_i.i1_l1(); +i1_i.i1_nc_l1(); +i1_i.l1(); +i1_i.nc_l1(); +var c2 = (function () { + /** c2 constructor*/ + function c2(a) { + this.c2_p1 = a; + } + /** c2 c2_f1*/ + c2.prototype.c2_f1 = function () { + }; + Object.defineProperty(c2.prototype, "c2_prop", { + /** c2 c2_prop*/ + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }); + c2.prototype.c2_nc_f1 = function () { + }; + Object.defineProperty(c2.prototype, "c2_nc_prop", { + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }); + /** c2 f1*/ + c2.prototype.f1 = function () { + }; + Object.defineProperty(c2.prototype, "prop", { + /** c2 prop*/ + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }); + c2.prototype.nc_f1 = function () { + }; + Object.defineProperty(c2.prototype, "nc_prop", { + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }); + return c2; +})(); +var c3 = (function (_super) { + __extends(c3, _super); + function c3() { + _super.call(this, 10); + this.p1 = _super.prototype.c2_p1; + } + /** c3 f1*/ + c3.prototype.f1 = function () { + }; + Object.defineProperty(c3.prototype, "prop", { + /** c3 prop*/ + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }); + c3.prototype.nc_f1 = function () { + }; + Object.defineProperty(c3.prototype, "nc_prop", { + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }); + return c3; +})(c2); +var c2_i = new c2(10); +var c3_i = new c3(); +c2_i.c2_f1(); +c2_i.c2_nc_f1(); +c2_i.f1(); +c2_i.nc_f1(); +c3_i.c2_f1(); +c3_i.c2_nc_f1(); +c3_i.f1(); +c3_i.nc_f1(); +// assign +c2_i = c3_i; +c2_i.c2_f1(); +c2_i.c2_nc_f1(); +c2_i.f1(); +c2_i.nc_f1(); +var c4 = (function (_super) { + __extends(c4, _super); + function c4() { + _super.apply(this, arguments); + } + return c4; +})(c2); +var c4_i = new c4(10); +var i2_i; +var i3_i; +i2_i.i2_f1(); +i2_i.i2_nc_f1(); +i2_i.f1(); +i2_i.nc_f1(); +i2_i.i2_l1(); +i2_i.i2_nc_l1(); +i2_i.l1(); +i2_i.nc_l1(); +i3_i.i2_f1(); +i3_i.i2_nc_f1(); +i3_i.f1(); +i3_i.nc_f1(); +i3_i.i2_l1(); +i3_i.i2_nc_l1(); +i3_i.l1(); +i3_i.nc_l1(); +// assign to interface +i2_i = i3_i; +i2_i.i2_f1(); +i2_i.i2_nc_f1(); +i2_i.f1(); +i2_i.nc_f1(); +i2_i.i2_l1(); +i2_i.i2_nc_l1(); +i2_i.l1(); +i2_i.nc_l1(); +/**c5 class*/ +var c5 = (function () { + function c5() { + } + return c5; +})(); +var c6 = (function (_super) { + __extends(c6, _super); + function c6() { + _super.call(this); + this.d = _super.prototype.b; + } + return c6; +})(c5); diff --git a/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.js b/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.js new file mode 100644 index 00000000000..e2ca0ae8be6 --- /dev/null +++ b/tests/baselines/reference/parserCatchClauseWithTypeAnnotation1.js @@ -0,0 +1,11 @@ +//// [parserCatchClauseWithTypeAnnotation1.ts] +try { +} catch (e: Error) { +} + + +//// [parserCatchClauseWithTypeAnnotation1.js] +try { +} +catch (e) { +} diff --git a/tests/baselines/reference/parserClass1.js b/tests/baselines/reference/parserClass1.js new file mode 100644 index 00000000000..1245da3363f --- /dev/null +++ b/tests/baselines/reference/parserClass1.js @@ -0,0 +1,35 @@ +//// [parserClass1.ts] + export class NullLogger implements ILogger { + public information(): boolean { return false; } + public debug(): boolean { return false; } + public warning(): boolean { return false; } + public error(): boolean { return false; } + public fatal(): boolean { return false; } + public log(s: string): void { + } + } + +//// [parserClass1.js] +var NullLogger = (function () { + function NullLogger() { + } + NullLogger.prototype.information = function () { + return false; + }; + NullLogger.prototype.debug = function () { + return false; + }; + NullLogger.prototype.warning = function () { + return false; + }; + NullLogger.prototype.error = function () { + return false; + }; + NullLogger.prototype.fatal = function () { + return false; + }; + NullLogger.prototype.log = function (s) { + }; + return NullLogger; +})(); +exports.NullLogger = NullLogger; diff --git a/tests/baselines/reference/parserClass2.js b/tests/baselines/reference/parserClass2.js new file mode 100644 index 00000000000..b3816ea6ebb --- /dev/null +++ b/tests/baselines/reference/parserClass2.js @@ -0,0 +1,18 @@ +//// [parserClass2.ts] + + + export class LoggerAdapter implements ILogger { + constructor (public logger: ILogger) { + this._information = this.logger.information(); + } + } + +//// [parserClass2.js] +var LoggerAdapter = (function () { + function LoggerAdapter(logger) { + this.logger = logger; + this._information = this.logger.information(); + } + return LoggerAdapter; +})(); +exports.LoggerAdapter = LoggerAdapter; diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js new file mode 100644 index 00000000000..1e4fc0d5bcf --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -0,0 +1,18 @@ +//// [parserClassDeclaration1.ts] +class C extends A extends B { +} + +//// [parserClassDeclaration1.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parserClassDeclaration18.js b/tests/baselines/reference/parserClassDeclaration18.js new file mode 100644 index 00000000000..d95c730608e --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration18.js @@ -0,0 +1,10 @@ +//// [parserClassDeclaration18.ts] +declare class FooBase { + constructor(s: string); + constructor(n: number); + constructor(x: any) { + } + bar1():void; +} + +//// [parserClassDeclaration18.js] diff --git a/tests/baselines/reference/parserClassDeclaration2.js b/tests/baselines/reference/parserClassDeclaration2.js new file mode 100644 index 00000000000..18bb068b23f --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration2.js @@ -0,0 +1,10 @@ +//// [parserClassDeclaration2.ts] +class C implements A implements B { +} + +//// [parserClassDeclaration2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js new file mode 100644 index 00000000000..99d34bedaed --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -0,0 +1,18 @@ +//// [parserClassDeclaration3.ts] +class C implements A extends B { +} + +//// [parserClassDeclaration3.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(B); diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js new file mode 100644 index 00000000000..3552c74f184 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -0,0 +1,18 @@ +//// [parserClassDeclaration4.ts] +class C extends A implements B extends C { +} + +//// [parserClassDeclaration4.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js new file mode 100644 index 00000000000..6a7846fd036 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -0,0 +1,18 @@ +//// [parserClassDeclaration5.ts] +class C extends A implements B implements C { +} + +//// [parserClassDeclaration5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js new file mode 100644 index 00000000000..24e55a48344 --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -0,0 +1,18 @@ +//// [parserClassDeclaration6.ts] +class C extends A, B { +} + +//// [parserClassDeclaration6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parserClassDeclaration7.js b/tests/baselines/reference/parserClassDeclaration7.js new file mode 100644 index 00000000000..5418dd38a5f --- /dev/null +++ b/tests/baselines/reference/parserClassDeclaration7.js @@ -0,0 +1,7 @@ +//// [parserClassDeclaration7.ts] +declare module M { + declare class C { + } +} + +//// [parserClassDeclaration7.js] diff --git a/tests/baselines/reference/parserCommaInTypeMemberList1.js b/tests/baselines/reference/parserCommaInTypeMemberList1.js new file mode 100644 index 00000000000..25be7d9f18b --- /dev/null +++ b/tests/baselines/reference/parserCommaInTypeMemberList1.js @@ -0,0 +1,5 @@ +//// [parserCommaInTypeMemberList1.ts] +var v: { workItem: any, width: string }; + +//// [parserCommaInTypeMemberList1.js] +var v; diff --git a/tests/baselines/reference/parserCommaInTypeMemberList2.js b/tests/baselines/reference/parserCommaInTypeMemberList2.js new file mode 100644 index 00000000000..fd79326b7b0 --- /dev/null +++ b/tests/baselines/reference/parserCommaInTypeMemberList2.js @@ -0,0 +1,6 @@ +//// [parserCommaInTypeMemberList2.ts] +var s = $.extend< { workItem: any }, { workItem: any, width: string }>({ workItem: this._workItem }, {}); + + +//// [parserCommaInTypeMemberList2.js] +var s = $.extend({ workItem: this._workItem }, {}); diff --git a/tests/baselines/reference/parserComputedPropertyName1.errors.txt b/tests/baselines/reference/parserComputedPropertyName1.errors.txt index 508d06a915c..2258051a46e 100644 --- a/tests/baselines/reference/parserComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName1.errors.txt @@ -1,7 +1,10 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts(1,12): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts(1,15): error TS1005: ':' expected. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName1.ts (2 errors) ==== var v = { [e] }; + ~ +!!! error TS2304: Cannot find name 'e'. ~ !!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName1.js b/tests/baselines/reference/parserComputedPropertyName1.js new file mode 100644 index 00000000000..ee5b0a22cb6 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName1.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName1.ts] +var v = { [e] }; + +//// [parserComputedPropertyName1.js] +var v = { [e]: }; diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt index 704c37ebf45..061e2c40c2d 100644 --- a/tests/baselines/reference/parserComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName10.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts (2 errors) ==== class C { [e] = 1 ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName10.js b/tests/baselines/reference/parserComputedPropertyName10.js new file mode 100644 index 00000000000..c00d3292f7e --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName10.js @@ -0,0 +1,12 @@ +//// [parserComputedPropertyName10.ts] +class C { + [e] = 1 +} + +//// [parserComputedPropertyName10.js] +var C = (function () { + function C() { + this[e] = 1; + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt index f47aa75031d..65748f72b24 100644 --- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts (2 errors) ==== class C { [e](); ~~~ !!! error TS1168: Computed property names are not allowed in method overloads. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName11.js b/tests/baselines/reference/parserComputedPropertyName11.js new file mode 100644 index 00000000000..1b9575184f2 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName11.js @@ -0,0 +1,11 @@ +//// [parserComputedPropertyName11.ts] +class C { + [e](); +} + +//// [parserComputedPropertyName11.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName12.errors.txt b/tests/baselines/reference/parserComputedPropertyName12.errors.txt index c028275369d..46baacf402d 100644 --- a/tests/baselines/reference/parserComputedPropertyName12.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName12.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts(2,4): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts(2,5): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName12.ts (1 errors) ==== class C { [e]() { } - ~~~ -!!! error TS9002: Computed property names are not currently supported. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName12.js b/tests/baselines/reference/parserComputedPropertyName12.js new file mode 100644 index 00000000000..96e62b626e7 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName12.js @@ -0,0 +1,13 @@ +//// [parserComputedPropertyName12.ts] +class C { + [e]() { } +} + +//// [parserComputedPropertyName12.js] +var C = (function () { + function C() { + } + C.prototype[e] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName13.errors.txt b/tests/baselines/reference/parserComputedPropertyName13.errors.txt index 33ef5f9141a..b209f3c7d01 100644 --- a/tests/baselines/reference/parserComputedPropertyName13.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName13.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. \ No newline at end of file +!!! error TS1170: Computed property names are not allowed in type literals. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName13.js b/tests/baselines/reference/parserComputedPropertyName13.js new file mode 100644 index 00000000000..ccf59b67827 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName13.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName13.ts] +var v: { [e]: number }; + +//// [parserComputedPropertyName13.js] +var v; diff --git a/tests/baselines/reference/parserComputedPropertyName14.errors.txt b/tests/baselines/reference/parserComputedPropertyName14.errors.txt index d2f7ad34ed9..6ac2d276a80 100644 --- a/tests/baselines/reference/parserComputedPropertyName14.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName14.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (2 errors) ==== var v: { [e](): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. \ No newline at end of file +!!! error TS1170: Computed property names are not allowed in type literals. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName14.js b/tests/baselines/reference/parserComputedPropertyName14.js new file mode 100644 index 00000000000..486d9b1a53f --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName14.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName14.ts] +var v: { [e](): number }; + +//// [parserComputedPropertyName14.js] +var v; diff --git a/tests/baselines/reference/parserComputedPropertyName15.errors.txt b/tests/baselines/reference/parserComputedPropertyName15.errors.txt index b09ddb73112..f66e5930c26 100644 --- a/tests/baselines/reference/parserComputedPropertyName15.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName15.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (2 errors) ==== var v: { [e: number]: string; [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. \ No newline at end of file +!!! error TS1170: Computed property names are not allowed in type literals. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName15.js b/tests/baselines/reference/parserComputedPropertyName15.js new file mode 100644 index 00000000000..ecdb183679e --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName15.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName15.ts] +var v: { [e: number]: string; [e]: number }; + +//// [parserComputedPropertyName15.js] +var v; diff --git a/tests/baselines/reference/parserComputedPropertyName16.js b/tests/baselines/reference/parserComputedPropertyName16.js new file mode 100644 index 00000000000..7f0c07e38c2 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName16.js @@ -0,0 +1,10 @@ +//// [parserComputedPropertyName16.ts] +enum E { + [e] = 1 +} + +//// [parserComputedPropertyName16.js] +var E; +(function (E) { + E[E[e] = 1] = e; +})(E || (E = {})); diff --git a/tests/baselines/reference/parserComputedPropertyName17.errors.txt b/tests/baselines/reference/parserComputedPropertyName17.errors.txt index f8b1a4866e8..d8b43ada527 100644 --- a/tests/baselines/reference/parserComputedPropertyName17.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName17.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts(1,15): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts(1,16): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName17.ts (1 errors) ==== var v = { set [e](v) { } } - ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName17.js b/tests/baselines/reference/parserComputedPropertyName17.js new file mode 100644 index 00000000000..98d61ab8bca --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName17.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName17.ts] +var v = { set [e](v) { } } + +//// [parserComputedPropertyName17.js] +var v = { set [e](v) { +} }; diff --git a/tests/baselines/reference/parserComputedPropertyName18.errors.txt b/tests/baselines/reference/parserComputedPropertyName18.errors.txt index 72833dda837..f7485a127cb 100644 --- a/tests/baselines/reference/parserComputedPropertyName18.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName18.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (2 errors) ==== var v: { [e]?(): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. \ No newline at end of file +!!! error TS1170: Computed property names are not allowed in type literals. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName18.js b/tests/baselines/reference/parserComputedPropertyName18.js new file mode 100644 index 00000000000..76a88456007 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName18.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName18.ts] +var v: { [e]?(): number }; + +//// [parserComputedPropertyName18.js] +var v; diff --git a/tests/baselines/reference/parserComputedPropertyName19.errors.txt b/tests/baselines/reference/parserComputedPropertyName19.errors.txt index 22dbfff3c61..65c22ff36c3 100644 --- a/tests/baselines/reference/parserComputedPropertyName19.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName19.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (2 errors) ==== var v: { [e]? }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. \ No newline at end of file +!!! error TS1170: Computed property names are not allowed in type literals. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName19.js b/tests/baselines/reference/parserComputedPropertyName19.js new file mode 100644 index 00000000000..caa66d48c52 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName19.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName19.ts] +var v: { [e]? }; + +//// [parserComputedPropertyName19.js] +var v; diff --git a/tests/baselines/reference/parserComputedPropertyName2.errors.txt b/tests/baselines/reference/parserComputedPropertyName2.errors.txt index 9eb6cdd6004..864c7adf1b5 100644 --- a/tests/baselines/reference/parserComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName2.ts (1 errors) ==== var v = { [e]: 1 }; - ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName2.js b/tests/baselines/reference/parserComputedPropertyName2.js new file mode 100644 index 00000000000..f3c41f963f5 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName2.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName2.ts] +var v = { [e]: 1 }; + +//// [parserComputedPropertyName2.js] +var v = { [e]: 1 }; diff --git a/tests/baselines/reference/parserComputedPropertyName20.errors.txt b/tests/baselines/reference/parserComputedPropertyName20.errors.txt index 36a7e2d4866..d65dfede1d2 100644 --- a/tests/baselines/reference/parserComputedPropertyName20.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName20.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts (2 errors) ==== interface I { [e](): number ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName20.js b/tests/baselines/reference/parserComputedPropertyName20.js new file mode 100644 index 00000000000..25a912dbcaa --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName20.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName20.ts] +interface I { + [e](): number +} + +//// [parserComputedPropertyName20.js] diff --git a/tests/baselines/reference/parserComputedPropertyName21.errors.txt b/tests/baselines/reference/parserComputedPropertyName21.errors.txt index 5850de24b76..5a9738a23a6 100644 --- a/tests/baselines/reference/parserComputedPropertyName21.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName21.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts (2 errors) ==== interface I { [e]: number ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName21.js b/tests/baselines/reference/parserComputedPropertyName21.js new file mode 100644 index 00000000000..c3ae1d63d66 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName21.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName21.ts] +interface I { + [e]: number +} + +//// [parserComputedPropertyName21.js] diff --git a/tests/baselines/reference/parserComputedPropertyName22.errors.txt b/tests/baselines/reference/parserComputedPropertyName22.errors.txt index 5149c937108..ce20dd0c587 100644 --- a/tests/baselines/reference/parserComputedPropertyName22.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName22.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts (2 errors) ==== declare class C { [e]: number ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName22.js b/tests/baselines/reference/parserComputedPropertyName22.js new file mode 100644 index 00000000000..6e29af5239f --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName22.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName22.ts] +declare class C { + [e]: number +} + +//// [parserComputedPropertyName22.js] diff --git a/tests/baselines/reference/parserComputedPropertyName23.errors.txt b/tests/baselines/reference/parserComputedPropertyName23.errors.txt index 2018032ef94..8c95992253c 100644 --- a/tests/baselines/reference/parserComputedPropertyName23.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName23.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts(2,9): error TS1086: An accessor cannot be declared in an ambient context. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts(2,10): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName23.ts (2 errors) ==== declare class C { get [e](): number ~~~ !!! error TS1086: An accessor cannot be declared in an ambient context. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName23.js b/tests/baselines/reference/parserComputedPropertyName23.js new file mode 100644 index 00000000000..a29f610290a --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName23.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName23.ts] +declare class C { + get [e](): number +} + +//// [parserComputedPropertyName23.js] diff --git a/tests/baselines/reference/parserComputedPropertyName24.errors.txt b/tests/baselines/reference/parserComputedPropertyName24.errors.txt index fa7280a93e7..29bcb05ea0f 100644 --- a/tests/baselines/reference/parserComputedPropertyName24.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName24.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts(2,9): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts(2,10): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName24.ts (1 errors) ==== class C { set [e](v) { } - ~~~ -!!! error TS9002: Computed property names are not currently supported. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName24.js b/tests/baselines/reference/parserComputedPropertyName24.js new file mode 100644 index 00000000000..0b9467fb26d --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName24.js @@ -0,0 +1,17 @@ +//// [parserComputedPropertyName24.ts] +class C { + set [e](v) { } +} + +//// [parserComputedPropertyName24.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, e, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName25.errors.txt b/tests/baselines/reference/parserComputedPropertyName25.errors.txt index c8dd6b3bc7c..8d26c8afdb7 100644 --- a/tests/baselines/reference/parserComputedPropertyName25.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName25.errors.txt @@ -1,13 +1,16 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts (3 errors) ==== class C { // No ASI [e] = 0 ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. [e2] = 1 ~~ !!! error TS2304: Cannot find name 'e2'. diff --git a/tests/baselines/reference/parserComputedPropertyName25.js b/tests/baselines/reference/parserComputedPropertyName25.js new file mode 100644 index 00000000000..a00cec2e6dd --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName25.js @@ -0,0 +1,15 @@ +//// [parserComputedPropertyName25.ts] +class C { + // No ASI + [e] = 0 + [e2] = 1 +} + +//// [parserComputedPropertyName25.js] +var C = (function () { + function C() { + // No ASI + this[e] = 0[e2] = 1; + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName26.js b/tests/baselines/reference/parserComputedPropertyName26.js new file mode 100644 index 00000000000..fe47249a22e --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName26.js @@ -0,0 +1,13 @@ +//// [parserComputedPropertyName26.ts] +enum E { + // No ASI + [e] = 0 + [e2] = 1 +} + +//// [parserComputedPropertyName26.js] +var E; +(function (E) { + // No ASI + E[E[e] = 0[e2] = 1] = e; +})(E || (E = {})); diff --git a/tests/baselines/reference/parserComputedPropertyName27.errors.txt b/tests/baselines/reference/parserComputedPropertyName27.errors.txt index 7c8e30bf25d..3792cf0eccd 100644 --- a/tests/baselines/reference/parserComputedPropertyName27.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName27.errors.txt @@ -1,11 +1,14 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(4,6): error TS2304: Cannot find name 'e2'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts(4,9): error TS1005: ';' expected. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName27.ts (3 errors) ==== class C { // No ASI [e]: number = 0 + ~ +!!! error TS2304: Cannot find name 'e'. [e2]: number ~~ !!! error TS2304: Cannot find name 'e2'. diff --git a/tests/baselines/reference/parserComputedPropertyName27.js b/tests/baselines/reference/parserComputedPropertyName27.js new file mode 100644 index 00000000000..03b156af840 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName27.js @@ -0,0 +1,15 @@ +//// [parserComputedPropertyName27.ts] +class C { + // No ASI + [e]: number = 0 + [e2]: number +} + +//// [parserComputedPropertyName27.js] +var C = (function () { + function C() { + // No ASI + this[e] = 0[e2]; + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName28.errors.txt b/tests/baselines/reference/parserComputedPropertyName28.errors.txt index bc32f34c151..c522ec031eb 100644 --- a/tests/baselines/reference/parserComputedPropertyName28.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName28.errors.txt @@ -1,13 +1,19 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts (4 errors) ==== class C { [e]: number = 0; ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~~ +!!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName28.js b/tests/baselines/reference/parserComputedPropertyName28.js new file mode 100644 index 00000000000..60fb25dfa20 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName28.js @@ -0,0 +1,13 @@ +//// [parserComputedPropertyName28.ts] +class C { + [e]: number = 0; + [e2]: number +} + +//// [parserComputedPropertyName28.js] +var C = (function () { + function C() { + this[e] = 0; + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt index 691a240375a..5e6baed0f06 100644 --- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt @@ -1,17 +1,23 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts (5 errors) ==== class C { // yes ASI [e] = id++ ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. ~~ !!! error TS2304: Cannot find name 'id'. [e2]: number ~~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~~ +!!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName29.js b/tests/baselines/reference/parserComputedPropertyName29.js new file mode 100644 index 00000000000..05ced020aff --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName29.js @@ -0,0 +1,15 @@ +//// [parserComputedPropertyName29.ts] +class C { + // yes ASI + [e] = id++ + [e2]: number +} + +//// [parserComputedPropertyName29.js] +var C = (function () { + function C() { + // yes ASI + this[e] = id++; + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName3.errors.txt b/tests/baselines/reference/parserComputedPropertyName3.errors.txt index b13f453cb89..4b20c55f499 100644 --- a/tests/baselines/reference/parserComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName3.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName3.ts (1 errors) ==== var v = { [e]() { } }; - ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName3.js b/tests/baselines/reference/parserComputedPropertyName3.js new file mode 100644 index 00000000000..2e73fe87d3a --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName3.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName3.ts] +var v = { [e]() { } }; + +//// [parserComputedPropertyName3.js] +var v = { [e]() { +} }; diff --git a/tests/baselines/reference/parserComputedPropertyName30.js b/tests/baselines/reference/parserComputedPropertyName30.js new file mode 100644 index 00000000000..cdad5321cff --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName30.js @@ -0,0 +1,14 @@ +//// [parserComputedPropertyName30.ts] +enum E { + // no ASI, comma expected + [e] = id++ + [e2] = 1 +} + +//// [parserComputedPropertyName30.js] +var E; +(function (E) { + // no ASI, comma expected + E[E[e] = id++] = e; + E[E[e2] = 1] = e2; +})(E || (E = {})); diff --git a/tests/baselines/reference/parserComputedPropertyName31.errors.txt b/tests/baselines/reference/parserComputedPropertyName31.errors.txt index 6dddbd859c9..97a3b1ee187 100644 --- a/tests/baselines/reference/parserComputedPropertyName31.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName31.errors.txt @@ -1,14 +1,20 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts (4 errors) ==== class C { // yes ASI [e]: number ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~~ +!!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName31.js b/tests/baselines/reference/parserComputedPropertyName31.js new file mode 100644 index 00000000000..2a07155a2f0 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName31.js @@ -0,0 +1,13 @@ +//// [parserComputedPropertyName31.ts] +class C { + // yes ASI + [e]: number + [e2]: number +} + +//// [parserComputedPropertyName31.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName32.errors.txt b/tests/baselines/reference/parserComputedPropertyName32.errors.txt index 4407014cf99..da423baaa05 100644 --- a/tests/baselines/reference/parserComputedPropertyName32.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName32.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: Computed property names are not allowed in an ambient context. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts (2 errors) ==== declare class C { [e](): number ~~~ !!! error TS1165: Computed property names are not allowed in an ambient context. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName32.js b/tests/baselines/reference/parserComputedPropertyName32.js new file mode 100644 index 00000000000..685b215c8f4 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName32.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName32.ts] +declare class C { + [e](): number +} + +//// [parserComputedPropertyName32.js] diff --git a/tests/baselines/reference/parserComputedPropertyName33.errors.txt b/tests/baselines/reference/parserComputedPropertyName33.errors.txt index d56ee49863f..5ce420ceb60 100644 --- a/tests/baselines/reference/parserComputedPropertyName33.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName33.errors.txt @@ -1,12 +1,15 @@ +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(4,6): error TS2304: Cannot find name 'e2'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(4,12): error TS1005: ';' expected. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts(5,1): error TS1128: Declaration or statement expected. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName33.ts (4 errors) ==== class C { // No ASI [e] = 0 + ~ +!!! error TS2304: Cannot find name 'e'. [e2]() { } ~~ !!! error TS2304: Cannot find name 'e2'. diff --git a/tests/baselines/reference/parserComputedPropertyName33.js b/tests/baselines/reference/parserComputedPropertyName33.js new file mode 100644 index 00000000000..1cc06c06780 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName33.js @@ -0,0 +1,17 @@ +//// [parserComputedPropertyName33.ts] +class C { + // No ASI + [e] = 0 + [e2]() { } +} + +//// [parserComputedPropertyName33.js] +var C = (function () { + function C() { + // No ASI + this[e] = 0[e2](); + } + return C; +})(); +{ +} diff --git a/tests/baselines/reference/parserComputedPropertyName34.js b/tests/baselines/reference/parserComputedPropertyName34.js new file mode 100644 index 00000000000..f5a6daa56e5 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName34.js @@ -0,0 +1,14 @@ +//// [parserComputedPropertyName34.ts] +enum E { + // no ASI, comma expected + [e] = id++, + [e2] = 1 +} + +//// [parserComputedPropertyName34.js] +var E; +(function (E) { + // no ASI, comma expected + E[E[e] = id++] = e; + E[E[e2] = 1] = e2; +})(E || (E = {})); diff --git a/tests/baselines/reference/parserComputedPropertyName35.errors.txt b/tests/baselines/reference/parserComputedPropertyName35.errors.txt index d68f0eb1ec7..e603d1c73fd 100644 --- a/tests/baselines/reference/parserComputedPropertyName35.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName35.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,5): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts(2,6): error TS1171: A comma expression is not allowed in a computed property name. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName35.ts (1 errors) ==== var x = { [0, 1]: { } - ~~~~~~ -!!! error TS9002: Computed property names are not currently supported. + ~~~~ +!!! error TS1171: A comma expression is not allowed in a computed property name. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName35.js b/tests/baselines/reference/parserComputedPropertyName35.js new file mode 100644 index 00000000000..15992d54ece --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName35.js @@ -0,0 +1,9 @@ +//// [parserComputedPropertyName35.ts] +var x = { + [0, 1]: { } +} + +//// [parserComputedPropertyName35.js] +var x = { + [0, 1]: {} +}; diff --git a/tests/baselines/reference/parserComputedPropertyName36.errors.txt b/tests/baselines/reference/parserComputedPropertyName36.errors.txt index d10d826d1a9..1b4130b0e27 100644 --- a/tests/baselines/reference/parserComputedPropertyName36.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName36.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts (2 errors) ==== class C { [public ]: string; ~~~~~~~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~~~~~~ +!!! error TS2304: Cannot find name 'public'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName36.js b/tests/baselines/reference/parserComputedPropertyName36.js new file mode 100644 index 00000000000..264a3512075 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName36.js @@ -0,0 +1,11 @@ +//// [parserComputedPropertyName36.ts] +class C { + [public ]: string; +} + +//// [parserComputedPropertyName36.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName37.errors.txt b/tests/baselines/reference/parserComputedPropertyName37.errors.txt index fa1acd5dbe0..64a9e7e99dc 100644 --- a/tests/baselines/reference/parserComputedPropertyName37.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName37.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts(2,5): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts(2,6): error TS2304: Cannot find name 'public'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName37.ts (1 errors) ==== var v = { [public]: 0 - ~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. + ~~~~~~ +!!! error TS2304: Cannot find name 'public'. }; \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName37.js b/tests/baselines/reference/parserComputedPropertyName37.js new file mode 100644 index 00000000000..eb16d5ade37 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName37.js @@ -0,0 +1,9 @@ +//// [parserComputedPropertyName37.ts] +var v = { + [public]: 0 +}; + +//// [parserComputedPropertyName37.js] +var v = { + [public]: 0 +}; diff --git a/tests/baselines/reference/parserComputedPropertyName38.errors.txt b/tests/baselines/reference/parserComputedPropertyName38.errors.txt index 910a907ee0f..4322abf44ed 100644 --- a/tests/baselines/reference/parserComputedPropertyName38.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName38.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts(2,5): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts(2,6): error TS2304: Cannot find name 'public'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName38.ts (1 errors) ==== class C { [public]() { } - ~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. + ~~~~~~ +!!! error TS2304: Cannot find name 'public'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName38.js b/tests/baselines/reference/parserComputedPropertyName38.js new file mode 100644 index 00000000000..487ff4078fd --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName38.js @@ -0,0 +1,13 @@ +//// [parserComputedPropertyName38.ts] +class C { + [public]() { } +} + +//// [parserComputedPropertyName38.js] +var C = (function () { + function C() { + } + C.prototype[public] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName39.js b/tests/baselines/reference/parserComputedPropertyName39.js new file mode 100644 index 00000000000..c37312f0034 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName39.js @@ -0,0 +1,15 @@ +//// [parserComputedPropertyName39.ts] +"use strict"; +class C { + [public]() { } +} + +//// [parserComputedPropertyName39.js] +"use strict"; +var C = (function () { + function C() { + } + return C; +})(); +(() => { +}); diff --git a/tests/baselines/reference/parserComputedPropertyName4.errors.txt b/tests/baselines/reference/parserComputedPropertyName4.errors.txt index c1137b15872..bfc78b162fd 100644 --- a/tests/baselines/reference/parserComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName4.errors.txt @@ -1,7 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName4.js b/tests/baselines/reference/parserComputedPropertyName4.js new file mode 100644 index 00000000000..a88545566e6 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName4.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName4.ts] +var v = { get [e]() { } }; + +//// [parserComputedPropertyName4.js] +var v = { get [e]() { +} }; diff --git a/tests/baselines/reference/parserComputedPropertyName40.errors.txt b/tests/baselines/reference/parserComputedPropertyName40.errors.txt index 93be0ad51b7..862836ae47d 100644 --- a/tests/baselines/reference/parserComputedPropertyName40.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName40.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts(2,5): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts(2,6): error TS2304: Cannot find name 'a'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName40.ts (1 errors) ==== class C { [a ? "" : ""]() {} - ~~~~~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. + ~ +!!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName40.js b/tests/baselines/reference/parserComputedPropertyName40.js new file mode 100644 index 00000000000..5f6381360fc --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName40.js @@ -0,0 +1,13 @@ +//// [parserComputedPropertyName40.ts] +class C { + [a ? "" : ""]() {} +} + +//// [parserComputedPropertyName40.js] +var C = (function () { + function C() { + } + C.prototype[a ? "" : ""] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt index eb5e9a9ebbf..65d4ec8627f 100644 --- a/tests/baselines/reference/parserComputedPropertyName41.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== var v = { [0 in []]: true ~~~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.js b/tests/baselines/reference/parserComputedPropertyName41.js new file mode 100644 index 00000000000..b19cc3e7b3f --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName41.js @@ -0,0 +1,9 @@ +//// [parserComputedPropertyName41.ts] +var v = { + [0 in []]: true +} + +//// [parserComputedPropertyName41.js] +var v = { + [0 in []]: true +}; diff --git a/tests/baselines/reference/parserComputedPropertyName5.errors.txt b/tests/baselines/reference/parserComputedPropertyName5.errors.txt index f0dd056fdf9..07cc6f3a9f0 100644 --- a/tests/baselines/reference/parserComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName5.errors.txt @@ -1,7 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,22): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts(1,23): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName5.ts (2 errors) ==== var v = { public get [e]() { } }; ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName5.js b/tests/baselines/reference/parserComputedPropertyName5.js new file mode 100644 index 00000000000..aa86d54d09c --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName5.js @@ -0,0 +1,6 @@ +//// [parserComputedPropertyName5.ts] +var v = { public get [e]() { } }; + +//// [parserComputedPropertyName5.js] +var v = { get [e]() { +} }; diff --git a/tests/baselines/reference/parserComputedPropertyName6.errors.txt b/tests/baselines/reference/parserComputedPropertyName6.errors.txt index 893bf3da719..90f1b688408 100644 --- a/tests/baselines/reference/parserComputedPropertyName6.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName6.errors.txt @@ -1,10 +1,13 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,11): error TS9002: Computed property names are not currently supported. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,19): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,12): error TS2304: Cannot find name 'e'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,20): error TS2304: Cannot find name 'e'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts(1,24): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName6.ts (3 errors) ==== var v = { [e]: 1, [e + e]: 2 }; - ~~~ -!!! error TS9002: Computed property names are not currently supported. - ~~~~~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file + ~ +!!! error TS2304: Cannot find name 'e'. + ~ +!!! error TS2304: Cannot find name 'e'. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName6.js b/tests/baselines/reference/parserComputedPropertyName6.js new file mode 100644 index 00000000000..b60ad66a9d8 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName6.js @@ -0,0 +1,5 @@ +//// [parserComputedPropertyName6.ts] +var v = { [e]: 1, [e + e]: 2 }; + +//// [parserComputedPropertyName6.js] +var v = { [e]: 1, [e + e]: 2 }; diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt index 21147be3074..bcf39b0ca0a 100644 --- a/tests/baselines/reference/parserComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName7.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts (2 errors) ==== class C { [e] ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName7.js b/tests/baselines/reference/parserComputedPropertyName7.js new file mode 100644 index 00000000000..70ed8b7b073 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName7.js @@ -0,0 +1,11 @@ +//// [parserComputedPropertyName7.ts] +class C { + [e] +} + +//// [parserComputedPropertyName7.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName8.errors.txt b/tests/baselines/reference/parserComputedPropertyName8.errors.txt index 75352ec9e51..250c7a52c6e 100644 --- a/tests/baselines/reference/parserComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName8.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts (2 errors) ==== class C { public [e] ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName8.js b/tests/baselines/reference/parserComputedPropertyName8.js new file mode 100644 index 00000000000..4b79c459663 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName8.js @@ -0,0 +1,11 @@ +//// [parserComputedPropertyName8.ts] +class C { + public [e] +} + +//// [parserComputedPropertyName8.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserComputedPropertyName9.errors.txt b/tests/baselines/reference/parserComputedPropertyName9.errors.txt index eb5cfd28d73..fd434046564 100644 --- a/tests/baselines/reference/parserComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName9.errors.txt @@ -1,12 +1,15 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. -==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts (3 errors) ==== class C { [e]: Type ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. ~~~~ !!! error TS2304: Cannot find name 'Type'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName9.js b/tests/baselines/reference/parserComputedPropertyName9.js new file mode 100644 index 00000000000..4b62cc0ecd9 --- /dev/null +++ b/tests/baselines/reference/parserComputedPropertyName9.js @@ -0,0 +1,11 @@ +//// [parserComputedPropertyName9.ts] +class C { + [e]: Type +} + +//// [parserComputedPropertyName9.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorAmbiguity3.js b/tests/baselines/reference/parserConstructorAmbiguity3.js new file mode 100644 index 00000000000..bc565c70a7a --- /dev/null +++ b/tests/baselines/reference/parserConstructorAmbiguity3.js @@ -0,0 +1,5 @@ +//// [parserConstructorAmbiguity3.ts] +new Date + +//// [parserConstructorAmbiguity3.js] +new Date(); diff --git a/tests/baselines/reference/parserConstructorDeclaration10.js b/tests/baselines/reference/parserConstructorDeclaration10.js new file mode 100644 index 00000000000..9289636e919 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration10.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration10.ts] +class C { + constructor(): number { } +} + +//// [parserConstructorDeclaration10.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration11.js b/tests/baselines/reference/parserConstructorDeclaration11.js new file mode 100644 index 00000000000..a21fa87f694 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration11.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration11.ts] +class C { + constructor<>() { } +} + +//// [parserConstructorDeclaration11.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration12.js b/tests/baselines/reference/parserConstructorDeclaration12.js new file mode 100644 index 00000000000..dc540c3323e --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration12.js @@ -0,0 +1,18 @@ +//// [parserConstructorDeclaration12.ts] +class C { + constructor<>() { } + constructor<> () { } + constructor <>() { } + constructor <> () { } + constructor< >() { } + constructor< > () { } + constructor < >() { } + constructor < > () { } +} + +//// [parserConstructorDeclaration12.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration2.js b/tests/baselines/reference/parserConstructorDeclaration2.js new file mode 100644 index 00000000000..142bf5a5314 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration2.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration2.ts] +class C { + static constructor() { } +} + +//// [parserConstructorDeclaration2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration3.js b/tests/baselines/reference/parserConstructorDeclaration3.js new file mode 100644 index 00000000000..6e7531f1e66 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration3.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration3.ts] +class C { + export constructor() { } +} + +//// [parserConstructorDeclaration3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration4.js b/tests/baselines/reference/parserConstructorDeclaration4.js new file mode 100644 index 00000000000..2b1ae1cdb68 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration4.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration4.ts] +class C { + declare constructor() { } +} + +//// [parserConstructorDeclaration4.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration5.js b/tests/baselines/reference/parserConstructorDeclaration5.js new file mode 100644 index 00000000000..c0d8c03458e --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration5.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration5.ts] +class C { + private constructor() { } +} + +//// [parserConstructorDeclaration5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration6.js b/tests/baselines/reference/parserConstructorDeclaration6.js new file mode 100644 index 00000000000..abee73fe0b8 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration6.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration6.ts] +class C { + public public constructor() { } +} + +//// [parserConstructorDeclaration6.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration7.js b/tests/baselines/reference/parserConstructorDeclaration7.js new file mode 100644 index 00000000000..8c3b4db9d22 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration7.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration7.ts] +class C { + public private constructor() { } +} + +//// [parserConstructorDeclaration7.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration8.js b/tests/baselines/reference/parserConstructorDeclaration8.js new file mode 100644 index 00000000000..26c06b591c0 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration8.js @@ -0,0 +1,12 @@ +//// [parserConstructorDeclaration8.ts] +class C { + // Not a constructor + public constructor; +} + +//// [parserConstructorDeclaration8.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserConstructorDeclaration9.js b/tests/baselines/reference/parserConstructorDeclaration9.js new file mode 100644 index 00000000000..8393d35f5e7 --- /dev/null +++ b/tests/baselines/reference/parserConstructorDeclaration9.js @@ -0,0 +1,11 @@ +//// [parserConstructorDeclaration9.ts] +class C { + constructor() { } +} + +//// [parserConstructorDeclaration9.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES3Accessors1.js b/tests/baselines/reference/parserES3Accessors1.js new file mode 100644 index 00000000000..4900c1f32d9 --- /dev/null +++ b/tests/baselines/reference/parserES3Accessors1.js @@ -0,0 +1,17 @@ +//// [parserES3Accessors1.ts] +class C { + get Foo() { } +} + +//// [parserES3Accessors1.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserES3Accessors2.js b/tests/baselines/reference/parserES3Accessors2.js new file mode 100644 index 00000000000..08259f2655e --- /dev/null +++ b/tests/baselines/reference/parserES3Accessors2.js @@ -0,0 +1,17 @@ +//// [parserES3Accessors2.ts] +class C { + set Foo(a) { } +} + +//// [parserES3Accessors2.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserES3Accessors3.js b/tests/baselines/reference/parserES3Accessors3.js new file mode 100644 index 00000000000..57ceb566dcb --- /dev/null +++ b/tests/baselines/reference/parserES3Accessors3.js @@ -0,0 +1,6 @@ +//// [parserES3Accessors3.ts] +var v = { get Foo() { } }; + +//// [parserES3Accessors3.js] +var v = { get Foo() { +} }; diff --git a/tests/baselines/reference/parserES3Accessors4.js b/tests/baselines/reference/parserES3Accessors4.js new file mode 100644 index 00000000000..5c87923ed5e --- /dev/null +++ b/tests/baselines/reference/parserES3Accessors4.js @@ -0,0 +1,6 @@ +//// [parserES3Accessors4.ts] +var v = { set Foo(a) { } }; + +//// [parserES3Accessors4.js] +var v = { set Foo(a) { +} }; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt index 5bae79b95aa..55af923e54b 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts (2 errors) ==== declare class C { [e]: number ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.js b/tests/baselines/reference/parserES5ComputedPropertyName1.js new file mode 100644 index 00000000000..6eb66b78cec --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName1.js @@ -0,0 +1,6 @@ +//// [parserES5ComputedPropertyName1.ts] +declare class C { + [e]: number +} + +//// [parserES5ComputedPropertyName1.js] diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt index 40bec1b4f38..7db85cdef35 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts (2 errors) ==== class C { [e] = 1 ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.js b/tests/baselines/reference/parserES5ComputedPropertyName10.js new file mode 100644 index 00000000000..a69165a192a --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName10.js @@ -0,0 +1,12 @@ +//// [parserES5ComputedPropertyName10.ts] +class C { + [e] = 1 +} + +//// [parserES5ComputedPropertyName10.js] +var C = (function () { + function C() { + this[e] = 1; + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt index 124db7da75a..ead27a994d1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts (2 errors) ==== class C { [e](); ~~~ !!! error TS1168: Computed property names are not allowed in method overloads. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.js b/tests/baselines/reference/parserES5ComputedPropertyName11.js new file mode 100644 index 00000000000..dfa74b03a5f --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName11.js @@ -0,0 +1,11 @@ +//// [parserES5ComputedPropertyName11.ts] +class C { + [e](); +} + +//// [parserES5ComputedPropertyName11.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt index 7b6b74b8fd8..5918387942d 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt @@ -1,7 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (2 errors) ==== var v = { [e]: 1 }; ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js new file mode 100644 index 00000000000..861716a3cde --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -0,0 +1,5 @@ +//// [parserES5ComputedPropertyName2.ts] +var v = { [e]: 1 }; + +//// [parserES5ComputedPropertyName2.js] +var v = { [e]: 1 }; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt index 669fd190265..097ab1ea9cb 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt @@ -1,7 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (2 errors) ==== var v = { [e]() { } }; ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js new file mode 100644 index 00000000000..4e07049b29d --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -0,0 +1,6 @@ +//// [parserES5ComputedPropertyName3.ts] +var v = { [e]() { } }; + +//// [parserES5ComputedPropertyName3.js] +var v = { [e]: function () { +} }; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index af0c6e858ad..ca69791c93c 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,7 +1,13 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS9002: Computed property names are not currently supported. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (3 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS9002: Computed property names are not currently supported. \ No newline at end of file +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js new file mode 100644 index 00000000000..50e240dcf20 --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -0,0 +1,6 @@ +//// [parserES5ComputedPropertyName4.ts] +var v = { get [e]() { } }; + +//// [parserES5ComputedPropertyName4.js] +var v = { get [e]() { +} }; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt index 8eeeef1516f..122ca20a0e4 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts (2 errors) ==== interface I { [e]: number ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.js b/tests/baselines/reference/parserES5ComputedPropertyName5.js new file mode 100644 index 00000000000..c0eeae9b4aa --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName5.js @@ -0,0 +1,6 @@ +//// [parserES5ComputedPropertyName5.ts] +interface I { + [e]: number +} + +//// [parserES5ComputedPropertyName5.js] diff --git a/tests/baselines/reference/parserES5ComputedPropertyName6.js b/tests/baselines/reference/parserES5ComputedPropertyName6.js new file mode 100644 index 00000000000..a2fdae9c32e --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName6.js @@ -0,0 +1,10 @@ +//// [parserES5ComputedPropertyName6.ts] +enum E { + [e] = 1 +} + +//// [parserES5ComputedPropertyName6.js] +var E; +(function (E) { + E[E[e] = 1] = e; +})(E || (E = {})); diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt index 6aefd27ef58..d38d57d87be 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts (2 errors) ==== class C { [e] ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.js b/tests/baselines/reference/parserES5ComputedPropertyName7.js new file mode 100644 index 00000000000..8634682c660 --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName7.js @@ -0,0 +1,11 @@ +//// [parserES5ComputedPropertyName7.ts] +class C { + [e] +} + +//// [parserES5ComputedPropertyName7.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt index 4595081c145..e52727c6929 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt @@ -1,7 +1,10 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. \ No newline at end of file +!!! error TS1170: Computed property names are not allowed in type literals. + ~ +!!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.js b/tests/baselines/reference/parserES5ComputedPropertyName8.js new file mode 100644 index 00000000000..3cbf49002f9 --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName8.js @@ -0,0 +1,5 @@ +//// [parserES5ComputedPropertyName8.ts] +var v: { [e]: number }; + +//// [parserES5ComputedPropertyName8.js] +var v; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt index 6d035a7c610..8cbe0ffcf8d 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt @@ -1,12 +1,15 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts (3 errors) ==== class C { [e]: Type ~~~ !!! error TS1166: Computed property names are not allowed in class property declarations. + ~ +!!! error TS2304: Cannot find name 'e'. ~~~~ !!! error TS2304: Cannot find name 'Type'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.js b/tests/baselines/reference/parserES5ComputedPropertyName9.js new file mode 100644 index 00000000000..fdefc8649d0 --- /dev/null +++ b/tests/baselines/reference/parserES5ComputedPropertyName9.js @@ -0,0 +1,11 @@ +//// [parserES5ComputedPropertyName9.ts] +class C { + [e]: Type +} + +//// [parserES5ComputedPropertyName9.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserEmptyParenthesizedExpression1.js b/tests/baselines/reference/parserEmptyParenthesizedExpression1.js new file mode 100644 index 00000000000..d8e6385db4c --- /dev/null +++ b/tests/baselines/reference/parserEmptyParenthesizedExpression1.js @@ -0,0 +1,9 @@ +//// [parserEmptyParenthesizedExpression1.ts] +function getObj() { + ().toString(); +} + +//// [parserEmptyParenthesizedExpression1.js] +function getObj() { + ().toString(); +} diff --git a/tests/baselines/reference/parserEnum1.js b/tests/baselines/reference/parserEnum1.js new file mode 100644 index 00000000000..8bd9d128233 --- /dev/null +++ b/tests/baselines/reference/parserEnum1.js @@ -0,0 +1,18 @@ +//// [parserEnum1.ts] + + + export enum SignatureFlags { + None = 0, + IsIndexer = 1, + IsStringIndexer = 1 << 1, + IsNumberIndexer = 1 << 2, + } + +//// [parserEnum1.js] +(function (SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; + SignatureFlags[SignatureFlags["IsStringIndexer"] = 1 << 1] = "IsStringIndexer"; + SignatureFlags[SignatureFlags["IsNumberIndexer"] = 1 << 2] = "IsNumberIndexer"; +})(exports.SignatureFlags || (exports.SignatureFlags = {})); +var SignatureFlags = exports.SignatureFlags; diff --git a/tests/baselines/reference/parserEnum2.js b/tests/baselines/reference/parserEnum2.js new file mode 100644 index 00000000000..22946153449 --- /dev/null +++ b/tests/baselines/reference/parserEnum2.js @@ -0,0 +1,18 @@ +//// [parserEnum2.ts] + + + export enum SignatureFlags { + None = 0, + IsIndexer = 1, + IsStringIndexer = 1 << 1, + IsNumberIndexer = 1 << 2 + } + +//// [parserEnum2.js] +(function (SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; + SignatureFlags[SignatureFlags["IsStringIndexer"] = 1 << 1] = "IsStringIndexer"; + SignatureFlags[SignatureFlags["IsNumberIndexer"] = 1 << 2] = "IsNumberIndexer"; +})(exports.SignatureFlags || (exports.SignatureFlags = {})); +var SignatureFlags = exports.SignatureFlags; diff --git a/tests/baselines/reference/parserEnum3.js b/tests/baselines/reference/parserEnum3.js new file mode 100644 index 00000000000..bbfb2039314 --- /dev/null +++ b/tests/baselines/reference/parserEnum3.js @@ -0,0 +1,10 @@ +//// [parserEnum3.ts] + + + export enum SignatureFlags { + } + +//// [parserEnum3.js] +(function (SignatureFlags) { +})(exports.SignatureFlags || (exports.SignatureFlags = {})); +var SignatureFlags = exports.SignatureFlags; diff --git a/tests/baselines/reference/parserEnum4.js b/tests/baselines/reference/parserEnum4.js new file mode 100644 index 00000000000..1bad7047486 --- /dev/null +++ b/tests/baselines/reference/parserEnum4.js @@ -0,0 +1,11 @@ +//// [parserEnum4.ts] + + + export enum SignatureFlags { + , + } + +//// [parserEnum4.js] +(function (SignatureFlags) { +})(exports.SignatureFlags || (exports.SignatureFlags = {})); +var SignatureFlags = exports.SignatureFlags; diff --git a/tests/baselines/reference/parserEnum5.js b/tests/baselines/reference/parserEnum5.js new file mode 100644 index 00000000000..50781f40dd7 --- /dev/null +++ b/tests/baselines/reference/parserEnum5.js @@ -0,0 +1,24 @@ +//// [parserEnum5.ts] +enum E2 { a, } +enum E3 { a: 1, } +enum E1 { a, b: 1, c, d: 2 = 3 } + +//// [parserEnum5.js] +var E2; +(function (E2) { + E2[E2["a"] = 0] = "a"; +})(E2 || (E2 = {})); +var E3; +(function (E3) { + E3[E3["a"] = 0] = "a"; + E3[E3["1"] = 1] = "1"; +})(E3 || (E3 = {})); +var E1; +(function (E1) { + E1[E1["a"] = 0] = "a"; + E1[E1["b"] = 1] = "b"; + E1[E1["1"] = 2] = "1"; + E1[E1["c"] = 3] = "c"; + E1[E1["d"] = 4] = "d"; + E1[E1["2"] = 3] = "2"; +})(E1 || (E1 = {})); diff --git a/tests/baselines/reference/parserEnumDeclaration2.js b/tests/baselines/reference/parserEnumDeclaration2.js new file mode 100644 index 00000000000..a97b8cf9044 --- /dev/null +++ b/tests/baselines/reference/parserEnumDeclaration2.js @@ -0,0 +1,7 @@ +//// [parserEnumDeclaration2.ts] +declare module M { + declare enum E { + } +} + +//// [parserEnumDeclaration2.js] diff --git a/tests/baselines/reference/parserEnumDeclaration4.js b/tests/baselines/reference/parserEnumDeclaration4.js new file mode 100644 index 00000000000..47450d419e1 --- /dev/null +++ b/tests/baselines/reference/parserEnumDeclaration4.js @@ -0,0 +1,9 @@ +//// [parserEnumDeclaration4.ts] +enum void { +} + +//// [parserEnumDeclaration4.js] +var ; +(function () { +})( || ( = {})); +void {}; diff --git a/tests/baselines/reference/parserEnumDeclaration6.js b/tests/baselines/reference/parserEnumDeclaration6.js new file mode 100644 index 00000000000..5810ffc0620 --- /dev/null +++ b/tests/baselines/reference/parserEnumDeclaration6.js @@ -0,0 +1,16 @@ +//// [parserEnumDeclaration6.ts] +enum E { + A = 1, + B, + C = 1 << 1, + D, +} + +//// [parserEnumDeclaration6.js] +var E; +(function (E) { + E[E["A"] = 1] = "A"; + E[E["B"] = 2] = "B"; + E[E["C"] = 1 << 1] = "C"; + E[E["D"] = undefined] = "D"; +})(E || (E = {})); diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.js b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.js new file mode 100644 index 00000000000..5358a25fd82 --- /dev/null +++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction1.js @@ -0,0 +1,4 @@ +//// [parserEqualsGreaterThanAfterFunction1.ts] +function => + +//// [parserEqualsGreaterThanAfterFunction1.js] diff --git a/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.js b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.js new file mode 100644 index 00000000000..a0c210486a3 --- /dev/null +++ b/tests/baselines/reference/parserEqualsGreaterThanAfterFunction2.js @@ -0,0 +1,4 @@ +//// [parserEqualsGreaterThanAfterFunction2.ts] +function (a => b; + +//// [parserEqualsGreaterThanAfterFunction2.js] diff --git a/tests/baselines/reference/parserErrantAccessibilityModifierInModule1.js b/tests/baselines/reference/parserErrantAccessibilityModifierInModule1.js new file mode 100644 index 00000000000..be0bb67511d --- /dev/null +++ b/tests/baselines/reference/parserErrantAccessibilityModifierInModule1.js @@ -0,0 +1,14 @@ +//// [parserErrantAccessibilityModifierInModule1.ts] +module M { + var x=10; // variable local to this module body + private y=x; // property visible only in module + export var z=y; // property visible to any code +} + +//// [parserErrantAccessibilityModifierInModule1.js] +var M; +(function (M) { + var x = 10; // variable local to this module body + y = x; // property visible only in module + M.z = y; // property visible to any code +})(M || (M = {})); diff --git a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.js b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.js new file mode 100644 index 00000000000..c1b2f517b45 --- /dev/null +++ b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.js @@ -0,0 +1,5 @@ +//// [parserErrantEqualsGreaterThanAfterFunction1.ts] +function f() => 4; + +//// [parserErrantEqualsGreaterThanAfterFunction1.js] +4; diff --git a/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.js b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.js new file mode 100644 index 00000000000..5b4b71cab1f --- /dev/null +++ b/tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.js @@ -0,0 +1,5 @@ +//// [parserErrantEqualsGreaterThanAfterFunction2.ts] +function f(p: A) => p; + +//// [parserErrantEqualsGreaterThanAfterFunction2.js] +p; diff --git a/tests/baselines/reference/parserErrantSemicolonInClass1.js b/tests/baselines/reference/parserErrantSemicolonInClass1.js new file mode 100644 index 00000000000..2f38e2b5323 --- /dev/null +++ b/tests/baselines/reference/parserErrantSemicolonInClass1.js @@ -0,0 +1,73 @@ +//// [parserErrantSemicolonInClass1.ts] +class a { + //constructor (); + constructor (n: number); + constructor (s: string); + constructor (ns: any) { + + } + + public pgF() { }; + + public pv; + public get d() { + return 30; + } + public set d() { + } + + public static get p2() { + return { x: 30, y: 40 }; + } + + private static d2() { + } + private static get p3() { + return "string"; + } + private pv3; + + private foo(n: number): string; + private foo(s: string): string; + private foo(ns: any) { + return ns.toString(); + } +} + + +//// [parserErrantSemicolonInClass1.js] +var a = (function () { + function a(ns) { + } + a.prototype.pgF = function () { + }; + Object.defineProperty(a.prototype, "d", { + get: function () { + return 30; + }, + set: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(a, "p2", { + get: function () { + return { x: 30, y: 40 }; + }, + enumerable: true, + configurable: true + }); + a.d2 = function () { + }; + Object.defineProperty(a, "p3", { + get: function () { + return "string"; + }, + enumerable: true, + configurable: true + }); + a.prototype.foo = function (ns) { + return ns.toString(); + }; + return a; +})(); diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js new file mode 100644 index 00000000000..1ed36d8dac5 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js @@ -0,0 +1,6 @@ +//// [parserErrorRecoveryArrayLiteralExpression1.ts] +var v = [1, 2, 3 +4, 5, 6, 7]; + +//// [parserErrorRecoveryArrayLiteralExpression1.js] +var v = [1, 2, 3, 4, 5, 6, 7]; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js new file mode 100644 index 00000000000..c5386a2b6a2 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js @@ -0,0 +1,8 @@ +//// [parserErrorRecoveryArrayLiteralExpression2.ts] +var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0 + + .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; + + +//// [parserErrorRecoveryArrayLiteralExpression2.js] +var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression3.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression3.js new file mode 100644 index 00000000000..c366c750cc7 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression3.js @@ -0,0 +1,9 @@ +//// [parserErrorRecoveryArrayLiteralExpression3.ts] + +var texCoords = [2, 2, 0.5000001192092895, 0.8749999 ; 403953552, 0.5000001192092895, 0.8749999403953552]; + + +//// [parserErrorRecoveryArrayLiteralExpression3.js] +var texCoords = [2, 2, 0.5000001192092895, 0.8749999]; +403953552, 0.5000001192092895, 0.8749999403953552; +; diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement1.js b/tests/baselines/reference/parserErrorRecoveryIfStatement1.js new file mode 100644 index 00000000000..662f3056a3d --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement1.js @@ -0,0 +1,25 @@ +//// [parserErrorRecoveryIfStatement1.ts] +class Foo { + f1() { + if ( + } + f2() { + } + f3() { + } +} + +//// [parserErrorRecoveryIfStatement1.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.f1 = function () { + if () + ; + }; + Foo.prototype.f2 = function () { + }; + Foo.prototype.f3 = function () { + }; + return Foo; +})(); diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement2.js b/tests/baselines/reference/parserErrorRecoveryIfStatement2.js new file mode 100644 index 00000000000..171f3072535 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement2.js @@ -0,0 +1,25 @@ +//// [parserErrorRecoveryIfStatement2.ts] +class Foo { + f1() { + if (a + } + f2() { + } + f3() { + } +} + +//// [parserErrorRecoveryIfStatement2.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.f1 = function () { + if (a) + ; + }; + Foo.prototype.f2 = function () { + }; + Foo.prototype.f3 = function () { + }; + return Foo; +})(); diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement3.js b/tests/baselines/reference/parserErrorRecoveryIfStatement3.js new file mode 100644 index 00000000000..117525bcba0 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement3.js @@ -0,0 +1,25 @@ +//// [parserErrorRecoveryIfStatement3.ts] +class Foo { + f1() { + if (a.b + } + f2() { + } + f3() { + } +} + +//// [parserErrorRecoveryIfStatement3.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.f1 = function () { + if (a.b) + ; + }; + Foo.prototype.f2 = function () { + }; + Foo.prototype.f3 = function () { + }; + return Foo; +})(); diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement4.js b/tests/baselines/reference/parserErrorRecoveryIfStatement4.js new file mode 100644 index 00000000000..460ca957c02 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement4.js @@ -0,0 +1,25 @@ +//// [parserErrorRecoveryIfStatement4.ts] +class Foo { + f1() { + if (a.b) + } + f2() { + } + f3() { + } +} + +//// [parserErrorRecoveryIfStatement4.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.f1 = function () { + if (a.b) + ; + }; + Foo.prototype.f2 = function () { + }; + Foo.prototype.f3 = function () { + }; + return Foo; +})(); diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement5.js b/tests/baselines/reference/parserErrorRecoveryIfStatement5.js new file mode 100644 index 00000000000..8df07082c42 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement5.js @@ -0,0 +1,27 @@ +//// [parserErrorRecoveryIfStatement5.ts] +class Foo { + f1() { + if (a.b) { + } + f2() { + } + f3() { + } +} + +//// [parserErrorRecoveryIfStatement5.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.f1 = function () { + if (a.b) { + } + f2(); + { + } + f3(); + { + } + }; + return Foo; +})(); diff --git a/tests/baselines/reference/parserErrorRecoveryIfStatement6.js b/tests/baselines/reference/parserErrorRecoveryIfStatement6.js new file mode 100644 index 00000000000..fa327a73814 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecoveryIfStatement6.js @@ -0,0 +1,26 @@ +//// [parserErrorRecoveryIfStatement6.ts] +class Foo { + f1() { + if (a.b) { + } + public f2() { + } + f3() { + } +} + + +//// [parserErrorRecoveryIfStatement6.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.f1 = function () { + if (a.b) { + } + }; + Foo.prototype.f2 = function () { + }; + Foo.prototype.f3 = function () { + }; + return Foo; +})(); diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList1.js b/tests/baselines/reference/parserErrorRecovery_ArgumentList1.js new file mode 100644 index 00000000000..86bbf4494f4 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList1.js @@ -0,0 +1,11 @@ +//// [parserErrorRecovery_ArgumentList1.ts] +function foo() { + bar( + return x; +} + +//// [parserErrorRecovery_ArgumentList1.js] +function foo() { + bar(); + return x; +} diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList2.js b/tests/baselines/reference/parserErrorRecovery_ArgumentList2.js new file mode 100644 index 00000000000..14f6b67c868 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList2.js @@ -0,0 +1,9 @@ +//// [parserErrorRecovery_ArgumentList2.ts] +function foo() { + bar(; +} + +//// [parserErrorRecovery_ArgumentList2.js] +function foo() { + bar(); +} diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList3.js b/tests/baselines/reference/parserErrorRecovery_ArgumentList3.js new file mode 100644 index 00000000000..ab76ec173fb --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList3.js @@ -0,0 +1,11 @@ +//// [parserErrorRecovery_ArgumentList3.ts] +function foo() { + bar(a, + return; +} + +//// [parserErrorRecovery_ArgumentList3.js] +function foo() { + bar(a); + return; +} diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList4.js b/tests/baselines/reference/parserErrorRecovery_ArgumentList4.js new file mode 100644 index 00000000000..2557faacba5 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList4.js @@ -0,0 +1,11 @@ +//// [parserErrorRecovery_ArgumentList4.ts] +function foo() { + bar(a,b + return; +} + +//// [parserErrorRecovery_ArgumentList4.js] +function foo() { + bar(a, b); + return; +} diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList5.js b/tests/baselines/reference/parserErrorRecovery_ArgumentList5.js new file mode 100644 index 00000000000..bbb65a44e07 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList5.js @@ -0,0 +1,11 @@ +//// [parserErrorRecovery_ArgumentList5.ts] +function foo() { + bar(a,) + return; +} + +//// [parserErrorRecovery_ArgumentList5.js] +function foo() { + bar(a); + return; +} diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList6.js b/tests/baselines/reference/parserErrorRecovery_ArgumentList6.js new file mode 100644 index 00000000000..16b52248d54 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList6.js @@ -0,0 +1,5 @@ +//// [parserErrorRecovery_ArgumentList6.ts] +Foo(, + +//// [parserErrorRecovery_ArgumentList6.js] +Foo(); diff --git a/tests/baselines/reference/parserErrorRecovery_ArgumentList7.js b/tests/baselines/reference/parserErrorRecovery_ArgumentList7.js new file mode 100644 index 00000000000..94eba9445e9 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ArgumentList7.js @@ -0,0 +1,5 @@ +//// [parserErrorRecovery_ArgumentList7.ts] +Foo(a,, + +//// [parserErrorRecovery_ArgumentList7.js] +Foo(a, ); diff --git a/tests/baselines/reference/parserErrorRecovery_Block1.js b/tests/baselines/reference/parserErrorRecovery_Block1.js new file mode 100644 index 00000000000..cdcd5856fa6 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_Block1.js @@ -0,0 +1,11 @@ +//// [parserErrorRecovery_Block1.ts] +function f() { + 1 + + return; +} + +//// [parserErrorRecovery_Block1.js] +function f() { + 1 + ; + return; +} diff --git a/tests/baselines/reference/parserErrorRecovery_Block2.js b/tests/baselines/reference/parserErrorRecovery_Block2.js new file mode 100644 index 00000000000..24ddaf0db3f --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_Block2.js @@ -0,0 +1,10 @@ +//// [parserErrorRecovery_Block2.ts] +function f() { + # + return; +} + +//// [parserErrorRecovery_Block2.js] +function f() { + return; +} diff --git a/tests/baselines/reference/parserErrorRecovery_Block3.js b/tests/baselines/reference/parserErrorRecovery_Block3.js new file mode 100644 index 00000000000..30183fb7d8b --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_Block3.js @@ -0,0 +1,18 @@ +//// [parserErrorRecovery_Block3.ts] +class C { + private a(): boolean { + + private b(): boolean { + } +} + +//// [parserErrorRecovery_Block3.js] +var C = (function () { + function C() { + } + C.prototype.a = function () { + }; + C.prototype.b = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserErrorRecovery_ClassElement1.js b/tests/baselines/reference/parserErrorRecovery_ClassElement1.js new file mode 100644 index 00000000000..7a3bf441e47 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ClassElement1.js @@ -0,0 +1,21 @@ +//// [parserErrorRecovery_ClassElement1.ts] +class C { + +// Classes can't be nested. So we should bail out of parsing here and recover +// this as a source unit element. +class D { +} + +//// [parserErrorRecovery_ClassElement1.js] +var C = (function () { + function C() { + } + return C; +})(); +// Classes can't be nested. So we should bail out of parsing here and recover +// this as a source unit element. +var D = (function () { + function D() { + } + return D; +})(); diff --git a/tests/baselines/reference/parserErrorRecovery_ClassElement2.js b/tests/baselines/reference/parserErrorRecovery_ClassElement2.js new file mode 100644 index 00000000000..fca227a4e8a --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ClassElement2.js @@ -0,0 +1,20 @@ +//// [parserErrorRecovery_ClassElement2.ts] +module M { + class C { + + enum E { + } +} + +//// [parserErrorRecovery_ClassElement2.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + return C; + })(); + var E; + (function (E) { + })(E || (E = {})); +})(M || (M = {})); diff --git a/tests/baselines/reference/parserErrorRecovery_ClassElement3.js b/tests/baselines/reference/parserErrorRecovery_ClassElement3.js new file mode 100644 index 00000000000..39e701628bb --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ClassElement3.js @@ -0,0 +1,21 @@ +//// [parserErrorRecovery_ClassElement3.ts] +module M { + # + class C { + } + @ + enum E { + # + +//// [parserErrorRecovery_ClassElement3.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + return C; + })(); + var E; + (function (E) { + })(E || (E = {})); +})(M || (M = {})); diff --git a/tests/baselines/reference/parserErrorRecovery_Expression1.js b/tests/baselines/reference/parserErrorRecovery_Expression1.js new file mode 100644 index 00000000000..b2c9d64945c --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_Expression1.js @@ -0,0 +1,5 @@ +//// [parserErrorRecovery_Expression1.ts] +var v = ()({}); + +//// [parserErrorRecovery_Expression1.js] +var v = ()({}); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause1.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause1.js new file mode 100644 index 00000000000..b6557221c65 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause1.js @@ -0,0 +1,10 @@ +//// [parserErrorRecovery_ExtendsOrImplementsClause1.ts] +class C extends { +} + +//// [parserErrorRecovery_ExtendsOrImplementsClause1.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js new file mode 100644 index 00000000000..babceb0f752 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -0,0 +1,18 @@ +//// [parserErrorRecovery_ExtendsOrImplementsClause2.ts] +class C extends A, { +} + +//// [parserErrorRecovery_ExtendsOrImplementsClause2.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause3.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause3.js new file mode 100644 index 00000000000..b420e12cccb --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause3.js @@ -0,0 +1,10 @@ +//// [parserErrorRecovery_ExtendsOrImplementsClause3.ts] +class C extends implements A { +} + +//// [parserErrorRecovery_ExtendsOrImplementsClause3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js new file mode 100644 index 00000000000..5c0e793173a --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -0,0 +1,18 @@ +//// [parserErrorRecovery_ExtendsOrImplementsClause4.ts] +class C extends A implements { +} + +//// [parserErrorRecovery_ExtendsOrImplementsClause4.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js new file mode 100644 index 00000000000..40dbcf61820 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -0,0 +1,18 @@ +//// [parserErrorRecovery_ExtendsOrImplementsClause5.ts] +class C extends A, implements B, { +} + +//// [parserErrorRecovery_ExtendsOrImplementsClause5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + return C; +})(A); diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause6.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause6.js new file mode 100644 index 00000000000..02c357e5f46 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause6.js @@ -0,0 +1,4 @@ +//// [parserErrorRecovery_ExtendsOrImplementsClause6.ts] +interface I extends { } + +//// [parserErrorRecovery_ExtendsOrImplementsClause6.js] diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js new file mode 100644 index 00000000000..c26b16b5a0a --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js @@ -0,0 +1,55 @@ +//// [parserErrorRecovery_IncompleteMemberVariable1.ts] +// Interface +interface IPoint { + getDist(): number; +} + +// Module +module Shapes { + + // Class + export class Point implements IPoint { + + public con: "hello"; + // Constructor + constructor (public x: number, public y: number) { } + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } + + // Static member + static origin = new Point(0, 0); + } + +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +var dist = p.getDist(); + + +//// [parserErrorRecovery_IncompleteMemberVariable1.js] +// Module +var Shapes; +(function (Shapes) { + // Class + var Point = (function () { + // Constructor + function Point(x, y) { + this.x = x; + this.y = y; + this.con = "hello"; + } + // Instance member + Point.prototype.getDist = function () { + return Math.sqrt(this.x * this.x + this.y * this.y); + }; + // Static member + Point.origin = new Point(0, 0); + return Point; + })(); + Shapes.Point = Point; +})(Shapes || (Shapes = {})); +// Local variables +var p = new Shapes.Point(3, 4); +var dist = p.getDist(); diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js new file mode 100644 index 00000000000..866f96a8030 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js @@ -0,0 +1,55 @@ +//// [parserErrorRecovery_IncompleteMemberVariable2.ts] +// Interface +interface IPoint { + getDist(): number; +} + +// Module +module Shapes { + + // Class + export class Point implements IPoint { + + public con:C "hello"; + // Constructor + constructor (public x: number, public y: number) { } + + // Instance member + getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } + + // Static member + static origin = new Point(0, 0); + } + +} + +// Local variables +var p: IPoint = new Shapes.Point(3, 4); +var dist = p.getDist(); + + +//// [parserErrorRecovery_IncompleteMemberVariable2.js] +// Module +var Shapes; +(function (Shapes) { + // Class + var Point = (function () { + // Constructor + function Point(x, y) { + this.x = x; + this.y = y; + this.con = "hello"; + } + // Instance member + Point.prototype.getDist = function () { + return Math.sqrt(this.x * this.x + this.y * this.y); + }; + // Static member + Point.origin = new Point(0, 0); + return Point; + })(); + Shapes.Point = Point; +})(Shapes || (Shapes = {})); +// Local variables +var p = new Shapes.Point(3, 4); +var dist = p.getDist(); diff --git a/tests/baselines/reference/parserErrorRecovery_LeftShift1.js b/tests/baselines/reference/parserErrorRecovery_LeftShift1.js new file mode 100644 index 00000000000..69392c15be1 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_LeftShift1.js @@ -0,0 +1,6 @@ +//// [parserErrorRecovery_LeftShift1.ts] +retValue = bfs.VARIABLES >> ); + +//// [parserErrorRecovery_LeftShift1.js] +retValue = bfs.VARIABLES >> ; +; diff --git a/tests/baselines/reference/parserErrorRecovery_ModuleElement1.js b/tests/baselines/reference/parserErrorRecovery_ModuleElement1.js new file mode 100644 index 00000000000..27febb99c86 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ModuleElement1.js @@ -0,0 +1,9 @@ +//// [parserErrorRecovery_ModuleElement1.ts] +return foo; +} +return bar; +} + +//// [parserErrorRecovery_ModuleElement1.js] +return foo; +return bar; diff --git a/tests/baselines/reference/parserErrorRecovery_ModuleElement2.js b/tests/baselines/reference/parserErrorRecovery_ModuleElement2.js new file mode 100644 index 00000000000..722ccbc787c --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ModuleElement2.js @@ -0,0 +1,15 @@ +//// [parserErrorRecovery_ModuleElement2.ts] +function foo() { +} + +function foo() { +} + +) +) + +//// [parserErrorRecovery_ModuleElement2.js] +function foo() { +} +function foo() { +} diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral1.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral1.js new file mode 100644 index 00000000000..dbf89fec52b --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral1.js @@ -0,0 +1,5 @@ +//// [parserErrorRecovery_ObjectLiteral1.ts] +var v = { a: 1 b: 2 } + +//// [parserErrorRecovery_ObjectLiteral1.js] +var v = { a: 1, b: 2 }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js new file mode 100644 index 00000000000..08dc96d38ef --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js @@ -0,0 +1,6 @@ +//// [parserErrorRecovery_ObjectLiteral2.ts] +var v = { a +return; + +//// [parserErrorRecovery_ObjectLiteral2.js] +var v = { a: , return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js new file mode 100644 index 00000000000..1ea23d59112 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js @@ -0,0 +1,6 @@ +//// [parserErrorRecovery_ObjectLiteral3.ts] +var v = { a: +return; + +//// [parserErrorRecovery_ObjectLiteral3.js] +var v = { a: , return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js new file mode 100644 index 00000000000..4fe49788740 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js @@ -0,0 +1,6 @@ +//// [parserErrorRecovery_ObjectLiteral4.ts] +var v = { a: 1 +return; + +//// [parserErrorRecovery_ObjectLiteral4.js] +var v = { a: 1, return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js new file mode 100644 index 00000000000..cf55b59c711 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js @@ -0,0 +1,6 @@ +//// [parserErrorRecovery_ObjectLiteral5.ts] +var v = { a: 1, +return; + +//// [parserErrorRecovery_ObjectLiteral5.js] +var v = { a: 1, return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList1.js b/tests/baselines/reference/parserErrorRecovery_ParameterList1.js new file mode 100644 index 00000000000..0a9e78b59cf --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList1.js @@ -0,0 +1,5 @@ +//// [parserErrorRecovery_ParameterList1.ts] +function f(a { +} + +//// [parserErrorRecovery_ParameterList1.js] diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList2.js b/tests/baselines/reference/parserErrorRecovery_ParameterList2.js new file mode 100644 index 00000000000..9f85762a89a --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList2.js @@ -0,0 +1,5 @@ +//// [parserErrorRecovery_ParameterList2.ts] +function f(a, { +} + +//// [parserErrorRecovery_ParameterList2.js] diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList3.js b/tests/baselines/reference/parserErrorRecovery_ParameterList3.js new file mode 100644 index 00000000000..4c20e676f40 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList3.js @@ -0,0 +1,7 @@ +//// [parserErrorRecovery_ParameterList3.ts] +function f(a,) { +} + +//// [parserErrorRecovery_ParameterList3.js] +function f(a) { +} diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList4.js b/tests/baselines/reference/parserErrorRecovery_ParameterList4.js new file mode 100644 index 00000000000..53775cad92e --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList4.js @@ -0,0 +1,7 @@ +//// [parserErrorRecovery_ParameterList4.ts] +function f(a,#) { +} + +//// [parserErrorRecovery_ParameterList4.js] +function f(a) { +} diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList5.js b/tests/baselines/reference/parserErrorRecovery_ParameterList5.js new file mode 100644 index 00000000000..7ff32fd1873 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList5.js @@ -0,0 +1,5 @@ +//// [parserErrorRecovery_ParameterList5.ts] +(a:number => { } + +//// [parserErrorRecovery_ParameterList5.js] +(); diff --git a/tests/baselines/reference/parserErrorRecovery_ParameterList6.js b/tests/baselines/reference/parserErrorRecovery_ParameterList6.js new file mode 100644 index 00000000000..e83c045208d --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_ParameterList6.js @@ -0,0 +1,15 @@ +//// [parserErrorRecovery_ParameterList6.ts] +class Foo { + public banana (x: break) { } +} + +//// [parserErrorRecovery_ParameterList6.js] +var Foo = (function () { + function Foo() { + } + Foo.prototype.banana = ; + return Foo; +})(); +break ; +{ +} diff --git a/tests/baselines/reference/parserErrorRecovery_SourceUnit1.js b/tests/baselines/reference/parserErrorRecovery_SourceUnit1.js new file mode 100644 index 00000000000..a4b6427508f --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_SourceUnit1.js @@ -0,0 +1,18 @@ +//// [parserErrorRecovery_SourceUnit1.ts] +class C { +} +} +class D { +} + +//// [parserErrorRecovery_SourceUnit1.js] +var C = (function () { + function C() { + } + return C; +})(); +var D = (function () { + function D() { + } + return D; +})(); diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js new file mode 100644 index 00000000000..63591985d1e --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js @@ -0,0 +1,17 @@ +//// [parserErrorRecovery_SwitchStatement1.ts] +switch (e) { + case 1: + 1 + + case 2: + 1 + + default: +} + +//// [parserErrorRecovery_SwitchStatement1.js] +switch (e) { + case 1: + 1 + ; + case 2: + 1 + ; + default: +} diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.js b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.js new file mode 100644 index 00000000000..d7000bc23d7 --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement2.js @@ -0,0 +1,21 @@ +//// [parserErrorRecovery_SwitchStatement2.ts] +class C { + constructor() { + switch (e) { + +class D { +} + +//// [parserErrorRecovery_SwitchStatement2.js] +var C = (function () { + function C() { + switch (e) { + } + } + return C; +})(); +var D = (function () { + function D() { + } + return D; +})(); diff --git a/tests/baselines/reference/parserErrorRecovery_VariableList1.js b/tests/baselines/reference/parserErrorRecovery_VariableList1.js new file mode 100644 index 00000000000..acd4451fded --- /dev/null +++ b/tests/baselines/reference/parserErrorRecovery_VariableList1.js @@ -0,0 +1,7 @@ +//// [parserErrorRecovery_VariableList1.ts] +var a, +return; + +//// [parserErrorRecovery_VariableList1.js] +var a; +return; diff --git a/tests/baselines/reference/parserExportAssignment1.js b/tests/baselines/reference/parserExportAssignment1.js new file mode 100644 index 00000000000..5f3c0e1513f --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment1.js @@ -0,0 +1,4 @@ +//// [parserExportAssignment1.ts] +export = foo + +//// [parserExportAssignment1.js] diff --git a/tests/baselines/reference/parserExportAssignment2.js b/tests/baselines/reference/parserExportAssignment2.js new file mode 100644 index 00000000000..aaa12cea179 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment2.js @@ -0,0 +1,4 @@ +//// [parserExportAssignment2.ts] +export = foo; + +//// [parserExportAssignment2.js] diff --git a/tests/baselines/reference/parserExportAssignment3.js b/tests/baselines/reference/parserExportAssignment3.js new file mode 100644 index 00000000000..13e04c3607a --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment3.js @@ -0,0 +1,4 @@ +//// [parserExportAssignment3.ts] +export = + +//// [parserExportAssignment3.js] diff --git a/tests/baselines/reference/parserExportAssignment4.js b/tests/baselines/reference/parserExportAssignment4.js new file mode 100644 index 00000000000..7cfd8206dbe --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment4.js @@ -0,0 +1,4 @@ +//// [parserExportAssignment4.ts] +export = ; + +//// [parserExportAssignment4.js] diff --git a/tests/baselines/reference/parserExportAssignment5.js b/tests/baselines/reference/parserExportAssignment5.js new file mode 100644 index 00000000000..ac2a1202e5e --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment5.js @@ -0,0 +1,9 @@ +//// [parserExportAssignment5.ts] +module M { + export = A; +} + +//// [parserExportAssignment5.js] +var M; +(function (M) { +})(M || (M = {})); diff --git a/tests/baselines/reference/parserExportAssignment7.js b/tests/baselines/reference/parserExportAssignment7.js new file mode 100644 index 00000000000..52f9848c243 --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment7.js @@ -0,0 +1,13 @@ +//// [parserExportAssignment7.ts] +export class C { +} + +export = B; + +//// [parserExportAssignment7.js] +var C = (function () { + function C() { + } + return C; +})(); +exports.C = C; diff --git a/tests/baselines/reference/parserExportAssignment8.js b/tests/baselines/reference/parserExportAssignment8.js new file mode 100644 index 00000000000..3c5b851284e --- /dev/null +++ b/tests/baselines/reference/parserExportAssignment8.js @@ -0,0 +1,13 @@ +//// [parserExportAssignment8.ts] +export = B; + +export class C { +} + +//// [parserExportAssignment8.js] +var C = (function () { + function C() { + } + return C; +})(); +exports.C = C; diff --git a/tests/baselines/reference/parserForInStatement2.js b/tests/baselines/reference/parserForInStatement2.js new file mode 100644 index 00000000000..9f522eadc5d --- /dev/null +++ b/tests/baselines/reference/parserForInStatement2.js @@ -0,0 +1,7 @@ +//// [parserForInStatement2.ts] +for (var in X) { +} + +//// [parserForInStatement2.js] +for ( in X) { +} diff --git a/tests/baselines/reference/parserForInStatement3.js b/tests/baselines/reference/parserForInStatement3.js new file mode 100644 index 00000000000..4964c108ca0 --- /dev/null +++ b/tests/baselines/reference/parserForInStatement3.js @@ -0,0 +1,7 @@ +//// [parserForInStatement3.ts] +for (var a, b in X) { +} + +//// [parserForInStatement3.js] +for (var a in X) { +} diff --git a/tests/baselines/reference/parserForInStatement6.js b/tests/baselines/reference/parserForInStatement6.js new file mode 100644 index 00000000000..b80d13f3184 --- /dev/null +++ b/tests/baselines/reference/parserForInStatement6.js @@ -0,0 +1,7 @@ +//// [parserForInStatement6.ts] +for (var a = 1, b = 2 in X) { +} + +//// [parserForInStatement6.js] +for (var a = 1 in X) { +} diff --git a/tests/baselines/reference/parserForInStatement7.js b/tests/baselines/reference/parserForInStatement7.js new file mode 100644 index 00000000000..5c056abedb6 --- /dev/null +++ b/tests/baselines/reference/parserForInStatement7.js @@ -0,0 +1,7 @@ +//// [parserForInStatement7.ts] +for (var a: number = 1, b: string = "" in X) { +} + +//// [parserForInStatement7.js] +for (var a = 1 in X) { +} diff --git a/tests/baselines/reference/parserFunctionDeclaration1.js b/tests/baselines/reference/parserFunctionDeclaration1.js new file mode 100644 index 00000000000..39bbfe67ca8 --- /dev/null +++ b/tests/baselines/reference/parserFunctionDeclaration1.js @@ -0,0 +1,6 @@ +//// [parserFunctionDeclaration1.ts] +declare module M { + declare function F(); +} + +//// [parserFunctionDeclaration1.js] diff --git a/tests/baselines/reference/parserFunctionDeclaration2.js b/tests/baselines/reference/parserFunctionDeclaration2.js new file mode 100644 index 00000000000..032489bc61c --- /dev/null +++ b/tests/baselines/reference/parserFunctionDeclaration2.js @@ -0,0 +1,5 @@ +//// [parserFunctionDeclaration2.ts] +declare function Foo() { +} + +//// [parserFunctionDeclaration2.js] diff --git a/tests/baselines/reference/parserFuzz1.js b/tests/baselines/reference/parserFuzz1.js new file mode 100644 index 00000000000..969c07c1659 --- /dev/null +++ b/tests/baselines/reference/parserFuzz1.js @@ -0,0 +1,13 @@ +//// [parserFuzz1.ts] +cla () { } +} + +//// [parserGetAccessorWithTypeParameters1.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "foo", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity12.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity12.js new file mode 100644 index 00000000000..2db83838747 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity12.js @@ -0,0 +1,6 @@ +//// [parserGreaterThanTokenAmbiguity12.ts] +1 >> = 2; + +//// [parserGreaterThanTokenAmbiguity12.js] +1 >> ; +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity13.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity13.js new file mode 100644 index 00000000000..49130a9dd13 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity13.js @@ -0,0 +1,6 @@ +//// [parserGreaterThanTokenAmbiguity13.ts] +1 >>/**/= 2; + +//// [parserGreaterThanTokenAmbiguity13.js] +1 >> ; /**/ +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js new file mode 100644 index 00000000000..5cc8bb3b88e --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js @@ -0,0 +1,7 @@ +//// [parserGreaterThanTokenAmbiguity14.ts] +1 >> += 2; + +//// [parserGreaterThanTokenAmbiguity14.js] +1 >> ; +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity17.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity17.js new file mode 100644 index 00000000000..58ea53274aa --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity17.js @@ -0,0 +1,6 @@ +//// [parserGreaterThanTokenAmbiguity17.ts] +1 >>> = 2; + +//// [parserGreaterThanTokenAmbiguity17.js] +1 >>> ; +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity18.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity18.js new file mode 100644 index 00000000000..71527689b2c --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity18.js @@ -0,0 +1,6 @@ +//// [parserGreaterThanTokenAmbiguity18.ts] +1 >>>/**/= 2; + +//// [parserGreaterThanTokenAmbiguity18.js] +1 >>> ; /**/ +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js new file mode 100644 index 00000000000..52035691c84 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js @@ -0,0 +1,7 @@ +//// [parserGreaterThanTokenAmbiguity19.ts] +1 >>> += 2; + +//// [parserGreaterThanTokenAmbiguity19.js] +1 >>> ; +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity2.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity2.js new file mode 100644 index 00000000000..d4cb01bf4c3 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity2.js @@ -0,0 +1,5 @@ +//// [parserGreaterThanTokenAmbiguity2.ts] +1 > > 2; + +//// [parserGreaterThanTokenAmbiguity2.js] +1 > > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity3.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity3.js new file mode 100644 index 00000000000..79f8c139260 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity3.js @@ -0,0 +1,5 @@ +//// [parserGreaterThanTokenAmbiguity3.ts] +1 >/**/> 2; + +//// [parserGreaterThanTokenAmbiguity3.js] +1 > /**/ > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js new file mode 100644 index 00000000000..5ef065681dc --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js @@ -0,0 +1,6 @@ +//// [parserGreaterThanTokenAmbiguity4.ts] +1 > +> 2; + +//// [parserGreaterThanTokenAmbiguity4.js] +1 > > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity7.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity7.js new file mode 100644 index 00000000000..a97cfa4bcc9 --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity7.js @@ -0,0 +1,5 @@ +//// [parserGreaterThanTokenAmbiguity7.ts] +1 >> > 2; + +//// [parserGreaterThanTokenAmbiguity7.js] +1 >> > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity8.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity8.js new file mode 100644 index 00000000000..0006c03219a --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity8.js @@ -0,0 +1,5 @@ +//// [parserGreaterThanTokenAmbiguity8.ts] +1 >>/**/> 2; + +//// [parserGreaterThanTokenAmbiguity8.js] +1 >> /**/ > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js new file mode 100644 index 00000000000..25c5ed53a7c --- /dev/null +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js @@ -0,0 +1,6 @@ +//// [parserGreaterThanTokenAmbiguity9.ts] +1 >> +> 2; + +//// [parserGreaterThanTokenAmbiguity9.js] +1 >> > 2; diff --git a/tests/baselines/reference/parserIndexMemberDeclaration10.js b/tests/baselines/reference/parserIndexMemberDeclaration10.js new file mode 100644 index 00000000000..cba928413a3 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration10.js @@ -0,0 +1,11 @@ +//// [parserIndexMemberDeclaration10.ts] +class C { + static static [x: string]: string; +} + +//// [parserIndexMemberDeclaration10.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserIndexMemberDeclaration5.js b/tests/baselines/reference/parserIndexMemberDeclaration5.js new file mode 100644 index 00000000000..209e26ae4c0 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration5.js @@ -0,0 +1,11 @@ +//// [parserIndexMemberDeclaration5.ts] +class C { + [a: string]: number public v: number +} + +//// [parserIndexMemberDeclaration5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserIndexMemberDeclaration6.js b/tests/baselines/reference/parserIndexMemberDeclaration6.js new file mode 100644 index 00000000000..9dae6a786b4 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration6.js @@ -0,0 +1,11 @@ +//// [parserIndexMemberDeclaration6.ts] +class C { + static [x: string]: string; +} + +//// [parserIndexMemberDeclaration6.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserIndexMemberDeclaration7.js b/tests/baselines/reference/parserIndexMemberDeclaration7.js new file mode 100644 index 00000000000..550063e6659 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration7.js @@ -0,0 +1,11 @@ +//// [parserIndexMemberDeclaration7.ts] +class C { + public [x: string]: string; +} + +//// [parserIndexMemberDeclaration7.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserIndexMemberDeclaration8.js b/tests/baselines/reference/parserIndexMemberDeclaration8.js new file mode 100644 index 00000000000..c1f40ad0f15 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration8.js @@ -0,0 +1,11 @@ +//// [parserIndexMemberDeclaration8.ts] +class C { + private [x: string]: string; +} + +//// [parserIndexMemberDeclaration8.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserIndexMemberDeclaration9.js b/tests/baselines/reference/parserIndexMemberDeclaration9.js new file mode 100644 index 00000000000..bd547be3bd3 --- /dev/null +++ b/tests/baselines/reference/parserIndexMemberDeclaration9.js @@ -0,0 +1,11 @@ +//// [parserIndexMemberDeclaration9.ts] +class C { + export [x: string]: string; +} + +//// [parserIndexMemberDeclaration9.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserIndexSignature1.js b/tests/baselines/reference/parserIndexSignature1.js new file mode 100644 index 00000000000..65c67444b34 --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature1.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature1.ts] +interface I { + [...a] +} + +//// [parserIndexSignature1.js] diff --git a/tests/baselines/reference/parserIndexSignature10.js b/tests/baselines/reference/parserIndexSignature10.js new file mode 100644 index 00000000000..a8fbccc402b --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature10.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature10.ts] +interface I { + [a, b]: number +} + +//// [parserIndexSignature10.js] diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt index c9976e2bc4a..8cf474b19bb 100644 --- a/tests/baselines/reference/parserIndexSignature11.errors.txt +++ b/tests/baselines/reference/parserIndexSignature11.errors.txt @@ -1,13 +1,16 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,10): error TS2304: Cannot find name 'p'. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter. -==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts (4 errors) ==== interface I { - [p]; + [p]; // Used to be indexer, now it is a computed property ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'p'. [p1: string]; ~~~~~~~~~~~~~ !!! error TS1021: An index signature must have a type annotation. diff --git a/tests/baselines/reference/parserIndexSignature11.js b/tests/baselines/reference/parserIndexSignature11.js new file mode 100644 index 00000000000..a78a2179d64 --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature11.js @@ -0,0 +1,8 @@ +//// [parserIndexSignature11.ts] +interface I { + [p]; // Used to be indexer, now it is a computed property + [p1: string]; + [p2: string, p3: number]; +} + +//// [parserIndexSignature11.js] diff --git a/tests/baselines/reference/parserIndexSignature2.js b/tests/baselines/reference/parserIndexSignature2.js new file mode 100644 index 00000000000..606a9c3435c --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature2.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature2.ts] +interface I { + [public a] +} + +//// [parserIndexSignature2.js] diff --git a/tests/baselines/reference/parserIndexSignature3.js b/tests/baselines/reference/parserIndexSignature3.js new file mode 100644 index 00000000000..d513d378fba --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature3.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature3.ts] +interface I { + [a?] +} + +//// [parserIndexSignature3.js] diff --git a/tests/baselines/reference/parserIndexSignature4.errors.txt b/tests/baselines/reference/parserIndexSignature4.errors.txt index 0f11eb17f3c..d625f27eb6f 100644 --- a/tests/baselines/reference/parserIndexSignature4.errors.txt +++ b/tests/baselines/reference/parserIndexSignature4.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2304: Cannot find name 'a'. -==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts (2 errors) ==== interface I { - [a = 0] + [a = 0] // Used to be indexer, now it is a computed property ~~~~~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature4.js b/tests/baselines/reference/parserIndexSignature4.js new file mode 100644 index 00000000000..fdfcab478b6 --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature4.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature4.ts] +interface I { + [a = 0] // Used to be indexer, now it is a computed property +} + +//// [parserIndexSignature4.js] diff --git a/tests/baselines/reference/parserIndexSignature5.errors.txt b/tests/baselines/reference/parserIndexSignature5.errors.txt index 6400383f9d2..3f3415973d9 100644 --- a/tests/baselines/reference/parserIndexSignature5.errors.txt +++ b/tests/baselines/reference/parserIndexSignature5.errors.txt @@ -1,9 +1,12 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'. -==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts (2 errors) ==== interface I { - [a] + [a] // Used to be indexer, now it is a computed property ~~~ !!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature5.js b/tests/baselines/reference/parserIndexSignature5.js new file mode 100644 index 00000000000..bce7f74f419 --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature5.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature5.ts] +interface I { + [a] // Used to be indexer, now it is a computed property +} + +//// [parserIndexSignature5.js] diff --git a/tests/baselines/reference/parserIndexSignature6.js b/tests/baselines/reference/parserIndexSignature6.js new file mode 100644 index 00000000000..8566faf26c4 --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature6.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature6.ts] +interface I { + [a:boolean] +} + +//// [parserIndexSignature6.js] diff --git a/tests/baselines/reference/parserIndexSignature7.js b/tests/baselines/reference/parserIndexSignature7.js new file mode 100644 index 00000000000..10c784e795a --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature7.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature7.ts] +interface I { + [a:string] +} + +//// [parserIndexSignature7.js] diff --git a/tests/baselines/reference/parserIndexSignature8.js b/tests/baselines/reference/parserIndexSignature8.js new file mode 100644 index 00000000000..40ea03fb245 --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature8.js @@ -0,0 +1,8 @@ +//// [parserIndexSignature8.ts] +var foo: { [index: any]; }; // expect an error here +var foo2: { [index: RegExp]; }; // expect an error here + + +//// [parserIndexSignature8.js] +var foo; // expect an error here +var foo2; // expect an error here diff --git a/tests/baselines/reference/parserIndexSignature9.js b/tests/baselines/reference/parserIndexSignature9.js new file mode 100644 index 00000000000..c2da7906e78 --- /dev/null +++ b/tests/baselines/reference/parserIndexSignature9.js @@ -0,0 +1,6 @@ +//// [parserIndexSignature9.ts] +interface I { + []: number +} + +//// [parserIndexSignature9.js] diff --git a/tests/baselines/reference/parserInterfaceDeclaration1.js b/tests/baselines/reference/parserInterfaceDeclaration1.js new file mode 100644 index 00000000000..61fe3eee877 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration1.js @@ -0,0 +1,5 @@ +//// [parserInterfaceDeclaration1.ts] +interface I extends A extends B { +} + +//// [parserInterfaceDeclaration1.js] diff --git a/tests/baselines/reference/parserInterfaceDeclaration2.js b/tests/baselines/reference/parserInterfaceDeclaration2.js new file mode 100644 index 00000000000..a0bbe96bae4 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration2.js @@ -0,0 +1,5 @@ +//// [parserInterfaceDeclaration2.ts] +interface I implements A { +} + +//// [parserInterfaceDeclaration2.js] diff --git a/tests/baselines/reference/parserInterfaceDeclaration3.js b/tests/baselines/reference/parserInterfaceDeclaration3.js new file mode 100644 index 00000000000..8281de6db79 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration3.js @@ -0,0 +1,5 @@ +//// [parserInterfaceDeclaration3.ts] +public interface I { +} + +//// [parserInterfaceDeclaration3.js] diff --git a/tests/baselines/reference/parserInterfaceDeclaration4.js b/tests/baselines/reference/parserInterfaceDeclaration4.js new file mode 100644 index 00000000000..9385388d81d --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration4.js @@ -0,0 +1,5 @@ +//// [parserInterfaceDeclaration4.ts] +static interface I { +} + +//// [parserInterfaceDeclaration4.js] diff --git a/tests/baselines/reference/parserInterfaceDeclaration5.js b/tests/baselines/reference/parserInterfaceDeclaration5.js new file mode 100644 index 00000000000..81ad1108f24 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration5.js @@ -0,0 +1,5 @@ +//// [parserInterfaceDeclaration5.ts] +declare interface I { +} + +//// [parserInterfaceDeclaration5.js] diff --git a/tests/baselines/reference/parserInterfaceDeclaration6.js b/tests/baselines/reference/parserInterfaceDeclaration6.js new file mode 100644 index 00000000000..3cecca19198 --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration6.js @@ -0,0 +1,5 @@ +//// [parserInterfaceDeclaration6.ts] +export export interface I { +} + +//// [parserInterfaceDeclaration6.js] diff --git a/tests/baselines/reference/parserInterfaceDeclaration7.js b/tests/baselines/reference/parserInterfaceDeclaration7.js new file mode 100644 index 00000000000..40998c119cf --- /dev/null +++ b/tests/baselines/reference/parserInterfaceDeclaration7.js @@ -0,0 +1,5 @@ +//// [parserInterfaceDeclaration7.ts] +export interface I { +} + +//// [parserInterfaceDeclaration7.js] diff --git a/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js new file mode 100644 index 00000000000..09fcffc1b0d --- /dev/null +++ b/tests/baselines/reference/parserInvalidIdentifiersInVariableStatements1.js @@ -0,0 +1,12 @@ +//// [parserInvalidIdentifiersInVariableStatements1.ts] +var export; +var foo; +var class; +var bar; + + +//// [parserInvalidIdentifiersInVariableStatements1.js] +var ; +var foo; +var ; +var bar; diff --git a/tests/baselines/reference/parserKeywordsAsIdentifierName2.js b/tests/baselines/reference/parserKeywordsAsIdentifierName2.js new file mode 100644 index 00000000000..bc47da5766e --- /dev/null +++ b/tests/baselines/reference/parserKeywordsAsIdentifierName2.js @@ -0,0 +1,7 @@ +//// [parserKeywordsAsIdentifierName2.ts] +// 'public' should be marked unusable, should complain on trailing /* +a.public /* + +//// [parserKeywordsAsIdentifierName2.js] +// 'public' should be marked unusable, should complain on trailing /* +a.public; /* diff --git a/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.js b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.js new file mode 100644 index 00000000000..d8f6204adfa --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessAfterPostfixExpression1.js @@ -0,0 +1,6 @@ +//// [parserMemberAccessAfterPostfixExpression1.ts] +a--.toString() + +//// [parserMemberAccessAfterPostfixExpression1.js] +a--; +toString(); diff --git a/tests/baselines/reference/parserMemberAccessExpression1.js b/tests/baselines/reference/parserMemberAccessExpression1.js new file mode 100644 index 00000000000..83897e27097 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessExpression1.js @@ -0,0 +1,12 @@ +//// [parserMemberAccessExpression1.ts] +Foo(); +Foo.Bar(); +Foo.Bar(); +Foo.Bar(); + + +//// [parserMemberAccessExpression1.js] +Foo(); +Foo.Bar(); +Foo(Bar()); +Foo(Bar()); diff --git a/tests/baselines/reference/parserMemberAccessOffOfGenericType1.js b/tests/baselines/reference/parserMemberAccessOffOfGenericType1.js new file mode 100644 index 00000000000..4529fafba02 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessOffOfGenericType1.js @@ -0,0 +1,5 @@ +//// [parserMemberAccessOffOfGenericType1.ts] +var v = List.makeChild(); + +//// [parserMemberAccessOffOfGenericType1.js] +var v = List(makeChild()); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration10.js b/tests/baselines/reference/parserMemberAccessorDeclaration10.js new file mode 100644 index 00000000000..dba06544963 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration10.js @@ -0,0 +1,18 @@ +//// [parserMemberAccessorDeclaration10.ts] +class C { + export get Foo() { } +} + +//// [parserMemberAccessorDeclaration10.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + get: function () { + } + exports.Foo = Foo;, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration11.js b/tests/baselines/reference/parserMemberAccessorDeclaration11.js new file mode 100644 index 00000000000..2a286b8ca6b --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration11.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration11.ts] +class C { + declare get Foo() { } +} + +//// [parserMemberAccessorDeclaration11.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration12.js b/tests/baselines/reference/parserMemberAccessorDeclaration12.js new file mode 100644 index 00000000000..aea6eccfbc2 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration12.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration12.ts] +class C { + get Foo(a: number) { } +} + +//// [parserMemberAccessorDeclaration12.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + get: function (a) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration13.js b/tests/baselines/reference/parserMemberAccessorDeclaration13.js new file mode 100644 index 00000000000..f6ca4ee6a02 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration13.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration13.ts] +class C { + set Foo() { } +} + +//// [parserMemberAccessorDeclaration13.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function () { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration14.js b/tests/baselines/reference/parserMemberAccessorDeclaration14.js new file mode 100644 index 00000000000..62877d402d1 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration14.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration14.ts] +class C { + set Foo(a: number, b: number) { } +} + +//// [parserMemberAccessorDeclaration14.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function (a, b) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration16.js b/tests/baselines/reference/parserMemberAccessorDeclaration16.js new file mode 100644 index 00000000000..a6cd0aaa7e9 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration16.js @@ -0,0 +1,18 @@ +//// [parserMemberAccessorDeclaration16.ts] +class C { + set Foo(a = 1) { } +} + +//// [parserMemberAccessorDeclaration16.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function (a) { + if (a === void 0) { a = 1; } + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration17.js b/tests/baselines/reference/parserMemberAccessorDeclaration17.js new file mode 100644 index 00000000000..6c99c7ddae6 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration17.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration17.ts] +class C { + set Foo(a?: number) { } +} + +//// [parserMemberAccessorDeclaration17.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function (a) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration18.js b/tests/baselines/reference/parserMemberAccessorDeclaration18.js new file mode 100644 index 00000000000..9483a1f2daf --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration18.js @@ -0,0 +1,21 @@ +//// [parserMemberAccessorDeclaration18.ts] +class C { + set Foo(...a) { } +} + +//// [parserMemberAccessorDeclaration18.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + set: function () { + var a = []; + for (var _i = 0; _i < arguments.length; _i++) { + a[_i - 0] = arguments[_i]; + } + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration7.js b/tests/baselines/reference/parserMemberAccessorDeclaration7.js new file mode 100644 index 00000000000..0d2d24092e5 --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration7.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration7.ts] +class C { + public public get Foo() { } +} + +//// [parserMemberAccessorDeclaration7.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "Foo", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration8.js b/tests/baselines/reference/parserMemberAccessorDeclaration8.js new file mode 100644 index 00000000000..dd93fa4852e --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration8.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration8.ts] +class C { + static static get Foo() { } +} + +//// [parserMemberAccessorDeclaration8.js] +var C = (function () { + function C() { + } + Object.defineProperty(C, "Foo", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberAccessorDeclaration9.js b/tests/baselines/reference/parserMemberAccessorDeclaration9.js new file mode 100644 index 00000000000..5fca86f689b --- /dev/null +++ b/tests/baselines/reference/parserMemberAccessorDeclaration9.js @@ -0,0 +1,17 @@ +//// [parserMemberAccessorDeclaration9.ts] +class C { + static public get Foo() { } +} + +//// [parserMemberAccessorDeclaration9.js] +var C = (function () { + function C() { + } + Object.defineProperty(C, "Foo", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration1.js b/tests/baselines/reference/parserMemberFunctionDeclaration1.js new file mode 100644 index 00000000000..564245157b0 --- /dev/null +++ b/tests/baselines/reference/parserMemberFunctionDeclaration1.js @@ -0,0 +1,13 @@ +//// [parserMemberFunctionDeclaration1.ts] +class C { + public public Foo() { } +} + +//// [parserMemberFunctionDeclaration1.js] +var C = (function () { + function C() { + } + C.prototype.Foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration2.js b/tests/baselines/reference/parserMemberFunctionDeclaration2.js new file mode 100644 index 00000000000..0f103c90b7d --- /dev/null +++ b/tests/baselines/reference/parserMemberFunctionDeclaration2.js @@ -0,0 +1,13 @@ +//// [parserMemberFunctionDeclaration2.ts] +class C { + static static Foo() { } +} + +//// [parserMemberFunctionDeclaration2.js] +var C = (function () { + function C() { + } + C.Foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration3.js b/tests/baselines/reference/parserMemberFunctionDeclaration3.js new file mode 100644 index 00000000000..46243f08dad --- /dev/null +++ b/tests/baselines/reference/parserMemberFunctionDeclaration3.js @@ -0,0 +1,13 @@ +//// [parserMemberFunctionDeclaration3.ts] +class C { + static public Foo() { } +} + +//// [parserMemberFunctionDeclaration3.js] +var C = (function () { + function C() { + } + C.Foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration4.js b/tests/baselines/reference/parserMemberFunctionDeclaration4.js new file mode 100644 index 00000000000..bcf00aeb1bc --- /dev/null +++ b/tests/baselines/reference/parserMemberFunctionDeclaration4.js @@ -0,0 +1,14 @@ +//// [parserMemberFunctionDeclaration4.ts] +class C { + export Foo() { } +} + +//// [parserMemberFunctionDeclaration4.js] +var C = (function () { + function C() { + } + C.prototype.Foo = function () { + } + exports.Foo = Foo;; + return C; +})(); diff --git a/tests/baselines/reference/parserMemberFunctionDeclaration5.js b/tests/baselines/reference/parserMemberFunctionDeclaration5.js new file mode 100644 index 00000000000..da2d2281999 --- /dev/null +++ b/tests/baselines/reference/parserMemberFunctionDeclaration5.js @@ -0,0 +1,13 @@ +//// [parserMemberFunctionDeclaration5.ts] +class C { + declare Foo() { } +} + +//// [parserMemberFunctionDeclaration5.js] +var C = (function () { + function C() { + } + C.prototype.Foo = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserMemberVariableDeclaration1.js b/tests/baselines/reference/parserMemberVariableDeclaration1.js new file mode 100644 index 00000000000..7c59fa7db4c --- /dev/null +++ b/tests/baselines/reference/parserMemberVariableDeclaration1.js @@ -0,0 +1,11 @@ +//// [parserMemberVariableDeclaration1.ts] +class C { + public public Foo; +} + +//// [parserMemberVariableDeclaration1.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserMemberVariableDeclaration2.js b/tests/baselines/reference/parserMemberVariableDeclaration2.js new file mode 100644 index 00000000000..7f4ae15a7ee --- /dev/null +++ b/tests/baselines/reference/parserMemberVariableDeclaration2.js @@ -0,0 +1,11 @@ +//// [parserMemberVariableDeclaration2.ts] +class C { + static static Foo; +} + +//// [parserMemberVariableDeclaration2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserMemberVariableDeclaration3.js b/tests/baselines/reference/parserMemberVariableDeclaration3.js new file mode 100644 index 00000000000..e03279abed9 --- /dev/null +++ b/tests/baselines/reference/parserMemberVariableDeclaration3.js @@ -0,0 +1,11 @@ +//// [parserMemberVariableDeclaration3.ts] +class C { + static public Foo; +} + +//// [parserMemberVariableDeclaration3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserMemberVariableDeclaration4.js b/tests/baselines/reference/parserMemberVariableDeclaration4.js new file mode 100644 index 00000000000..d52dd0f4a08 --- /dev/null +++ b/tests/baselines/reference/parserMemberVariableDeclaration4.js @@ -0,0 +1,11 @@ +//// [parserMemberVariableDeclaration4.ts] +class C { + export Foo; +} + +//// [parserMemberVariableDeclaration4.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserMemberVariableDeclaration5.js b/tests/baselines/reference/parserMemberVariableDeclaration5.js new file mode 100644 index 00000000000..bc8a49ff3f5 --- /dev/null +++ b/tests/baselines/reference/parserMemberVariableDeclaration5.js @@ -0,0 +1,11 @@ +//// [parserMemberVariableDeclaration5.ts] +class C { + declare Foo; +} + +//// [parserMemberVariableDeclaration5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserMissingLambdaOpenBrace1.js b/tests/baselines/reference/parserMissingLambdaOpenBrace1.js new file mode 100644 index 00000000000..8280d8dc9b2 --- /dev/null +++ b/tests/baselines/reference/parserMissingLambdaOpenBrace1.js @@ -0,0 +1,23 @@ +//// [parserMissingLambdaOpenBrace1.ts] +class C { + where(filter: Iterator): Query { + return fromDoWhile(test => + var index = 0; + return this.doWhile((item, i) => filter(item, i) ? test(item, index++) : true); + }); + } +} + +//// [parserMissingLambdaOpenBrace1.js] +var C = (function () { + function C() { + } + C.prototype.where = function (filter) { + var _this = this; + return fromDoWhile(function (test) { + var index = 0; + return _this.doWhile(function (item, i) { return filter(item, i) ? test(item, index++) : true; }); + }); + }; + return C; +})(); diff --git a/tests/baselines/reference/parserMissingToken1.js b/tests/baselines/reference/parserMissingToken1.js new file mode 100644 index 00000000000..506e628fa38 --- /dev/null +++ b/tests/baselines/reference/parserMissingToken1.js @@ -0,0 +1,9 @@ +//// [parserMissingToken1.ts] +a / finally + +//// [parserMissingToken1.js] +a / ; +try { +} +finally { +} diff --git a/tests/baselines/reference/parserMissingToken2.js b/tests/baselines/reference/parserMissingToken2.js new file mode 100644 index 00000000000..753132a4a4a --- /dev/null +++ b/tests/baselines/reference/parserMissingToken2.js @@ -0,0 +1,5 @@ +//// [parserMissingToken2.ts] +/ b; + +//// [parserMissingToken2.js] +/ b;; diff --git a/tests/baselines/reference/parserModifierOnPropertySignature1.js b/tests/baselines/reference/parserModifierOnPropertySignature1.js new file mode 100644 index 00000000000..a71bfd756a0 --- /dev/null +++ b/tests/baselines/reference/parserModifierOnPropertySignature1.js @@ -0,0 +1,7 @@ +//// [parserModifierOnPropertySignature1.ts] +interface Foo{ + public biz; +} + + +//// [parserModifierOnPropertySignature1.js] diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock1.js b/tests/baselines/reference/parserModifierOnStatementInBlock1.js new file mode 100644 index 00000000000..1796c9eddf5 --- /dev/null +++ b/tests/baselines/reference/parserModifierOnStatementInBlock1.js @@ -0,0 +1,11 @@ +//// [parserModifierOnStatementInBlock1.ts] +export function foo() { + export var x = this; +} + + +//// [parserModifierOnStatementInBlock1.js] +function foo() { + exports.x = this; +} +exports.foo = foo; diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock2.js b/tests/baselines/reference/parserModifierOnStatementInBlock2.js new file mode 100644 index 00000000000..7e1c5f8ee50 --- /dev/null +++ b/tests/baselines/reference/parserModifierOnStatementInBlock2.js @@ -0,0 +1,9 @@ +//// [parserModifierOnStatementInBlock2.ts] +{ + declare var x = this; +} + + +//// [parserModifierOnStatementInBlock2.js] +{ +} diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock3.js b/tests/baselines/reference/parserModifierOnStatementInBlock3.js new file mode 100644 index 00000000000..9c625f0dc7f --- /dev/null +++ b/tests/baselines/reference/parserModifierOnStatementInBlock3.js @@ -0,0 +1,14 @@ +//// [parserModifierOnStatementInBlock3.ts] +export function foo() { + export function bar() { + } +} + + +//// [parserModifierOnStatementInBlock3.js] +function foo() { + function bar() { + } + exports.bar = bar; +} +exports.foo = foo; diff --git a/tests/baselines/reference/parserModule1.js b/tests/baselines/reference/parserModule1.js new file mode 100644 index 00000000000..1eba49114ab --- /dev/null +++ b/tests/baselines/reference/parserModule1.js @@ -0,0 +1,60 @@ +//// [parserModule1.ts] + export module CompilerDiagnostics { + export var debug = false; + export interface IDiagnosticWriter { + Alert(output: string): void; + } + + export var diagnosticWriter: IDiagnosticWriter = null; + + export var analysisPass: number = 0; + + export function Alert(output: string) { + if (diagnosticWriter) { + diagnosticWriter.Alert(output); + } + } + + export function debugPrint(s: string) { + if (debug) { + Alert(s); + } + } + + export function assert(condition: boolean, s: string) { + if (debug) { + if (!condition) { + Alert(s); + } + } + } + + } + +//// [parserModule1.js] +var CompilerDiagnostics; +(function (CompilerDiagnostics) { + CompilerDiagnostics.debug = false; + CompilerDiagnostics.diagnosticWriter = null; + CompilerDiagnostics.analysisPass = 0; + function Alert(output) { + if (CompilerDiagnostics.diagnosticWriter) { + CompilerDiagnostics.diagnosticWriter.Alert(output); + } + } + CompilerDiagnostics.Alert = Alert; + function debugPrint(s) { + if (CompilerDiagnostics.debug) { + Alert(s); + } + } + CompilerDiagnostics.debugPrint = debugPrint; + function assert(condition, s) { + if (CompilerDiagnostics.debug) { + if (!condition) { + Alert(s); + } + } + } + CompilerDiagnostics.assert = assert; +})(CompilerDiagnostics = exports.CompilerDiagnostics || (exports.CompilerDiagnostics = {})); diff --git a/tests/baselines/reference/parserModuleDeclaration1.js b/tests/baselines/reference/parserModuleDeclaration1.js new file mode 100644 index 00000000000..aef0434f76d --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration1.js @@ -0,0 +1,5 @@ +//// [parserModuleDeclaration1.ts] +module "Foo" { +} + +//// [parserModuleDeclaration1.js] diff --git a/tests/baselines/reference/parserModuleDeclaration3.js b/tests/baselines/reference/parserModuleDeclaration3.js new file mode 100644 index 00000000000..c4c46cd1442 --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration3.js @@ -0,0 +1,7 @@ +//// [parserModuleDeclaration3.ts] +declare module M { + declare module M2 { + } +} + +//// [parserModuleDeclaration3.js] diff --git a/tests/baselines/reference/parserModuleDeclaration5.js b/tests/baselines/reference/parserModuleDeclaration5.js new file mode 100644 index 00000000000..c6017ba813d --- /dev/null +++ b/tests/baselines/reference/parserModuleDeclaration5.js @@ -0,0 +1,9 @@ +//// [parserModuleDeclaration5.ts] +module M1 { + declare module M2 { + declare module M3 { + } + } +} + +//// [parserModuleDeclaration5.js] diff --git a/tests/baselines/reference/parserNotRegex1.js b/tests/baselines/reference/parserNotRegex1.js new file mode 100644 index 00000000000..1169640d850 --- /dev/null +++ b/tests/baselines/reference/parserNotRegex1.js @@ -0,0 +1,10 @@ +//// [parserNotRegex1.ts] + if (a.indexOf(-(4/3))) // We should not get a regex here becuase of the / in the comment. + { + return true; + } + +//// [parserNotRegex1.js] +if (a.indexOf(-(4 / 3))) { + return true; +} diff --git a/tests/baselines/reference/parserObjectCreationArrayLiteral1.js b/tests/baselines/reference/parserObjectCreationArrayLiteral1.js new file mode 100644 index 00000000000..562f1ada637 --- /dev/null +++ b/tests/baselines/reference/parserObjectCreationArrayLiteral1.js @@ -0,0 +1,5 @@ +//// [parserObjectCreationArrayLiteral1.ts] +new Foo[]; + +//// [parserObjectCreationArrayLiteral1.js] +new Foo[]; diff --git a/tests/baselines/reference/parserObjectCreationArrayLiteral3.js b/tests/baselines/reference/parserObjectCreationArrayLiteral3.js new file mode 100644 index 00000000000..8bb892de41a --- /dev/null +++ b/tests/baselines/reference/parserObjectCreationArrayLiteral3.js @@ -0,0 +1,5 @@ +//// [parserObjectCreationArrayLiteral3.ts] +new Foo[](); + +//// [parserObjectCreationArrayLiteral3.js] +new Foo[](); diff --git a/tests/baselines/reference/parserObjectType5.js b/tests/baselines/reference/parserObjectType5.js new file mode 100644 index 00000000000..59284c73e73 --- /dev/null +++ b/tests/baselines/reference/parserObjectType5.js @@ -0,0 +1,8 @@ +//// [parserObjectType5.ts] +var v: { + A: B + ; +}; + +//// [parserObjectType5.js] +var v; diff --git a/tests/baselines/reference/parserObjectType6.js b/tests/baselines/reference/parserObjectType6.js new file mode 100644 index 00000000000..96b3c1a8f99 --- /dev/null +++ b/tests/baselines/reference/parserObjectType6.js @@ -0,0 +1,8 @@ +//// [parserObjectType6.ts] +var v: { + a: B + []; +}; + +//// [parserObjectType6.js] +var v; diff --git a/tests/baselines/reference/parserParameterList1.js b/tests/baselines/reference/parserParameterList1.js new file mode 100644 index 00000000000..49af7780b1f --- /dev/null +++ b/tests/baselines/reference/parserParameterList1.js @@ -0,0 +1,13 @@ +//// [parserParameterList1.ts] +class C { + F(...A, B) { } +} + +//// [parserParameterList1.js] +var C = (function () { + function C() { + } + C.prototype.F = function (A, B) { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserParameterList10.js b/tests/baselines/reference/parserParameterList10.js new file mode 100644 index 00000000000..4f85dec801c --- /dev/null +++ b/tests/baselines/reference/parserParameterList10.js @@ -0,0 +1,18 @@ +//// [parserParameterList10.ts] +class C { + foo(...bar = 0) { } +} + +//// [parserParameterList10.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + if (bar === void 0) { bar = 0; } + var bar = []; + for (var _i = 0; _i < arguments.length; _i++) { + bar[_i - 0] = arguments[_i]; + } + }; + return C; +})(); diff --git a/tests/baselines/reference/parserParameterList11.js b/tests/baselines/reference/parserParameterList11.js new file mode 100644 index 00000000000..a56e8b58c20 --- /dev/null +++ b/tests/baselines/reference/parserParameterList11.js @@ -0,0 +1,11 @@ +//// [parserParameterList11.ts] +(...arg?) => 102; + +//// [parserParameterList11.js] +(function () { + var arg = []; + for (var _i = 0; _i < arguments.length; _i++) { + arg[_i - 0] = arguments[_i]; + } + return 102; +}); diff --git a/tests/baselines/reference/parserParameterList12.js b/tests/baselines/reference/parserParameterList12.js new file mode 100644 index 00000000000..ce912f0cdfd --- /dev/null +++ b/tests/baselines/reference/parserParameterList12.js @@ -0,0 +1,7 @@ +//// [parserParameterList12.ts] +function F(a,) { +} + +//// [parserParameterList12.js] +function F(a) { +} diff --git a/tests/baselines/reference/parserParameterList2.js b/tests/baselines/reference/parserParameterList2.js new file mode 100644 index 00000000000..c6a7f48c43e --- /dev/null +++ b/tests/baselines/reference/parserParameterList2.js @@ -0,0 +1,14 @@ +//// [parserParameterList2.ts] +class C { + F(A?= 0) { } +} + +//// [parserParameterList2.js] +var C = (function () { + function C() { + } + C.prototype.F = function (A) { + if (A === void 0) { A = 0; } + }; + return C; +})(); diff --git a/tests/baselines/reference/parserParameterList3.js b/tests/baselines/reference/parserParameterList3.js new file mode 100644 index 00000000000..01135f0ceff --- /dev/null +++ b/tests/baselines/reference/parserParameterList3.js @@ -0,0 +1,13 @@ +//// [parserParameterList3.ts] +class C { + F(A?, B) { } +} + +//// [parserParameterList3.js] +var C = (function () { + function C() { + } + C.prototype.F = function (A, B) { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserParameterList9.js b/tests/baselines/reference/parserParameterList9.js new file mode 100644 index 00000000000..965b92a7ef6 --- /dev/null +++ b/tests/baselines/reference/parserParameterList9.js @@ -0,0 +1,17 @@ +//// [parserParameterList9.ts] +class C { + foo(...bar?) { } +} + +//// [parserParameterList9.js] +var C = (function () { + function C() { + } + C.prototype.foo = function () { + var bar = []; + for (var _i = 0; _i < arguments.length; _i++) { + bar[_i - 0] = arguments[_i]; + } + }; + return C; +})(); diff --git a/tests/baselines/reference/parserPostfixPostfixExpression1.js b/tests/baselines/reference/parserPostfixPostfixExpression1.js new file mode 100644 index 00000000000..ebb8917d777 --- /dev/null +++ b/tests/baselines/reference/parserPostfixPostfixExpression1.js @@ -0,0 +1,6 @@ +//// [parserPostfixPostfixExpression1.ts] +a++ ++; + +//// [parserPostfixPostfixExpression1.js] +a++; +++; diff --git a/tests/baselines/reference/parserPostfixUnaryExpression1.js b/tests/baselines/reference/parserPostfixUnaryExpression1.js new file mode 100644 index 00000000000..991e2f34f99 --- /dev/null +++ b/tests/baselines/reference/parserPostfixUnaryExpression1.js @@ -0,0 +1,6 @@ +//// [parserPostfixUnaryExpression1.ts] +foo ++ ++; + +//// [parserPostfixUnaryExpression1.js] +foo++; +++; diff --git a/tests/baselines/reference/parserPublicBreak1.js b/tests/baselines/reference/parserPublicBreak1.js new file mode 100644 index 00000000000..f1b9647f228 --- /dev/null +++ b/tests/baselines/reference/parserPublicBreak1.js @@ -0,0 +1,6 @@ +//// [parserPublicBreak1.ts] +public break; + + +//// [parserPublicBreak1.js] +break; diff --git a/tests/baselines/reference/parserRealSource1.js b/tests/baselines/reference/parserRealSource1.js new file mode 100644 index 00000000000..c62897c9aff --- /dev/null +++ b/tests/baselines/reference/parserRealSource1.js @@ -0,0 +1,325 @@ +//// [parserRealSource1.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + export module CompilerDiagnostics { + export var debug = false; + export interface IDiagnosticWriter { + Alert(output: string): void; + } + + export var diagnosticWriter: IDiagnosticWriter = null; + + export var analysisPass: number = 0; + + export function Alert(output: string) { + if (diagnosticWriter) { + diagnosticWriter.Alert(output); + } + } + + export function debugPrint(s: string) { + if (debug) { + Alert(s); + } + } + + export function assert(condition: boolean, s: string) { + if (debug) { + if (!condition) { + Alert(s); + } + } + } + + } + + export interface ILogger { + information(): boolean; + debug(): boolean; + warning(): boolean; + error(): boolean; + fatal(): boolean; + log(s: string): void; + } + + export class NullLogger implements ILogger { + public information(): boolean { return false; } + public debug(): boolean { return false; } + public warning(): boolean { return false; } + public error(): boolean { return false; } + public fatal(): boolean { return false; } + public log(s: string): void { + } + } + + export class LoggerAdapter implements ILogger { + private _information: boolean; + private _debug: boolean; + private _warning: boolean; + private _error: boolean; + private _fatal: boolean; + + constructor (public logger: ILogger) { + this._information = this.logger.information(); + this._debug = this.logger.debug(); + this._warning = this.logger.warning(); + this._error = this.logger.error(); + this._fatal = this.logger.fatal(); + } + + + public information(): boolean { return this._information; } + public debug(): boolean { return this._debug; } + public warning(): boolean { return this._warning; } + public error(): boolean { return this._error; } + public fatal(): boolean { return this._fatal; } + public log(s: string): void { + this.logger.log(s); + } + } + + export class BufferedLogger implements ILogger { + public logContents = []; + + public information(): boolean { return false; } + public debug(): boolean { return false; } + public warning(): boolean { return false; } + public error(): boolean { return false; } + public fatal(): boolean { return false; } + public log(s: string): void { + this.logContents.push(s); + } + } + + export function timeFunction(logger: ILogger, funcDescription: string, func: () =>any): any { + var start = +new Date(); + var result = func(); + var end = +new Date(); + logger.log(funcDescription + " completed in " + (end - start) + " msec"); + return result; + } + + export function stringToLiteral(value: string, length: number): string { + var result = ""; + + var addChar = (index: number) => { + var ch = value.charCodeAt(index); + switch (ch) { + case 0x09: // tab + result += "\\t"; + break; + case 0x0a: // line feed + result += "\\n"; + break; + case 0x0b: // vertical tab + result += "\\v"; + break; + case 0x0c: // form feed + result += "\\f"; + break; + case 0x0d: // carriage return + result += "\\r"; + break; + case 0x22: // double quote + result += "\\\""; + break; + case 0x27: // single quote + result += "\\\'"; + break; + case 0x5c: // Backslash + result += "\\"; + break; + default: + result += value.charAt(index); + } + } + + var tooLong = (value.length > length); + if (tooLong) { + var mid = length >> 1; + for (var i = 0; i < mid; i++) addChar(i); + result += "(...)"; + for (var i = value.length - mid; i < value.length; i++) addChar(i); + } + else { + length = value.length; + for (var i = 0; i < length; i++) addChar(i); + } + return result; + } +} + + +//// [parserRealSource1.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + var CompilerDiagnostics; + (function (CompilerDiagnostics) { + CompilerDiagnostics.debug = false; + CompilerDiagnostics.diagnosticWriter = null; + CompilerDiagnostics.analysisPass = 0; + function Alert(output) { + if (CompilerDiagnostics.diagnosticWriter) { + CompilerDiagnostics.diagnosticWriter.Alert(output); + } + } + CompilerDiagnostics.Alert = Alert; + function debugPrint(s) { + if (CompilerDiagnostics.debug) { + Alert(s); + } + } + CompilerDiagnostics.debugPrint = debugPrint; + function assert(condition, s) { + if (CompilerDiagnostics.debug) { + if (!condition) { + Alert(s); + } + } + } + CompilerDiagnostics.assert = assert; + })(CompilerDiagnostics = TypeScript.CompilerDiagnostics || (TypeScript.CompilerDiagnostics = {})); + var NullLogger = (function () { + function NullLogger() { + } + NullLogger.prototype.information = function () { + return false; + }; + NullLogger.prototype.debug = function () { + return false; + }; + NullLogger.prototype.warning = function () { + return false; + }; + NullLogger.prototype.error = function () { + return false; + }; + NullLogger.prototype.fatal = function () { + return false; + }; + NullLogger.prototype.log = function (s) { + }; + return NullLogger; + })(); + TypeScript.NullLogger = NullLogger; + var LoggerAdapter = (function () { + function LoggerAdapter(logger) { + this.logger = logger; + this._information = this.logger.information(); + this._debug = this.logger.debug(); + this._warning = this.logger.warning(); + this._error = this.logger.error(); + this._fatal = this.logger.fatal(); + } + LoggerAdapter.prototype.information = function () { + return this._information; + }; + LoggerAdapter.prototype.debug = function () { + return this._debug; + }; + LoggerAdapter.prototype.warning = function () { + return this._warning; + }; + LoggerAdapter.prototype.error = function () { + return this._error; + }; + LoggerAdapter.prototype.fatal = function () { + return this._fatal; + }; + LoggerAdapter.prototype.log = function (s) { + this.logger.log(s); + }; + return LoggerAdapter; + })(); + TypeScript.LoggerAdapter = LoggerAdapter; + var BufferedLogger = (function () { + function BufferedLogger() { + this.logContents = []; + } + BufferedLogger.prototype.information = function () { + return false; + }; + BufferedLogger.prototype.debug = function () { + return false; + }; + BufferedLogger.prototype.warning = function () { + return false; + }; + BufferedLogger.prototype.error = function () { + return false; + }; + BufferedLogger.prototype.fatal = function () { + return false; + }; + BufferedLogger.prototype.log = function (s) { + this.logContents.push(s); + }; + return BufferedLogger; + })(); + TypeScript.BufferedLogger = BufferedLogger; + function timeFunction(logger, funcDescription, func) { + var start = +new Date(); + var result = func(); + var end = +new Date(); + logger.log(funcDescription + " completed in " + (end - start) + " msec"); + return result; + } + TypeScript.timeFunction = timeFunction; + function stringToLiteral(value, length) { + var result = ""; + var addChar = function (index) { + var ch = value.charCodeAt(index); + switch (ch) { + case 0x09: + result += "\\t"; + break; + case 0x0a: + result += "\\n"; + break; + case 0x0b: + result += "\\v"; + break; + case 0x0c: + result += "\\f"; + break; + case 0x0d: + result += "\\r"; + break; + case 0x22: + result += "\\\""; + break; + case 0x27: + result += "\\\'"; + break; + case 0x5c: + result += "\\"; + break; + default: + result += value.charAt(index); + } + }; + var tooLong = (value.length > length); + if (tooLong) { + var mid = length >> 1; + for (var i = 0; i < mid; i++) + addChar(i); + result += "(...)"; + for (var i = value.length - mid; i < value.length; i++) + addChar(i); + } + else { + length = value.length; + for (var i = 0; i < length; i++) + addChar(i); + } + return result; + } + TypeScript.stringToLiteral = stringToLiteral; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js new file mode 100644 index 00000000000..0dd944a7721 --- /dev/null +++ b/tests/baselines/reference/parserRealSource10.js @@ -0,0 +1,930 @@ +//// [parserRealSource10.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + export enum TokenID { + // Keywords + Any, + Bool, + Break, + Case, + Catch, + Class, + Const, + Continue, + Debugger, + Default, + Delete, + Do, + Else, + Enum, + Export, + Extends, + Declare, + False, + Finally, + For, + Function, + Constructor, + Get, + If, + Implements, + Import, + In, + InstanceOf, + Interface, + Let, + Module, + New, + Number, + Null, + Package, + Private, + Protected, + Public, + Return, + Set, + Static, + String, + Super, + Switch, + This, + Throw, + True, + Try, + TypeOf, + Var, + Void, + With, + While, + Yield, + // Punctuation + Semicolon, + OpenParen, + CloseParen, + OpenBracket, + CloseBracket, + OpenBrace, + CloseBrace, + Comma, + Equals, + PlusEquals, + MinusEquals, + AsteriskEquals, + SlashEquals, + PercentEquals, + AmpersandEquals, + CaretEquals, + BarEquals, + LessThanLessThanEquals, + GreaterThanGreaterThanEquals, + GreaterThanGreaterThanGreaterThanEquals, + Question, + Colon, + BarBar, + AmpersandAmpersand, + Bar, + Caret, + And, + EqualsEquals, + ExclamationEquals, + EqualsEqualsEquals, + ExclamationEqualsEquals, + LessThan, + LessThanEquals, + GreaterThan, + GreaterThanEquals, + LessThanLessThan, + GreaterThanGreaterThan, + GreaterThanGreaterThanGreaterThan, + Plus, + Minus, + Asterisk, + Slash, + Percent, + Tilde, + Exclamation, + PlusPlus, + MinusMinus, + Dot, + DotDotDot, + Error, + EndOfFile, + EqualsGreaterThan, + Identifier, + StringLiteral, + RegularExpressionLiteral, + NumberLiteral, + Whitespace, + Comment, + Lim, + LimFixed = EqualsGreaterThan, + LimKeyword = Yield, + } + + export var tokenTable = new TokenInfo[]; + export var nodeTypeTable = new string[]; + export var nodeTypeToTokTable = new number[]; + export var noRegexTable = new boolean[]; + + noRegexTable[TokenID.Identifier] = true; + noRegexTable[TokenID.StringLiteral] = true; + noRegexTable[TokenID.NumberLiteral] = true; + noRegexTable[TokenID.RegularExpressionLiteral] = true; + noRegexTable[TokenID.This] = true; + noRegexTable[TokenID.PlusPlus] = true; + noRegexTable[TokenID.MinusMinus] = true; + noRegexTable[TokenID.CloseParen] = true; + noRegexTable[TokenID.CloseBracket] = true; + noRegexTable[TokenID.CloseBrace] = true; + noRegexTable[TokenID.True] = true; + noRegexTable[TokenID.False] = true; + + export enum OperatorPrecedence { + None, + Comma, + Assignment, + Conditional, + LogicalOr, + LogicalAnd, + BitwiseOr, + BitwiseExclusiveOr, + BitwiseAnd, + Equality, + Relational, + Shift, + Additive, + Multiplicative, + Unary, + Lim + } + + export enum Reservation { + None = 0, + Javascript = 1, + JavascriptFuture = 2, + TypeScript = 4, + JavascriptFutureStrict = 8, + TypeScriptAndJS = Javascript | TypeScript, + TypeScriptAndJSFuture = JavascriptFuture | TypeScript, + TypeScriptAndJSFutureStrict = JavascriptFutureStrict | TypeScript, + } + + export class TokenInfo { + constructor (public tokenId: TokenID, public reservation: Reservation, + public binopPrecedence: number, public binopNodeType: number, + public unopPrecedence: number, public unopNodeType: number, + public text: string, public ers: ErrorRecoverySet) { } + } + + function setTokenInfo(tokenId: TokenID, reservation: number, binopPrecedence: number, + binopNodeType: number, unopPrecedence: number, unopNodeType: number, + text: string, ers: ErrorRecoverySet) { + if (tokenId !== undefined) { + tokenTable[tokenId] = new TokenInfo(tokenId, reservation, binopPrecedence, + binopNodeType, unopPrecedence, unopNodeType, text, ers); + if (binopNodeType != NodeType.None) { + nodeTypeTable[binopNodeType] = text; + nodeTypeToTokTable[binopNodeType] = tokenId; + } + if (unopNodeType != NodeType.None) { + nodeTypeTable[unopNodeType] = text; + } + } + } + + setTokenInfo(TokenID.Any, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "any", ErrorRecoverySet.PrimType); + setTokenInfo(TokenID.Bool, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "boolean", ErrorRecoverySet.PrimType); + setTokenInfo(TokenID.Break, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "break", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.Case, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "case", ErrorRecoverySet.SCase); + setTokenInfo(TokenID.Catch, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "catch", ErrorRecoverySet.Catch); + setTokenInfo(TokenID.Class, Reservation.TypeScriptAndJSFuture, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "class", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.Const, Reservation.TypeScriptAndJSFuture, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "const", ErrorRecoverySet.Var); + setTokenInfo(TokenID.Continue, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "continue", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.Debugger, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.Debugger, "debugger", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.Default, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "default", ErrorRecoverySet.SCase); + setTokenInfo(TokenID.Delete, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.Unary, NodeType.Delete, "delete", ErrorRecoverySet.Prefix); + setTokenInfo(TokenID.Do, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "do", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.Else, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "else", ErrorRecoverySet.Else); + setTokenInfo(TokenID.Enum, Reservation.TypeScriptAndJSFuture, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "enum", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.Export, Reservation.TypeScriptAndJSFuture, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "export", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.Extends, Reservation.TypeScriptAndJSFuture, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "extends", ErrorRecoverySet.None); + setTokenInfo(TokenID.Declare, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "declare", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.False, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "false", ErrorRecoverySet.RLit); + setTokenInfo(TokenID.Finally, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "finally", ErrorRecoverySet.Catch); + setTokenInfo(TokenID.For, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "for", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.Function, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "function", ErrorRecoverySet.Func); + setTokenInfo(TokenID.Constructor, Reservation.TypeScriptAndJSFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "constructor", ErrorRecoverySet.Func); + setTokenInfo(TokenID.Get, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "get", ErrorRecoverySet.Func); + setTokenInfo(TokenID.Set, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "set", ErrorRecoverySet.Func); + setTokenInfo(TokenID.If, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "if", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.Implements, Reservation.TypeScriptAndJSFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "implements", ErrorRecoverySet.None); + setTokenInfo(TokenID.Import, Reservation.TypeScriptAndJSFuture, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "import", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.In, Reservation.TypeScriptAndJS, OperatorPrecedence.Relational, NodeType.In, OperatorPrecedence.None, NodeType.None, "in", ErrorRecoverySet.None); + setTokenInfo(TokenID.InstanceOf, Reservation.TypeScriptAndJS, OperatorPrecedence.Relational, NodeType.InstOf, OperatorPrecedence.None, NodeType.None, "instanceof", ErrorRecoverySet.BinOp); + setTokenInfo(TokenID.Interface, Reservation.TypeScriptAndJSFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "interface", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.Let, Reservation.JavascriptFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "let", ErrorRecoverySet.None); + setTokenInfo(TokenID.Module, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "module", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.New, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "new", ErrorRecoverySet.PreOp); + setTokenInfo(TokenID.Number, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "number", ErrorRecoverySet.PrimType); + setTokenInfo(TokenID.Null, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "null", ErrorRecoverySet.RLit); + setTokenInfo(TokenID.Package, Reservation.JavascriptFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "package", ErrorRecoverySet.None); + setTokenInfo(TokenID.Private, Reservation.TypeScriptAndJSFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "private", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.Protected, Reservation.JavascriptFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "protected", ErrorRecoverySet.None); + setTokenInfo(TokenID.Public, Reservation.TypeScriptAndJSFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "public", ErrorRecoverySet.TypeScriptS); + setTokenInfo(TokenID.Return, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "return", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.Static, Reservation.TypeScriptAndJSFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "static", ErrorRecoverySet.None); + setTokenInfo(TokenID.String, Reservation.TypeScript, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "string", ErrorRecoverySet.PrimType); + setTokenInfo(TokenID.Super, Reservation.TypeScriptAndJSFuture, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "super", ErrorRecoverySet.RLit); + setTokenInfo(TokenID.Switch, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "switch", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.This, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "this", ErrorRecoverySet.RLit); + setTokenInfo(TokenID.Throw, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "throw", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.True, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "true", ErrorRecoverySet.RLit); + setTokenInfo(TokenID.Try, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "try", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.TypeOf, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.Unary, NodeType.Typeof, "typeof", ErrorRecoverySet.Prefix); + setTokenInfo(TokenID.Var, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "var", ErrorRecoverySet.Var); + setTokenInfo(TokenID.Void, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.Unary, NodeType.Void, "void", ErrorRecoverySet.Prefix); + setTokenInfo(TokenID.With, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.With, "with", ErrorRecoverySet.Stmt); + setTokenInfo(TokenID.While, Reservation.TypeScriptAndJS, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "while", ErrorRecoverySet.While); + setTokenInfo(TokenID.Yield, Reservation.JavascriptFutureStrict, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "yield", ErrorRecoverySet.None); + + setTokenInfo(TokenID.Identifier, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "identifier", ErrorRecoverySet.ID); + setTokenInfo(TokenID.NumberLiteral, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "numberLiteral", ErrorRecoverySet.Literal); + setTokenInfo(TokenID.RegularExpressionLiteral, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "regex", ErrorRecoverySet.RegExp); + setTokenInfo(TokenID.StringLiteral, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "qstring", ErrorRecoverySet.Literal); + + // Non-operator non-identifier tokens + setTokenInfo(TokenID.Semicolon, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, ";", ErrorRecoverySet.SColon); // ; + setTokenInfo(TokenID.CloseParen, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, ")", ErrorRecoverySet.RParen); // ) + setTokenInfo(TokenID.CloseBracket, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "]", ErrorRecoverySet.RBrack); // ] + setTokenInfo(TokenID.OpenBrace, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "{", ErrorRecoverySet.LCurly); // { + setTokenInfo(TokenID.CloseBrace, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "}", ErrorRecoverySet.RCurly); // } + setTokenInfo(TokenID.DotDotDot, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "...", ErrorRecoverySet.None); // ... + + // Operator non-identifier tokens + setTokenInfo(TokenID.Comma, Reservation.None, OperatorPrecedence.Comma, NodeType.Comma, OperatorPrecedence.None, NodeType.None, ",", ErrorRecoverySet.Comma); // , + setTokenInfo(TokenID.Equals, Reservation.None, OperatorPrecedence.Assignment, NodeType.Asg, OperatorPrecedence.None, NodeType.None, "=", ErrorRecoverySet.Asg); // = + setTokenInfo(TokenID.PlusEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgAdd, OperatorPrecedence.None, NodeType.None, "+=", ErrorRecoverySet.BinOp); // += + setTokenInfo(TokenID.MinusEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgSub, OperatorPrecedence.None, NodeType.None, "-=", ErrorRecoverySet.BinOp); // -= + setTokenInfo(TokenID.AsteriskEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgMul, OperatorPrecedence.None, NodeType.None, "*=", ErrorRecoverySet.BinOp); // *= + + setTokenInfo(TokenID.SlashEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgDiv, OperatorPrecedence.None, NodeType.None, "/=", ErrorRecoverySet.BinOp); // /= + setTokenInfo(TokenID.PercentEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgMod, OperatorPrecedence.None, NodeType.None, "%=", ErrorRecoverySet.BinOp); // %= + setTokenInfo(TokenID.AmpersandEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgAnd, OperatorPrecedence.None, NodeType.None, "&=", ErrorRecoverySet.BinOp); // &= + setTokenInfo(TokenID.CaretEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgXor, OperatorPrecedence.None, NodeType.None, "^=", ErrorRecoverySet.BinOp); // ^= + setTokenInfo(TokenID.BarEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgOr, OperatorPrecedence.None, NodeType.None, "|=", ErrorRecoverySet.BinOp); // |= + setTokenInfo(TokenID.LessThanLessThanEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgLsh, OperatorPrecedence.None, NodeType.None, "<<=", ErrorRecoverySet.BinOp); // <<= + setTokenInfo(TokenID.GreaterThanGreaterThanEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgRsh, OperatorPrecedence.None, NodeType.None, ">>=", ErrorRecoverySet.BinOp); // >>= + setTokenInfo(TokenID.GreaterThanGreaterThanGreaterThanEquals, Reservation.None, OperatorPrecedence.Assignment, NodeType.AsgRs2, OperatorPrecedence.None, NodeType.None, ">>>=", ErrorRecoverySet.BinOp); // >>>= + setTokenInfo(TokenID.Question, Reservation.None, OperatorPrecedence.Conditional, NodeType.ConditionalExpression, OperatorPrecedence.None, NodeType.None, "?", ErrorRecoverySet.BinOp); // ? + setTokenInfo(TokenID.Colon, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, ":", ErrorRecoverySet.Colon); // : + setTokenInfo(TokenID.BarBar, Reservation.None, OperatorPrecedence.LogicalOr, NodeType.LogOr, OperatorPrecedence.None, NodeType.None, "||", ErrorRecoverySet.BinOp); // || + setTokenInfo(TokenID.AmpersandAmpersand, Reservation.None, OperatorPrecedence.LogicalAnd, NodeType.LogAnd, OperatorPrecedence.None, NodeType.None, "&&", ErrorRecoverySet.BinOp); // && + setTokenInfo(TokenID.Bar, Reservation.None, OperatorPrecedence.BitwiseOr, NodeType.Or, OperatorPrecedence.None, NodeType.None, "|", ErrorRecoverySet.BinOp); // | + setTokenInfo(TokenID.Caret, Reservation.None, OperatorPrecedence.BitwiseExclusiveOr, NodeType.Xor, OperatorPrecedence.None, NodeType.None, "^", ErrorRecoverySet.BinOp); // ^ + setTokenInfo(TokenID.And, Reservation.None, OperatorPrecedence.BitwiseAnd, NodeType.And, OperatorPrecedence.None, NodeType.None, "&", ErrorRecoverySet.BinOp); // & + setTokenInfo(TokenID.EqualsEquals, Reservation.None, OperatorPrecedence.Equality, NodeType.Eq, OperatorPrecedence.None, NodeType.None, "==", ErrorRecoverySet.BinOp); // == + setTokenInfo(TokenID.ExclamationEquals, Reservation.None, OperatorPrecedence.Equality, NodeType.Ne, OperatorPrecedence.None, NodeType.None, "!=", ErrorRecoverySet.BinOp); // != + setTokenInfo(TokenID.EqualsEqualsEquals, Reservation.None, OperatorPrecedence.Equality, NodeType.Eqv, OperatorPrecedence.None, NodeType.None, "===", ErrorRecoverySet.BinOp); // === + setTokenInfo(TokenID.ExclamationEqualsEquals, Reservation.None, OperatorPrecedence.Equality, NodeType.NEqv, OperatorPrecedence.None, NodeType.None, "!==", ErrorRecoverySet.BinOp); // !== + setTokenInfo(TokenID.LessThan, Reservation.None, OperatorPrecedence.Relational, NodeType.Lt, OperatorPrecedence.None, NodeType.None, "<", ErrorRecoverySet.BinOp); // < + setTokenInfo(TokenID.LessThanEquals, Reservation.None, OperatorPrecedence.Relational, NodeType.Le, OperatorPrecedence.None, NodeType.None, "<=", ErrorRecoverySet.BinOp); // <= + setTokenInfo(TokenID.GreaterThan, Reservation.None, OperatorPrecedence.Relational, NodeType.Gt, OperatorPrecedence.None, NodeType.None, ">", ErrorRecoverySet.BinOp); // > + setTokenInfo(TokenID.GreaterThanEquals, Reservation.None, OperatorPrecedence.Relational, NodeType.Ge, OperatorPrecedence.None, NodeType.None, ">=", ErrorRecoverySet.BinOp); // >= + setTokenInfo(TokenID.LessThanLessThan, Reservation.None, OperatorPrecedence.Shift, NodeType.Lsh, OperatorPrecedence.None, NodeType.None, "<<", ErrorRecoverySet.BinOp); // << + setTokenInfo(TokenID.GreaterThanGreaterThan, Reservation.None, OperatorPrecedence.Shift, NodeType.Rsh, OperatorPrecedence.None, NodeType.None, ">>", ErrorRecoverySet.BinOp); // >> + setTokenInfo(TokenID.GreaterThanGreaterThanGreaterThan, Reservation.None, OperatorPrecedence.Shift, NodeType.Rs2, OperatorPrecedence.None, NodeType.None, ">>>", ErrorRecoverySet.BinOp); // >>> + setTokenInfo(TokenID.Plus, Reservation.None, OperatorPrecedence.Additive, NodeType.Add, OperatorPrecedence.Unary, NodeType.Pos, "+", ErrorRecoverySet.AddOp); // + + setTokenInfo(TokenID.Minus, Reservation.None, OperatorPrecedence.Additive, NodeType.Sub, OperatorPrecedence.Unary, NodeType.Neg, "-", ErrorRecoverySet.AddOp); // - + setTokenInfo(TokenID.Asterisk, Reservation.None, OperatorPrecedence.Multiplicative, NodeType.Mul, OperatorPrecedence.None, NodeType.None, "*", ErrorRecoverySet.BinOp); // * + setTokenInfo(TokenID.Slash, Reservation.None, OperatorPrecedence.Multiplicative, NodeType.Div, OperatorPrecedence.None, NodeType.None, "/", ErrorRecoverySet.BinOp); // / + setTokenInfo(TokenID.Percent, Reservation.None, OperatorPrecedence.Multiplicative, NodeType.Mod, OperatorPrecedence.None, NodeType.None, "%", ErrorRecoverySet.BinOp); // % + setTokenInfo(TokenID.Tilde, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.Unary, NodeType.Not, "~", ErrorRecoverySet.PreOp); // ~ + setTokenInfo(TokenID.Exclamation, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.Unary, NodeType.LogNot, "!", ErrorRecoverySet.PreOp); // ! + setTokenInfo(TokenID.PlusPlus, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.Unary, NodeType.IncPre, "++", ErrorRecoverySet.PreOp); // ++ + setTokenInfo(TokenID.MinusMinus, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.Unary, NodeType.DecPre, "--", ErrorRecoverySet.PreOp); // -- + setTokenInfo(TokenID.OpenParen, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "(", ErrorRecoverySet.LParen); // ( + setTokenInfo(TokenID.OpenBracket, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "[", ErrorRecoverySet.LBrack); // [ + setTokenInfo(TokenID.Dot, Reservation.None, OperatorPrecedence.Unary, NodeType.None, OperatorPrecedence.None, NodeType.None, ".", ErrorRecoverySet.Dot); // . + setTokenInfo(TokenID.EndOfFile, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "", ErrorRecoverySet.EOF); // EOF + setTokenInfo(TokenID.EqualsGreaterThan, Reservation.None, OperatorPrecedence.None, NodeType.None, OperatorPrecedence.None, NodeType.None, "=>", ErrorRecoverySet.None); // => + + export function lookupToken(tokenId: TokenID): TokenInfo { + return tokenTable[tokenId]; + } + + export enum TokenClass { + Punctuation, + Keyword, + Operator, + Comment, + Whitespace, + Identifier, + Literal, + } + + export class SavedToken { + constructor (public tok: Token, public minChar: number, public limChar: number) { } + } + + export class Token { + constructor (public tokenId: TokenID) { + } + + public toString() { + return "token: " + this.tokenId + " " + this.getText() + " (" + (TokenID)._map[this.tokenId] + ")"; + } + + public print(line: number, outfile) { + outfile.WriteLine(this.toString() + ",on line" + line); + } + + public getText(): string { + return tokenTable[this.tokenId].text; + } + + public classification(): TokenClass { + if (this.tokenId <= TokenID.LimKeyword) { + return TokenClass.Keyword; + } + else { + var tokenInfo = lookupToken(this.tokenId); + if (tokenInfo != undefined) { + if ((tokenInfo.unopNodeType != NodeType.None) || + (tokenInfo.binopNodeType != NodeType.None)) { + return TokenClass.Operator; + } + } + } + + return TokenClass.Punctuation; + } + } + + export class NumberLiteralToken extends Token { + constructor (public value: number, public hasEmptyFraction?: boolean) { + super(TokenID.NumberLiteral); + } + + public getText(): string { + return this.hasEmptyFraction ? this.value.toString() + ".0" : this.value.toString(); + } + + public classification(): TokenClass { + return TokenClass.Literal; + } + } + + export class StringLiteralToken extends Token { + constructor (public value: string) { + super(TokenID.StringLiteral); + } + + public getText(): string { + return this.value; + } + + public classification(): TokenClass { + return TokenClass.Literal; + } + } + + export class IdentifierToken extends Token { + constructor (public value: string, public hasEscapeSequence : boolean) { + super(TokenID.Identifier); + } + public getText(): string { + return this.value; + } + public classification(): TokenClass { + return TokenClass.Identifier; + } + } + + export class WhitespaceToken extends Token { + constructor (tokenId: TokenID, public value: string) { + super(tokenId); + } + + public getText(): string { + return this.value; + } + + public classification(): TokenClass { + return TokenClass.Whitespace; + } + } + + export class CommentToken extends Token { + constructor (tokenID: TokenID, public value: string, public isBlock: boolean, public startPos: number, public line: number, public endsLine: boolean) { + super(tokenID); + } + + public getText(): string { + return this.value; + } + + public classification(): TokenClass { + return TokenClass.Comment; + } + } + + export class RegularExpressionLiteralToken extends Token { + constructor(public regex) { + super(TokenID.RegularExpressionLiteral); + } + + public getText(): string { + return this.regex.toString(); + } + + public classification(): TokenClass { + return TokenClass.Literal; + } + } + + // TODO: new with length TokenID.LimFixed + export var staticTokens = new Token[]; + export function initializeStaticTokens() { + for (var i = 0; i <= TokenID.LimFixed; i++) { + staticTokens[i] = new Token(i); + } + } +} + +//// [parserRealSource10.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +/// +var TypeScript; +(function (TypeScript) { + (function (TokenID) { + // Keywords + TokenID[TokenID["Any"] = 0] = "Any"; + TokenID[TokenID["Bool"] = 1] = "Bool"; + TokenID[TokenID["Break"] = 2] = "Break"; + TokenID[TokenID["Case"] = 3] = "Case"; + TokenID[TokenID["Catch"] = 4] = "Catch"; + TokenID[TokenID["Class"] = 5] = "Class"; + TokenID[TokenID["Const"] = 6] = "Const"; + TokenID[TokenID["Continue"] = 7] = "Continue"; + TokenID[TokenID["Debugger"] = 8] = "Debugger"; + TokenID[TokenID["Default"] = 9] = "Default"; + TokenID[TokenID["Delete"] = 10] = "Delete"; + TokenID[TokenID["Do"] = 11] = "Do"; + TokenID[TokenID["Else"] = 12] = "Else"; + TokenID[TokenID["Enum"] = 13] = "Enum"; + TokenID[TokenID["Export"] = 14] = "Export"; + TokenID[TokenID["Extends"] = 15] = "Extends"; + TokenID[TokenID["Declare"] = 16] = "Declare"; + TokenID[TokenID["False"] = 17] = "False"; + TokenID[TokenID["Finally"] = 18] = "Finally"; + TokenID[TokenID["For"] = 19] = "For"; + TokenID[TokenID["Function"] = 20] = "Function"; + TokenID[TokenID["Constructor"] = 21] = "Constructor"; + TokenID[TokenID["Get"] = 22] = "Get"; + TokenID[TokenID["If"] = 23] = "If"; + TokenID[TokenID["Implements"] = 24] = "Implements"; + TokenID[TokenID["Import"] = 25] = "Import"; + TokenID[TokenID["In"] = 26] = "In"; + TokenID[TokenID["InstanceOf"] = 27] = "InstanceOf"; + TokenID[TokenID["Interface"] = 28] = "Interface"; + TokenID[TokenID["Let"] = 29] = "Let"; + TokenID[TokenID["Module"] = 30] = "Module"; + TokenID[TokenID["New"] = 31] = "New"; + TokenID[TokenID["Number"] = 32] = "Number"; + TokenID[TokenID["Null"] = 33] = "Null"; + TokenID[TokenID["Package"] = 34] = "Package"; + TokenID[TokenID["Private"] = 35] = "Private"; + TokenID[TokenID["Protected"] = 36] = "Protected"; + TokenID[TokenID["Public"] = 37] = "Public"; + TokenID[TokenID["Return"] = 38] = "Return"; + TokenID[TokenID["Set"] = 39] = "Set"; + TokenID[TokenID["Static"] = 40] = "Static"; + TokenID[TokenID["String"] = 41] = "String"; + TokenID[TokenID["Super"] = 42] = "Super"; + TokenID[TokenID["Switch"] = 43] = "Switch"; + TokenID[TokenID["This"] = 44] = "This"; + TokenID[TokenID["Throw"] = 45] = "Throw"; + TokenID[TokenID["True"] = 46] = "True"; + TokenID[TokenID["Try"] = 47] = "Try"; + TokenID[TokenID["TypeOf"] = 48] = "TypeOf"; + TokenID[TokenID["Var"] = 49] = "Var"; + TokenID[TokenID["Void"] = 50] = "Void"; + TokenID[TokenID["With"] = 51] = "With"; + TokenID[TokenID["While"] = 52] = "While"; + TokenID[TokenID["Yield"] = 53] = "Yield"; + // Punctuation + TokenID[TokenID["Semicolon"] = 54] = "Semicolon"; + TokenID[TokenID["OpenParen"] = 55] = "OpenParen"; + TokenID[TokenID["CloseParen"] = 56] = "CloseParen"; + TokenID[TokenID["OpenBracket"] = 57] = "OpenBracket"; + TokenID[TokenID["CloseBracket"] = 58] = "CloseBracket"; + TokenID[TokenID["OpenBrace"] = 59] = "OpenBrace"; + TokenID[TokenID["CloseBrace"] = 60] = "CloseBrace"; + TokenID[TokenID["Comma"] = 61] = "Comma"; + TokenID[TokenID["Equals"] = 62] = "Equals"; + TokenID[TokenID["PlusEquals"] = 63] = "PlusEquals"; + TokenID[TokenID["MinusEquals"] = 64] = "MinusEquals"; + TokenID[TokenID["AsteriskEquals"] = 65] = "AsteriskEquals"; + TokenID[TokenID["SlashEquals"] = 66] = "SlashEquals"; + TokenID[TokenID["PercentEquals"] = 67] = "PercentEquals"; + TokenID[TokenID["AmpersandEquals"] = 68] = "AmpersandEquals"; + TokenID[TokenID["CaretEquals"] = 69] = "CaretEquals"; + TokenID[TokenID["BarEquals"] = 70] = "BarEquals"; + TokenID[TokenID["LessThanLessThanEquals"] = 71] = "LessThanLessThanEquals"; + TokenID[TokenID["GreaterThanGreaterThanEquals"] = 72] = "GreaterThanGreaterThanEquals"; + TokenID[TokenID["GreaterThanGreaterThanGreaterThanEquals"] = 73] = "GreaterThanGreaterThanGreaterThanEquals"; + TokenID[TokenID["Question"] = 74] = "Question"; + TokenID[TokenID["Colon"] = 75] = "Colon"; + TokenID[TokenID["BarBar"] = 76] = "BarBar"; + TokenID[TokenID["AmpersandAmpersand"] = 77] = "AmpersandAmpersand"; + TokenID[TokenID["Bar"] = 78] = "Bar"; + TokenID[TokenID["Caret"] = 79] = "Caret"; + TokenID[TokenID["And"] = 80] = "And"; + TokenID[TokenID["EqualsEquals"] = 81] = "EqualsEquals"; + TokenID[TokenID["ExclamationEquals"] = 82] = "ExclamationEquals"; + TokenID[TokenID["EqualsEqualsEquals"] = 83] = "EqualsEqualsEquals"; + TokenID[TokenID["ExclamationEqualsEquals"] = 84] = "ExclamationEqualsEquals"; + TokenID[TokenID["LessThan"] = 85] = "LessThan"; + TokenID[TokenID["LessThanEquals"] = 86] = "LessThanEquals"; + TokenID[TokenID["GreaterThan"] = 87] = "GreaterThan"; + TokenID[TokenID["GreaterThanEquals"] = 88] = "GreaterThanEquals"; + TokenID[TokenID["LessThanLessThan"] = 89] = "LessThanLessThan"; + TokenID[TokenID["GreaterThanGreaterThan"] = 90] = "GreaterThanGreaterThan"; + TokenID[TokenID["GreaterThanGreaterThanGreaterThan"] = 91] = "GreaterThanGreaterThanGreaterThan"; + TokenID[TokenID["Plus"] = 92] = "Plus"; + TokenID[TokenID["Minus"] = 93] = "Minus"; + TokenID[TokenID["Asterisk"] = 94] = "Asterisk"; + TokenID[TokenID["Slash"] = 95] = "Slash"; + TokenID[TokenID["Percent"] = 96] = "Percent"; + TokenID[TokenID["Tilde"] = 97] = "Tilde"; + TokenID[TokenID["Exclamation"] = 98] = "Exclamation"; + TokenID[TokenID["PlusPlus"] = 99] = "PlusPlus"; + TokenID[TokenID["MinusMinus"] = 100] = "MinusMinus"; + TokenID[TokenID["Dot"] = 101] = "Dot"; + TokenID[TokenID["DotDotDot"] = 102] = "DotDotDot"; + TokenID[TokenID["Error"] = 103] = "Error"; + TokenID[TokenID["EndOfFile"] = 104] = "EndOfFile"; + TokenID[TokenID["EqualsGreaterThan"] = 105] = "EqualsGreaterThan"; + TokenID[TokenID["Identifier"] = 106] = "Identifier"; + TokenID[TokenID["StringLiteral"] = 107] = "StringLiteral"; + TokenID[TokenID["RegularExpressionLiteral"] = 108] = "RegularExpressionLiteral"; + TokenID[TokenID["NumberLiteral"] = 109] = "NumberLiteral"; + TokenID[TokenID["Whitespace"] = 110] = "Whitespace"; + TokenID[TokenID["Comment"] = 111] = "Comment"; + TokenID[TokenID["Lim"] = 112] = "Lim"; + TokenID[TokenID["LimFixed"] = TokenID.EqualsGreaterThan] = "LimFixed"; + TokenID[TokenID["LimKeyword"] = TokenID.Yield] = "LimKeyword"; + })(TypeScript.TokenID || (TypeScript.TokenID = {})); + var TokenID = TypeScript.TokenID; + TypeScript.tokenTable = new TokenInfo[]; + TypeScript.nodeTypeTable = new string[]; + TypeScript.nodeTypeToTokTable = new number[]; + TypeScript.noRegexTable = new boolean[]; + TypeScript.noRegexTable[106 /* Identifier */] = true; + TypeScript.noRegexTable[107 /* StringLiteral */] = true; + TypeScript.noRegexTable[109 /* NumberLiteral */] = true; + TypeScript.noRegexTable[108 /* RegularExpressionLiteral */] = true; + TypeScript.noRegexTable[44 /* This */] = true; + TypeScript.noRegexTable[99 /* PlusPlus */] = true; + TypeScript.noRegexTable[100 /* MinusMinus */] = true; + TypeScript.noRegexTable[56 /* CloseParen */] = true; + TypeScript.noRegexTable[58 /* CloseBracket */] = true; + TypeScript.noRegexTable[60 /* CloseBrace */] = true; + TypeScript.noRegexTable[46 /* True */] = true; + TypeScript.noRegexTable[17 /* False */] = true; + (function (OperatorPrecedence) { + OperatorPrecedence[OperatorPrecedence["None"] = 0] = "None"; + OperatorPrecedence[OperatorPrecedence["Comma"] = 1] = "Comma"; + OperatorPrecedence[OperatorPrecedence["Assignment"] = 2] = "Assignment"; + OperatorPrecedence[OperatorPrecedence["Conditional"] = 3] = "Conditional"; + OperatorPrecedence[OperatorPrecedence["LogicalOr"] = 4] = "LogicalOr"; + OperatorPrecedence[OperatorPrecedence["LogicalAnd"] = 5] = "LogicalAnd"; + OperatorPrecedence[OperatorPrecedence["BitwiseOr"] = 6] = "BitwiseOr"; + OperatorPrecedence[OperatorPrecedence["BitwiseExclusiveOr"] = 7] = "BitwiseExclusiveOr"; + OperatorPrecedence[OperatorPrecedence["BitwiseAnd"] = 8] = "BitwiseAnd"; + OperatorPrecedence[OperatorPrecedence["Equality"] = 9] = "Equality"; + OperatorPrecedence[OperatorPrecedence["Relational"] = 10] = "Relational"; + OperatorPrecedence[OperatorPrecedence["Shift"] = 11] = "Shift"; + OperatorPrecedence[OperatorPrecedence["Additive"] = 12] = "Additive"; + OperatorPrecedence[OperatorPrecedence["Multiplicative"] = 13] = "Multiplicative"; + OperatorPrecedence[OperatorPrecedence["Unary"] = 14] = "Unary"; + OperatorPrecedence[OperatorPrecedence["Lim"] = 15] = "Lim"; + })(TypeScript.OperatorPrecedence || (TypeScript.OperatorPrecedence = {})); + var OperatorPrecedence = TypeScript.OperatorPrecedence; + (function (Reservation) { + Reservation[Reservation["None"] = 0] = "None"; + Reservation[Reservation["Javascript"] = 1] = "Javascript"; + Reservation[Reservation["JavascriptFuture"] = 2] = "JavascriptFuture"; + Reservation[Reservation["TypeScript"] = 4] = "TypeScript"; + Reservation[Reservation["JavascriptFutureStrict"] = 8] = "JavascriptFutureStrict"; + Reservation[Reservation["TypeScriptAndJS"] = Reservation.Javascript | Reservation.TypeScript] = "TypeScriptAndJS"; + Reservation[Reservation["TypeScriptAndJSFuture"] = Reservation.JavascriptFuture | Reservation.TypeScript] = "TypeScriptAndJSFuture"; + Reservation[Reservation["TypeScriptAndJSFutureStrict"] = Reservation.JavascriptFutureStrict | Reservation.TypeScript] = "TypeScriptAndJSFutureStrict"; + })(TypeScript.Reservation || (TypeScript.Reservation = {})); + var Reservation = TypeScript.Reservation; + var TokenInfo = (function () { + function TokenInfo(tokenId, reservation, binopPrecedence, binopNodeType, unopPrecedence, unopNodeType, text, ers) { + this.tokenId = tokenId; + this.reservation = reservation; + this.binopPrecedence = binopPrecedence; + this.binopNodeType = binopNodeType; + this.unopPrecedence = unopPrecedence; + this.unopNodeType = unopNodeType; + this.text = text; + this.ers = ers; + } + return TokenInfo; + })(); + TypeScript.TokenInfo = TokenInfo; + function setTokenInfo(tokenId, reservation, binopPrecedence, binopNodeType, unopPrecedence, unopNodeType, text, ers) { + if (tokenId !== undefined) { + TypeScript.tokenTable[tokenId] = new TokenInfo(tokenId, reservation, binopPrecedence, binopNodeType, unopPrecedence, unopNodeType, text, ers); + if (binopNodeType != NodeType.None) { + TypeScript.nodeTypeTable[binopNodeType] = text; + TypeScript.nodeTypeToTokTable[binopNodeType] = tokenId; + } + if (unopNodeType != NodeType.None) { + TypeScript.nodeTypeTable[unopNodeType] = text; + } + } + } + setTokenInfo(0 /* Any */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "any", ErrorRecoverySet.PrimType); + setTokenInfo(1 /* Bool */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "boolean", ErrorRecoverySet.PrimType); + setTokenInfo(2 /* Break */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "break", ErrorRecoverySet.Stmt); + setTokenInfo(3 /* Case */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "case", ErrorRecoverySet.SCase); + setTokenInfo(4 /* Catch */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "catch", ErrorRecoverySet.Catch); + setTokenInfo(5 /* Class */, Reservation.TypeScriptAndJSFuture, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "class", ErrorRecoverySet.TypeScriptS); + setTokenInfo(6 /* Const */, Reservation.TypeScriptAndJSFuture, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "const", ErrorRecoverySet.Var); + setTokenInfo(7 /* Continue */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "continue", ErrorRecoverySet.Stmt); + setTokenInfo(8 /* Debugger */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.Debugger, "debugger", ErrorRecoverySet.Stmt); + setTokenInfo(9 /* Default */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "default", ErrorRecoverySet.SCase); + setTokenInfo(10 /* Delete */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 14 /* Unary */, NodeType.Delete, "delete", ErrorRecoverySet.Prefix); + setTokenInfo(11 /* Do */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "do", ErrorRecoverySet.Stmt); + setTokenInfo(12 /* Else */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "else", ErrorRecoverySet.Else); + setTokenInfo(13 /* Enum */, Reservation.TypeScriptAndJSFuture, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "enum", ErrorRecoverySet.TypeScriptS); + setTokenInfo(14 /* Export */, Reservation.TypeScriptAndJSFuture, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "export", ErrorRecoverySet.TypeScriptS); + setTokenInfo(15 /* Extends */, Reservation.TypeScriptAndJSFuture, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "extends", ErrorRecoverySet.None); + setTokenInfo(16 /* Declare */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "declare", ErrorRecoverySet.Stmt); + setTokenInfo(17 /* False */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "false", ErrorRecoverySet.RLit); + setTokenInfo(18 /* Finally */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "finally", ErrorRecoverySet.Catch); + setTokenInfo(19 /* For */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "for", ErrorRecoverySet.Stmt); + setTokenInfo(20 /* Function */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "function", ErrorRecoverySet.Func); + setTokenInfo(21 /* Constructor */, Reservation.TypeScriptAndJSFutureStrict, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "constructor", ErrorRecoverySet.Func); + setTokenInfo(22 /* Get */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "get", ErrorRecoverySet.Func); + setTokenInfo(39 /* Set */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "set", ErrorRecoverySet.Func); + setTokenInfo(23 /* If */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "if", ErrorRecoverySet.Stmt); + setTokenInfo(24 /* Implements */, Reservation.TypeScriptAndJSFutureStrict, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "implements", ErrorRecoverySet.None); + setTokenInfo(25 /* Import */, Reservation.TypeScriptAndJSFuture, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "import", ErrorRecoverySet.TypeScriptS); + setTokenInfo(26 /* In */, Reservation.TypeScriptAndJS, 10 /* Relational */, NodeType.In, 0 /* None */, NodeType.None, "in", ErrorRecoverySet.None); + setTokenInfo(27 /* InstanceOf */, Reservation.TypeScriptAndJS, 10 /* Relational */, NodeType.InstOf, 0 /* None */, NodeType.None, "instanceof", ErrorRecoverySet.BinOp); + setTokenInfo(28 /* Interface */, Reservation.TypeScriptAndJSFutureStrict, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "interface", ErrorRecoverySet.TypeScriptS); + setTokenInfo(29 /* Let */, 8 /* JavascriptFutureStrict */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "let", ErrorRecoverySet.None); + setTokenInfo(30 /* Module */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "module", ErrorRecoverySet.TypeScriptS); + setTokenInfo(31 /* New */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "new", ErrorRecoverySet.PreOp); + setTokenInfo(32 /* Number */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "number", ErrorRecoverySet.PrimType); + setTokenInfo(33 /* Null */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "null", ErrorRecoverySet.RLit); + setTokenInfo(34 /* Package */, 8 /* JavascriptFutureStrict */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "package", ErrorRecoverySet.None); + setTokenInfo(35 /* Private */, Reservation.TypeScriptAndJSFutureStrict, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "private", ErrorRecoverySet.TypeScriptS); + setTokenInfo(36 /* Protected */, 8 /* JavascriptFutureStrict */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "protected", ErrorRecoverySet.None); + setTokenInfo(37 /* Public */, Reservation.TypeScriptAndJSFutureStrict, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "public", ErrorRecoverySet.TypeScriptS); + setTokenInfo(38 /* Return */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "return", ErrorRecoverySet.Stmt); + setTokenInfo(40 /* Static */, Reservation.TypeScriptAndJSFutureStrict, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "static", ErrorRecoverySet.None); + setTokenInfo(41 /* String */, 4 /* TypeScript */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "string", ErrorRecoverySet.PrimType); + setTokenInfo(42 /* Super */, Reservation.TypeScriptAndJSFuture, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "super", ErrorRecoverySet.RLit); + setTokenInfo(43 /* Switch */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "switch", ErrorRecoverySet.Stmt); + setTokenInfo(44 /* This */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "this", ErrorRecoverySet.RLit); + setTokenInfo(45 /* Throw */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "throw", ErrorRecoverySet.Stmt); + setTokenInfo(46 /* True */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "true", ErrorRecoverySet.RLit); + setTokenInfo(47 /* Try */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "try", ErrorRecoverySet.Stmt); + setTokenInfo(48 /* TypeOf */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 14 /* Unary */, NodeType.Typeof, "typeof", ErrorRecoverySet.Prefix); + setTokenInfo(49 /* Var */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "var", ErrorRecoverySet.Var); + setTokenInfo(50 /* Void */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 14 /* Unary */, NodeType.Void, "void", ErrorRecoverySet.Prefix); + setTokenInfo(51 /* With */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.With, "with", ErrorRecoverySet.Stmt); + setTokenInfo(52 /* While */, Reservation.TypeScriptAndJS, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "while", ErrorRecoverySet.While); + setTokenInfo(53 /* Yield */, 8 /* JavascriptFutureStrict */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "yield", ErrorRecoverySet.None); + setTokenInfo(106 /* Identifier */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "identifier", ErrorRecoverySet.ID); + setTokenInfo(109 /* NumberLiteral */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "numberLiteral", ErrorRecoverySet.Literal); + setTokenInfo(108 /* RegularExpressionLiteral */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "regex", ErrorRecoverySet.RegExp); + setTokenInfo(107 /* StringLiteral */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "qstring", ErrorRecoverySet.Literal); + // Non-operator non-identifier tokens + setTokenInfo(54 /* Semicolon */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, ";", ErrorRecoverySet.SColon); // ; + setTokenInfo(56 /* CloseParen */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, ")", ErrorRecoverySet.RParen); // ) + setTokenInfo(58 /* CloseBracket */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "]", ErrorRecoverySet.RBrack); // ] + setTokenInfo(59 /* OpenBrace */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "{", ErrorRecoverySet.LCurly); // { + setTokenInfo(60 /* CloseBrace */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "}", ErrorRecoverySet.RCurly); // } + setTokenInfo(102 /* DotDotDot */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "...", ErrorRecoverySet.None); // ... + // Operator non-identifier tokens + setTokenInfo(61 /* Comma */, 0 /* None */, 1 /* Comma */, NodeType.Comma, 0 /* None */, NodeType.None, ",", ErrorRecoverySet.Comma); // , + setTokenInfo(62 /* Equals */, 0 /* None */, 2 /* Assignment */, NodeType.Asg, 0 /* None */, NodeType.None, "=", ErrorRecoverySet.Asg); // = + setTokenInfo(63 /* PlusEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgAdd, 0 /* None */, NodeType.None, "+=", ErrorRecoverySet.BinOp); // += + setTokenInfo(64 /* MinusEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgSub, 0 /* None */, NodeType.None, "-=", ErrorRecoverySet.BinOp); // -= + setTokenInfo(65 /* AsteriskEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgMul, 0 /* None */, NodeType.None, "*=", ErrorRecoverySet.BinOp); // *= + setTokenInfo(66 /* SlashEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgDiv, 0 /* None */, NodeType.None, "/=", ErrorRecoverySet.BinOp); // /= + setTokenInfo(67 /* PercentEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgMod, 0 /* None */, NodeType.None, "%=", ErrorRecoverySet.BinOp); // %= + setTokenInfo(68 /* AmpersandEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgAnd, 0 /* None */, NodeType.None, "&=", ErrorRecoverySet.BinOp); // &= + setTokenInfo(69 /* CaretEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgXor, 0 /* None */, NodeType.None, "^=", ErrorRecoverySet.BinOp); // ^= + setTokenInfo(70 /* BarEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgOr, 0 /* None */, NodeType.None, "|=", ErrorRecoverySet.BinOp); // |= + setTokenInfo(71 /* LessThanLessThanEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgLsh, 0 /* None */, NodeType.None, "<<=", ErrorRecoverySet.BinOp); // <<= + setTokenInfo(72 /* GreaterThanGreaterThanEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgRsh, 0 /* None */, NodeType.None, ">>=", ErrorRecoverySet.BinOp); // >>= + setTokenInfo(73 /* GreaterThanGreaterThanGreaterThanEquals */, 0 /* None */, 2 /* Assignment */, NodeType.AsgRs2, 0 /* None */, NodeType.None, ">>>=", ErrorRecoverySet.BinOp); // >>>= + setTokenInfo(74 /* Question */, 0 /* None */, 3 /* Conditional */, NodeType.ConditionalExpression, 0 /* None */, NodeType.None, "?", ErrorRecoverySet.BinOp); // ? + setTokenInfo(75 /* Colon */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, ":", ErrorRecoverySet.Colon); // : + setTokenInfo(76 /* BarBar */, 0 /* None */, 4 /* LogicalOr */, NodeType.LogOr, 0 /* None */, NodeType.None, "||", ErrorRecoverySet.BinOp); // || + setTokenInfo(77 /* AmpersandAmpersand */, 0 /* None */, 5 /* LogicalAnd */, NodeType.LogAnd, 0 /* None */, NodeType.None, "&&", ErrorRecoverySet.BinOp); // && + setTokenInfo(78 /* Bar */, 0 /* None */, 6 /* BitwiseOr */, NodeType.Or, 0 /* None */, NodeType.None, "|", ErrorRecoverySet.BinOp); // | + setTokenInfo(79 /* Caret */, 0 /* None */, 7 /* BitwiseExclusiveOr */, NodeType.Xor, 0 /* None */, NodeType.None, "^", ErrorRecoverySet.BinOp); // ^ + setTokenInfo(80 /* And */, 0 /* None */, 8 /* BitwiseAnd */, NodeType.And, 0 /* None */, NodeType.None, "&", ErrorRecoverySet.BinOp); // & + setTokenInfo(81 /* EqualsEquals */, 0 /* None */, 9 /* Equality */, NodeType.Eq, 0 /* None */, NodeType.None, "==", ErrorRecoverySet.BinOp); // == + setTokenInfo(82 /* ExclamationEquals */, 0 /* None */, 9 /* Equality */, NodeType.Ne, 0 /* None */, NodeType.None, "!=", ErrorRecoverySet.BinOp); // != + setTokenInfo(83 /* EqualsEqualsEquals */, 0 /* None */, 9 /* Equality */, NodeType.Eqv, 0 /* None */, NodeType.None, "===", ErrorRecoverySet.BinOp); // === + setTokenInfo(84 /* ExclamationEqualsEquals */, 0 /* None */, 9 /* Equality */, NodeType.NEqv, 0 /* None */, NodeType.None, "!==", ErrorRecoverySet.BinOp); // !== + setTokenInfo(85 /* LessThan */, 0 /* None */, 10 /* Relational */, NodeType.Lt, 0 /* None */, NodeType.None, "<", ErrorRecoverySet.BinOp); // < + setTokenInfo(86 /* LessThanEquals */, 0 /* None */, 10 /* Relational */, NodeType.Le, 0 /* None */, NodeType.None, "<=", ErrorRecoverySet.BinOp); // <= + setTokenInfo(87 /* GreaterThan */, 0 /* None */, 10 /* Relational */, NodeType.Gt, 0 /* None */, NodeType.None, ">", ErrorRecoverySet.BinOp); // > + setTokenInfo(88 /* GreaterThanEquals */, 0 /* None */, 10 /* Relational */, NodeType.Ge, 0 /* None */, NodeType.None, ">=", ErrorRecoverySet.BinOp); // >= + setTokenInfo(89 /* LessThanLessThan */, 0 /* None */, 11 /* Shift */, NodeType.Lsh, 0 /* None */, NodeType.None, "<<", ErrorRecoverySet.BinOp); // << + setTokenInfo(90 /* GreaterThanGreaterThan */, 0 /* None */, 11 /* Shift */, NodeType.Rsh, 0 /* None */, NodeType.None, ">>", ErrorRecoverySet.BinOp); // >> + setTokenInfo(91 /* GreaterThanGreaterThanGreaterThan */, 0 /* None */, 11 /* Shift */, NodeType.Rs2, 0 /* None */, NodeType.None, ">>>", ErrorRecoverySet.BinOp); // >>> + setTokenInfo(92 /* Plus */, 0 /* None */, 12 /* Additive */, NodeType.Add, 14 /* Unary */, NodeType.Pos, "+", ErrorRecoverySet.AddOp); // + + setTokenInfo(93 /* Minus */, 0 /* None */, 12 /* Additive */, NodeType.Sub, 14 /* Unary */, NodeType.Neg, "-", ErrorRecoverySet.AddOp); // - + setTokenInfo(94 /* Asterisk */, 0 /* None */, 13 /* Multiplicative */, NodeType.Mul, 0 /* None */, NodeType.None, "*", ErrorRecoverySet.BinOp); // * + setTokenInfo(95 /* Slash */, 0 /* None */, 13 /* Multiplicative */, NodeType.Div, 0 /* None */, NodeType.None, "/", ErrorRecoverySet.BinOp); // / + setTokenInfo(96 /* Percent */, 0 /* None */, 13 /* Multiplicative */, NodeType.Mod, 0 /* None */, NodeType.None, "%", ErrorRecoverySet.BinOp); // % + setTokenInfo(97 /* Tilde */, 0 /* None */, 0 /* None */, NodeType.None, 14 /* Unary */, NodeType.Not, "~", ErrorRecoverySet.PreOp); // ~ + setTokenInfo(98 /* Exclamation */, 0 /* None */, 0 /* None */, NodeType.None, 14 /* Unary */, NodeType.LogNot, "!", ErrorRecoverySet.PreOp); // ! + setTokenInfo(99 /* PlusPlus */, 0 /* None */, 0 /* None */, NodeType.None, 14 /* Unary */, NodeType.IncPre, "++", ErrorRecoverySet.PreOp); // ++ + setTokenInfo(100 /* MinusMinus */, 0 /* None */, 0 /* None */, NodeType.None, 14 /* Unary */, NodeType.DecPre, "--", ErrorRecoverySet.PreOp); // -- + setTokenInfo(55 /* OpenParen */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "(", ErrorRecoverySet.LParen); // ( + setTokenInfo(57 /* OpenBracket */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "[", ErrorRecoverySet.LBrack); // [ + setTokenInfo(101 /* Dot */, 0 /* None */, 14 /* Unary */, NodeType.None, 0 /* None */, NodeType.None, ".", ErrorRecoverySet.Dot); // . + setTokenInfo(104 /* EndOfFile */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "", ErrorRecoverySet.EOF); // EOF + setTokenInfo(105 /* EqualsGreaterThan */, 0 /* None */, 0 /* None */, NodeType.None, 0 /* None */, NodeType.None, "=>", ErrorRecoverySet.None); // => + function lookupToken(tokenId) { + return TypeScript.tokenTable[tokenId]; + } + TypeScript.lookupToken = lookupToken; + (function (TokenClass) { + TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; + TokenClass[TokenClass["Keyword"] = 1] = "Keyword"; + TokenClass[TokenClass["Operator"] = 2] = "Operator"; + TokenClass[TokenClass["Comment"] = 3] = "Comment"; + TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace"; + TokenClass[TokenClass["Identifier"] = 5] = "Identifier"; + TokenClass[TokenClass["Literal"] = 6] = "Literal"; + })(TypeScript.TokenClass || (TypeScript.TokenClass = {})); + var TokenClass = TypeScript.TokenClass; + var SavedToken = (function () { + function SavedToken(tok, minChar, limChar) { + this.tok = tok; + this.minChar = minChar; + this.limChar = limChar; + } + return SavedToken; + })(); + TypeScript.SavedToken = SavedToken; + var Token = (function () { + function Token(tokenId) { + this.tokenId = tokenId; + } + Token.prototype.toString = function () { + return "token: " + this.tokenId + " " + this.getText() + " (" + TokenID._map[this.tokenId] + ")"; + }; + Token.prototype.print = function (line, outfile) { + outfile.WriteLine(this.toString() + ",on line" + line); + }; + Token.prototype.getText = function () { + return TypeScript.tokenTable[this.tokenId].text; + }; + Token.prototype.classification = function () { + if (this.tokenId <= TokenID.LimKeyword) { + return 1 /* Keyword */; + } + else { + var tokenInfo = lookupToken(this.tokenId); + if (tokenInfo != undefined) { + if ((tokenInfo.unopNodeType != NodeType.None) || (tokenInfo.binopNodeType != NodeType.None)) { + return 2 /* Operator */; + } + } + } + return 0 /* Punctuation */; + }; + return Token; + })(); + TypeScript.Token = Token; + var NumberLiteralToken = (function (_super) { + __extends(NumberLiteralToken, _super); + function NumberLiteralToken(value, hasEmptyFraction) { + _super.call(this, 109 /* NumberLiteral */); + this.value = value; + this.hasEmptyFraction = hasEmptyFraction; + } + NumberLiteralToken.prototype.getText = function () { + return this.hasEmptyFraction ? this.value.toString() + ".0" : this.value.toString(); + }; + NumberLiteralToken.prototype.classification = function () { + return 6 /* Literal */; + }; + return NumberLiteralToken; + })(Token); + TypeScript.NumberLiteralToken = NumberLiteralToken; + var StringLiteralToken = (function (_super) { + __extends(StringLiteralToken, _super); + function StringLiteralToken(value) { + _super.call(this, 107 /* StringLiteral */); + this.value = value; + } + StringLiteralToken.prototype.getText = function () { + return this.value; + }; + StringLiteralToken.prototype.classification = function () { + return 6 /* Literal */; + }; + return StringLiteralToken; + })(Token); + TypeScript.StringLiteralToken = StringLiteralToken; + var IdentifierToken = (function (_super) { + __extends(IdentifierToken, _super); + function IdentifierToken(value, hasEscapeSequence) { + _super.call(this, 106 /* Identifier */); + this.value = value; + this.hasEscapeSequence = hasEscapeSequence; + } + IdentifierToken.prototype.getText = function () { + return this.value; + }; + IdentifierToken.prototype.classification = function () { + return 5 /* Identifier */; + }; + return IdentifierToken; + })(Token); + TypeScript.IdentifierToken = IdentifierToken; + var WhitespaceToken = (function (_super) { + __extends(WhitespaceToken, _super); + function WhitespaceToken(tokenId, value) { + _super.call(this, tokenId); + this.value = value; + } + WhitespaceToken.prototype.getText = function () { + return this.value; + }; + WhitespaceToken.prototype.classification = function () { + return 4 /* Whitespace */; + }; + return WhitespaceToken; + })(Token); + TypeScript.WhitespaceToken = WhitespaceToken; + var CommentToken = (function (_super) { + __extends(CommentToken, _super); + function CommentToken(tokenID, value, isBlock, startPos, line, endsLine) { + _super.call(this, tokenID); + this.value = value; + this.isBlock = isBlock; + this.startPos = startPos; + this.line = line; + this.endsLine = endsLine; + } + CommentToken.prototype.getText = function () { + return this.value; + }; + CommentToken.prototype.classification = function () { + return 3 /* Comment */; + }; + return CommentToken; + })(Token); + TypeScript.CommentToken = CommentToken; + var RegularExpressionLiteralToken = (function (_super) { + __extends(RegularExpressionLiteralToken, _super); + function RegularExpressionLiteralToken(regex) { + _super.call(this, 108 /* RegularExpressionLiteral */); + this.regex = regex; + } + RegularExpressionLiteralToken.prototype.getText = function () { + return this.regex.toString(); + }; + RegularExpressionLiteralToken.prototype.classification = function () { + return 6 /* Literal */; + }; + return RegularExpressionLiteralToken; + })(Token); + TypeScript.RegularExpressionLiteralToken = RegularExpressionLiteralToken; + // TODO: new with length TokenID.LimFixed + TypeScript.staticTokens = new Token[]; + function initializeStaticTokens() { + for (var i = 0; i <= TokenID.LimFixed; i++) { + TypeScript.staticTokens[i] = new Token(i); + } + } + TypeScript.initializeStaticTokens = initializeStaticTokens; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js new file mode 100644 index 00000000000..0574c52eaaa --- /dev/null +++ b/tests/baselines/reference/parserRealSource11.js @@ -0,0 +1,4717 @@ +//// [parserRealSource11.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + export class ASTSpan { + public minChar: number = -1; // -1 = "undefined" or "compiler generated" + public limChar: number = -1; // -1 = "undefined" or "compiler generated" + } + + export class AST extends ASTSpan { + public type: Type = null; + public flags = ASTFlags.Writeable; + + // REVIEW: for diagnostic purposes + public passCreated: number = CompilerDiagnostics.analysisPass; + + public preComments: Comment[] = null; + public postComments: Comment[] = null; + + public isParenthesized = false; + + constructor (public nodeType: NodeType) { + super(); + } + + public isExpression() { return false; } + + public isStatementOrExpression() { return false; } + + public isCompoundStatement() { return false; } + + public isLeaf() { return this.isStatementOrExpression() && (!this.isCompoundStatement()); } + + public typeCheck(typeFlow: TypeFlow) { + switch (this.nodeType) { + case NodeType.Error: + case NodeType.EmptyExpr: + this.type = typeFlow.anyType; + break; + case NodeType.This: + return typeFlow.typeCheckThis(this); + case NodeType.Null: + this.type = typeFlow.nullType; + break; + case NodeType.False: + case NodeType.True: + this.type = typeFlow.booleanType; + break; + case NodeType.Super: + return typeFlow.typeCheckSuper(this); + case NodeType.EndCode: + case NodeType.Empty: + case NodeType.Void: + this.type = typeFlow.voidType; + break; + default: + throw new Error("please implement in derived class"); + } + return this; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + switch (this.nodeType) { + case NodeType.This: + emitter.recordSourceMappingStart(this); + if (emitter.thisFnc && (hasFlag(emitter.thisFnc.fncFlags, FncFlags.IsFatArrowFunction))) { + emitter.writeToOutput("_this"); + } + else { + emitter.writeToOutput("this"); + } + emitter.recordSourceMappingEnd(this); + break; + case NodeType.Null: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("null"); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.False: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("false"); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.True: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("true"); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.Super: + emitter.recordSourceMappingStart(this); + emitter.emitSuperReference(); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.EndCode: + break; + case NodeType.Error: + case NodeType.EmptyExpr: + break; + + case NodeType.Empty: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("; "); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.Void: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("void "); + emitter.recordSourceMappingEnd(this); + break; + default: + throw new Error("please implement in derived class"); + } + emitter.emitParensAndCommentsInPlace(this, false); + } + + public print(context: PrintContext) { + context.startLine(); + var lineCol = { line: -1, col: -1 }; + var limLineCol = { line: -1, col: -1 }; + if (context.parser !== null) { + context.parser.getSourceLineCol(lineCol, this.minChar); + context.parser.getSourceLineCol(limLineCol, this.limChar); + context.write("(" + lineCol.line + "," + lineCol.col + ")--" + + "(" + limLineCol.line + "," + limLineCol.col + "): "); + } + var lab = this.printLabel(); + if (hasFlag(this.flags, ASTFlags.Error)) { + lab += " (Error)"; + } + context.writeLine(lab); + } + + public printLabel() { + if (nodeTypeTable[this.nodeType] !== undefined) { + return nodeTypeTable[this.nodeType]; + } + else { + return (NodeType)._map[this.nodeType]; + } + } + + public addToControlFlow(context: ControlFlowContext): void { + // by default, AST adds itself to current basic block and does not check its children + context.walker.options.goChildren = false; + context.addContent(this); + } + + public netFreeUses(container: Symbol, freeUses: StringHashTable) { + } + + public treeViewLabel() { + return (NodeType)._map[this.nodeType]; + } + + public static getResolvedIdentifierName(name: string): string { + if (!name) return ""; + + var resolved = ""; + var start = 0; + var i = 0; + while(i <= name.length - 6) { + // Look for escape sequence \uxxxx + if (name.charAt(i) == '\\' && name.charAt(i+1) == 'u') { + var charCode = parseInt(name.substr(i + 2, 4), 16); + resolved += name.substr(start, i - start); + resolved += String.fromCharCode(charCode); + i += 6; + start = i; + continue; + } + i++; + } + // Append remaining string + resolved += name.substring(start); + return resolved; + } + } + + export class IncompleteAST extends AST { + constructor (min: number, lim: number) { + super(NodeType.Error); + + this.minChar = min; + this.limChar = lim; + } + } + + export class ASTList extends AST { + public enclosingScope: SymbolScope = null; + public members: AST[] = new AST[]; + + constructor () { + super(NodeType.List); + } + + public addToControlFlow(context: ControlFlowContext) { + var len = this.members.length; + for (var i = 0; i < len; i++) { + if (context.noContinuation) { + context.addUnreachable(this.members[i]); + break; + } + else { + this.members[i] = context.walk(this.members[i], this); + } + } + context.walker.options.goChildren = false; + } + + public append(ast: AST) { + this.members[this.members.length] = ast; + return this; + } + + public appendAll(ast: AST) { + if (ast.nodeType == NodeType.List) { + var list = ast; + for (var i = 0, len = list.members.length; i < len; i++) { + this.append(list.members[i]); + } + } + else { + this.append(ast); + } + return this; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.recordSourceMappingStart(this); + emitter.emitJavascriptList(this, null, TokenID.Semicolon, startLine, false, false); + emitter.recordSourceMappingEnd(this); + } + + public typeCheck(typeFlow: TypeFlow) { + var len = this.members.length; + typeFlow.nestingLevel++; + for (var i = 0; i < len; i++) { + if (this.members[i]) { + this.members[i] = this.members[i].typeCheck(typeFlow); + } + } + typeFlow.nestingLevel--; + return this; + } + } + + export class Identifier extends AST { + public sym: Symbol = null; + public cloId = -1; + public text: string; + + // 'actualText' is the text that the user has entered for the identifier. the text might + // include any Unicode escape sequences (e.g.: \u0041 for 'A'). 'text', however, contains + // the resolved value of any escape sequences in the actual text; so in the previous + // example, actualText = '\u0041', text = 'A'. + // + // For purposes of finding a symbol, use text, as this will allow you to match all + // variations of the variable text. For full-fidelity translation of the user input, such + // as emitting, use the actualText field. + // + // Note: + // To change text, and to avoid running into a situation where 'actualText' does not + // match 'text', always use setText. + constructor (public actualText: string, public hasEscapeSequence?: boolean) { + super(NodeType.Name); + this.setText(actualText, hasEscapeSequence); + } + + public setText(actualText: string, hasEscapeSequence?: boolean) { + this.actualText = actualText; + if (hasEscapeSequence) { + this.text = AST.getResolvedIdentifierName(actualText); + } + else { + this.text = actualText; + } + } + + public isMissing() { return false; } + public isLeaf() { return true; } + + public treeViewLabel() { + return "id: " + this.actualText; + } + + public printLabel() { + if (this.actualText) { + return "id: " + this.actualText; + } + else { + return "name node"; + } + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckName(this); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitJavascriptName(this, true); + } + + public static fromToken(token: Token): Identifier { + return new Identifier(token.getText(), (token).hasEscapeSequence); + } + } + + export class MissingIdentifier extends Identifier { + constructor () { + super("__missing"); + } + + public isMissing() { + return true; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + // Emit nothing for a missing ID + } + } + + export class Label extends AST { + constructor (public id: Identifier) { + super(NodeType.Label); + } + + public printLabel() { return this.id.actualText + ":"; } + + public typeCheck(typeFlow: TypeFlow) { + this.type = typeFlow.voidType; + return this; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.recordSourceMappingStart(this.id); + emitter.writeToOutput(this.id.actualText); + emitter.recordSourceMappingEnd(this.id); + emitter.writeLineToOutput(":"); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + export class Expression extends AST { + constructor (nodeType: NodeType) { + super(nodeType); + } + + public isExpression() { return true; } + + public isStatementOrExpression() { return true; } + } + + export class UnaryExpression extends Expression { + public targetType: Type = null; // Target type for an object literal (null if no target type) + public castTerm: AST = null; + + constructor (nodeType: NodeType, public operand: AST) { + super(nodeType); + } + + public addToControlFlow(context: ControlFlowContext): void { + super.addToControlFlow(context); + // TODO: add successor as catch block/finally block if present + if (this.nodeType == NodeType.Throw) { + context.returnStmt(); + } + } + + public typeCheck(typeFlow: TypeFlow) { + switch (this.nodeType) { + case NodeType.Not: + return typeFlow.typeCheckBitNot(this); + + case NodeType.LogNot: + return typeFlow.typeCheckLogNot(this); + + case NodeType.Pos: + case NodeType.Neg: + return typeFlow.typeCheckUnaryNumberOperator(this); + + case NodeType.IncPost: + case NodeType.IncPre: + case NodeType.DecPost: + case NodeType.DecPre: + return typeFlow.typeCheckIncOrDec(this); + + case NodeType.ArrayLit: + typeFlow.typeCheckArrayLit(this); + return this; + + case NodeType.ObjectLit: + typeFlow.typeCheckObjectLit(this); + return this; + + case NodeType.Throw: + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.voidType; + return this; + + case NodeType.Typeof: + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.stringType; + return this; + + case NodeType.Delete: + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.booleanType; + break; + + case NodeType.TypeAssertion: + this.castTerm = typeFlow.typeCheck(this.castTerm); + var applyTargetType = !this.operand.isParenthesized; + + var targetType = applyTargetType ? this.castTerm.type : null; + + typeFlow.checker.typeCheckWithContextualType(targetType, typeFlow.checker.inProvisionalTypecheckMode(), true, this.operand); + typeFlow.castWithCoercion(this.operand, this.castTerm.type, false, true); + this.type = this.castTerm.type; + return this; + + case NodeType.Void: + // REVIEW - Although this is good to do for completeness's sake, + // this shouldn't be strictly necessary from the void operator's + // point of view + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.checker.undefinedType; + break; + + default: + throw new Error("please implement in derived class"); + } + return this; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + switch (this.nodeType) { + case NodeType.IncPost: + emitter.emitJavascript(this.operand, TokenID.PlusPlus, false); + emitter.writeToOutput("++"); + break; + case NodeType.LogNot: + emitter.writeToOutput("!"); + emitter.emitJavascript(this.operand, TokenID.Exclamation, false); + break; + case NodeType.DecPost: + emitter.emitJavascript(this.operand, TokenID.MinusMinus, false); + emitter.writeToOutput("--"); + break; + case NodeType.ObjectLit: + emitter.emitObjectLiteral(this.operand); + break; + case NodeType.ArrayLit: + emitter.emitArrayLiteral(this.operand); + break; + case NodeType.Not: + emitter.writeToOutput("~"); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.Neg: + emitter.writeToOutput("-"); + if (this.operand.nodeType == NodeType.Neg) { + this.operand.isParenthesized = true; + } + emitter.emitJavascript(this.operand, TokenID.Minus, false); + break; + case NodeType.Pos: + emitter.writeToOutput("+"); + if (this.operand.nodeType == NodeType.Pos) { + this.operand.isParenthesized = true; + } + emitter.emitJavascript(this.operand, TokenID.Plus, false); + break; + case NodeType.IncPre: + emitter.writeToOutput("++"); + emitter.emitJavascript(this.operand, TokenID.PlusPlus, false); + break; + case NodeType.DecPre: + emitter.writeToOutput("--"); + emitter.emitJavascript(this.operand, TokenID.MinusMinus, false); + break; + case NodeType.Throw: + emitter.writeToOutput("throw "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + emitter.writeToOutput(";"); + break; + case NodeType.Typeof: + emitter.writeToOutput("typeof "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.Delete: + emitter.writeToOutput("delete "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.Void: + emitter.writeToOutput("void "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.TypeAssertion: + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + default: + throw new Error("please implement in derived class"); + } + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + export class CallExpression extends Expression { + constructor (nodeType: NodeType, + public target: AST, + public arguments: ASTList) { + super(nodeType); + this.minChar = this.target.minChar; + } + + public signature: Signature = null; + + public typeCheck(typeFlow: TypeFlow) { + if (this.nodeType == NodeType.New) { + return typeFlow.typeCheckNew(this); + } + else { + return typeFlow.typeCheckCall(this); + } + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + + if (this.nodeType == NodeType.New) { + emitter.emitNew(this.target, this.arguments); + } + else { + emitter.emitCall(this, this.target, this.arguments); + } + + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + export class BinaryExpression extends Expression { + constructor (nodeType: NodeType, public operand1: AST, public operand2: AST) { + super(nodeType); + } + + public typeCheck(typeFlow: TypeFlow) { + switch (this.nodeType) { + case NodeType.Dot: + return typeFlow.typeCheckDotOperator(this); + case NodeType.Asg: + return typeFlow.typeCheckAsgOperator(this); + case NodeType.Add: + case NodeType.Sub: + case NodeType.Mul: + case NodeType.Div: + case NodeType.Mod: + case NodeType.Or: + case NodeType.And: + return typeFlow.typeCheckArithmeticOperator(this, false); + case NodeType.Xor: + return typeFlow.typeCheckBitwiseOperator(this, false); + case NodeType.Ne: + case NodeType.Eq: + var text: string; + if (typeFlow.checker.styleSettings.eqeqeq) { + text = nodeTypeTable[this.nodeType]; + typeFlow.checker.errorReporter.styleError(this, "use of " + text); + } + else if (typeFlow.checker.styleSettings.eqnull) { + text = nodeTypeTable[this.nodeType]; + if ((this.operand2 !== null) && (this.operand2.nodeType == NodeType.Null)) { + typeFlow.checker.errorReporter.styleError(this, "use of " + text + " to compare with null"); + } + } + case NodeType.Eqv: + case NodeType.NEqv: + case NodeType.Lt: + case NodeType.Le: + case NodeType.Ge: + case NodeType.Gt: + return typeFlow.typeCheckBooleanOperator(this); + case NodeType.Index: + return typeFlow.typeCheckIndex(this); + case NodeType.Member: + this.type = typeFlow.voidType; + return this; + case NodeType.LogOr: + return typeFlow.typeCheckLogOr(this); + case NodeType.LogAnd: + return typeFlow.typeCheckLogAnd(this); + case NodeType.AsgAdd: + case NodeType.AsgSub: + case NodeType.AsgMul: + case NodeType.AsgDiv: + case NodeType.AsgMod: + case NodeType.AsgOr: + case NodeType.AsgAnd: + return typeFlow.typeCheckArithmeticOperator(this, true); + case NodeType.AsgXor: + return typeFlow.typeCheckBitwiseOperator(this, true); + case NodeType.Lsh: + case NodeType.Rsh: + case NodeType.Rs2: + return typeFlow.typeCheckShift(this, false); + case NodeType.AsgLsh: + case NodeType.AsgRsh: + case NodeType.AsgRs2: + return typeFlow.typeCheckShift(this, true); + case NodeType.Comma: + return typeFlow.typeCheckCommaOperator(this); + case NodeType.InstOf: + return typeFlow.typeCheckInstOf(this); + case NodeType.In: + return typeFlow.typeCheckInOperator(this); + case NodeType.From: + typeFlow.checker.errorReporter.simpleError(this, "Illegal use of 'from' keyword in binary expression"); + break; + default: + throw new Error("please implement in derived class"); + } + return this; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + var binTokenId = nodeTypeToTokTable[this.nodeType]; + + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (binTokenId != undefined) { + + emitter.emitJavascript(this.operand1, binTokenId, false); + + if (tokenTable[binTokenId].text == "instanceof") { + emitter.writeToOutput(" instanceof "); + } + else if (tokenTable[binTokenId].text == "in") { + emitter.writeToOutput(" in "); + } + else { + emitter.writeToOutputTrimmable(" " + tokenTable[binTokenId].text + " "); + } + + emitter.emitJavascript(this.operand2, binTokenId, false); + } + else { + switch (this.nodeType) { + case NodeType.Dot: + if (!emitter.tryEmitConstant(this)) { + emitter.emitJavascript(this.operand1, TokenID.Dot, false); + emitter.writeToOutput("."); + emitter.emitJavascriptName(this.operand2, false); + } + break; + case NodeType.Index: + emitter.emitIndex(this.operand1, this.operand2); + break; + + case NodeType.Member: + if (this.operand2.nodeType == NodeType.FuncDecl && (this.operand2).isAccessor()) { + var funcDecl = this.operand2; + if (hasFlag(funcDecl.fncFlags, FncFlags.GetAccessor)) { + emitter.writeToOutput("get "); + } + else { + emitter.writeToOutput("set "); + } + emitter.emitJavascript(this.operand1, TokenID.Colon, false); + } + else { + emitter.emitJavascript(this.operand1, TokenID.Colon, false); + emitter.writeToOutputTrimmable(": "); + } + emitter.emitJavascript(this.operand2, TokenID.Comma, false); + break; + case NodeType.Comma: + emitter.emitJavascript(this.operand1, TokenID.Comma, false); + if (emitter.emitState.inObjectLiteral) { + emitter.writeLineToOutput(", "); + } + else { + emitter.writeToOutput(","); + } + emitter.emitJavascript(this.operand2, TokenID.Comma, false); + break; + case NodeType.Is: + throw new Error("should be de-sugared during type check"); + default: + throw new Error("please implement in derived class"); + } + } + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + export class ConditionalExpression extends Expression { + constructor (public operand1: AST, + public operand2: AST, + public operand3: AST) { + super(NodeType.ConditionalExpression); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckQMark(this); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascript(this.operand1, TokenID.Question, false); + emitter.writeToOutput(" ? "); + emitter.emitJavascript(this.operand2, TokenID.Question, false); + emitter.writeToOutput(" : "); + emitter.emitJavascript(this.operand3, TokenID.Question, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + export class NumberLiteral extends Expression { + constructor (public value: number, public hasEmptyFraction?: boolean) { + super(NodeType.NumberLit); + } + + public isNegativeZero = false; + + public typeCheck(typeFlow: TypeFlow) { + this.type = typeFlow.doubleType; + return this; + } + + public treeViewLabel() { + return "num: " + this.printLabel(); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.isNegativeZero) { + emitter.writeToOutput("-"); + } + + emitter.writeToOutput(this.value.toString()); + + if (this.hasEmptyFraction) + emitter.writeToOutput(".0"); + + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public printLabel() { + if (Math.floor(this.value) != this.value) { + return this.value.toFixed(2).toString(); + } + else if (this.hasEmptyFraction) { + return this.value.toString() + ".0"; + } + else { + return this.value.toString(); + } + } + } + + export class RegexLiteral extends Expression { + constructor (public regex) { + super(NodeType.Regex); + } + + public typeCheck(typeFlow: TypeFlow) { + this.type = typeFlow.regexType; + return this; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput(this.regex.toString()); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + export class StringLiteral extends Expression { + constructor (public text: string) { + super(NodeType.QString); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitStringLiteral(this.text); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + this.type = typeFlow.stringType; + return this; + } + + public treeViewLabel() { + return "st: " + this.text; + } + + public printLabel() { + return this.text; + } + } + + export class ModuleElement extends AST { + constructor (nodeType: NodeType) { + super(nodeType); + } + } + + export class ImportDeclaration extends ModuleElement { + public isStatementOrExpression() { return true; } + public varFlags = VarFlags.None; + public isDynamicImport = false; + + constructor (public id: Identifier, public alias: AST) { + super(NodeType.ImportDeclaration); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + var mod = this.alias.type; + // REVIEW: Only modules may be aliased for now, though there's no real + // restriction on what the type symbol may be + if (!this.isDynamicImport || (this.id.sym && !(this.id.sym).onlyReferencedAsTypeRef)) { + var prevModAliasId = emitter.modAliasId; + var prevFirstModAlias = emitter.firstModAlias; + + emitter.recordSourceMappingStart(this); + emitter.emitParensAndCommentsInPlace(this, true); + emitter.writeToOutput("var " + this.id.actualText + " = "); + emitter.modAliasId = this.id.actualText; + emitter.firstModAlias = this.firstAliasedModToString(); + emitter.emitJavascript(this.alias, TokenID.Tilde, false); + // the dynamic import case will insert the semi-colon automatically + if (!this.isDynamicImport) { + emitter.writeToOutput(";"); + } + emitter.emitParensAndCommentsInPlace(this, false); + emitter.recordSourceMappingEnd(this); + + emitter.modAliasId = prevModAliasId; + emitter.firstModAlias = prevFirstModAlias; + } + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckImportDecl(this); + } + + public getAliasName(aliasAST?: AST = this.alias) : string { + if (aliasAST.nodeType == NodeType.Name) { + return (aliasAST).actualText; + } else { + var dotExpr = aliasAST; + return this.getAliasName(dotExpr.operand1) + "." + this.getAliasName(dotExpr.operand2); + } + } + + public firstAliasedModToString() { + if (this.alias.nodeType == NodeType.Name) { + return (this.alias).actualText; + } + else { + var dotExpr = this.alias; + var firstMod = dotExpr.operand1; + return firstMod.actualText; + } + } + } + + export class BoundDecl extends AST { + public init: AST = null; + public typeExpr: AST = null; + public varFlags = VarFlags.None; + public sym: Symbol = null; + + constructor (public id: Identifier, nodeType: NodeType, public nestingLevel: number) { + super(nodeType); + } + + public isStatementOrExpression() { return true; } + + public isPrivate() { return hasFlag(this.varFlags, VarFlags.Private); } + public isPublic() { return hasFlag(this.varFlags, VarFlags.Public); } + public isProperty() { return hasFlag(this.varFlags, VarFlags.Property); } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckBoundDecl(this); + } + + public printLabel() { + return this.treeViewLabel(); + } + } + + export class VarDecl extends BoundDecl { + constructor (id: Identifier, nest: number) { + super(id, NodeType.VarDecl, nest); + } + + public isAmbient() { return hasFlag(this.varFlags, VarFlags.Ambient); } + public isExported() { return hasFlag(this.varFlags, VarFlags.Exported); } + public isStatic() { return hasFlag(this.varFlags, VarFlags.Static); } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitJavascriptVarDecl(this, tokenId); + } + + public treeViewLabel() { + return "var " + this.id.actualText; + } + } + + export class ArgDecl extends BoundDecl { + constructor (id: Identifier) { + super(id, NodeType.ArgDecl, 0); + } + + public isOptional = false; + + public isOptionalArg() { return this.isOptional || this.init; } + + public treeViewLabel() { + return "arg: " + this.id.actualText; + } + + public parameterPropertySym: FieldSymbol = null; + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput(this.id.actualText); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + var internalId = 0; + + export class FuncDecl extends AST { + public hint: string = null; + public fncFlags = FncFlags.None; + public returnTypeAnnotation: AST = null; + public symbols: IHashTable; + public variableArgList = false; + public signature: Signature; + public envids: Identifier[]; + public jumpRefs: Identifier[] = null; + public internalNameCache: string = null; + public tmp1Declared = false; + public enclosingFnc: FuncDecl = null; + public freeVariables: Symbol[] = []; + public unitIndex = -1; + public classDecl: NamedDeclaration = null; + public boundToProperty: VarDecl = null; + public isOverload = false; + public innerStaticFuncs: FuncDecl[] = []; + public isTargetTypedAsMethod = false; + public isInlineCallLiteral = false; + public accessorSymbol: Symbol = null; + public leftCurlyCount = 0; + public rightCurlyCount = 0; + public returnStatementsWithExpressions: ReturnStatement[] = []; + public scopeType: Type = null; // Type of the FuncDecl, before target typing + public endingToken: ASTSpan = null; + + constructor (public name: Identifier, public bod: ASTList, public isConstructor: boolean, + public arguments: ASTList, public vars: ASTList, public scopes: ASTList, public statics: ASTList, + nodeType: number) { + + super(nodeType); + } + + public internalName(): string { + if (this.internalNameCache == null) { + var extName = this.getNameText(); + if (extName) { + this.internalNameCache = "_internal_" + extName; + } + else { + this.internalNameCache = "_internal_" + internalId++; + } + } + return this.internalNameCache; + } + + public hasSelfReference() { return hasFlag(this.fncFlags, FncFlags.HasSelfReference); } + public setHasSelfReference() { this.fncFlags |= FncFlags.HasSelfReference; } + + public addCloRef(id: Identifier, sym: Symbol): number { + if (this.envids == null) { + this.envids = new Identifier[]; + } + this.envids[this.envids.length] = id; + var outerFnc = this.enclosingFnc; + if (sym) { + while (outerFnc && (outerFnc.type.symbol != sym.container)) { + outerFnc.addJumpRef(sym); + outerFnc = outerFnc.enclosingFnc; + } + } + return this.envids.length - 1; + } + + public addJumpRef(sym: Symbol): void { + if (this.jumpRefs == null) { + this.jumpRefs = new Identifier[]; + } + var id = new Identifier(sym.name); + this.jumpRefs[this.jumpRefs.length] = id; + id.sym = sym; + id.cloId = this.addCloRef(id, null); + } + + public buildControlFlow(): ControlFlowContext { + var entry = new BasicBlock(); + var exit = new BasicBlock(); + + var context = new ControlFlowContext(entry, exit); + + var controlFlowPrefix = (ast: AST, parent: AST, walker: IAstWalker) => { + ast.addToControlFlow(walker.state); + return ast; + } + + var walker = getAstWalkerFactory().getWalker(controlFlowPrefix, null, null, context); + context.walker = walker; + walker.walk(this.bod, this); + + return context; + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckFunction(this); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitJavascriptFunction(this); + } + + public getNameText() { + if (this.name) { + return this.name.actualText; + } + else { + return this.hint; + } + } + + public isMethod() { + return (this.fncFlags & FncFlags.Method) != FncFlags.None; + } + + public isCallMember() { return hasFlag(this.fncFlags, FncFlags.CallMember); } + public isConstructMember() { return hasFlag(this.fncFlags, FncFlags.ConstructMember); } + public isIndexerMember() { return hasFlag(this.fncFlags, FncFlags.IndexerMember); } + public isSpecialFn() { return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); } + public isAnonymousFn() { return this.name === null; } + public isAccessor() { return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); } + public isGetAccessor() { return hasFlag(this.fncFlags, FncFlags.GetAccessor); } + public isSetAccessor() { return hasFlag(this.fncFlags, FncFlags.SetAccessor); } + public isAmbient() { return hasFlag(this.fncFlags, FncFlags.Ambient); } + public isExported() { return hasFlag(this.fncFlags, FncFlags.Exported); } + public isPrivate() { return hasFlag(this.fncFlags, FncFlags.Private); } + public isPublic() { return hasFlag(this.fncFlags, FncFlags.Public); } + public isStatic() { return hasFlag(this.fncFlags, FncFlags.Static); } + + public treeViewLabel() { + if (this.name == null) { + return "funcExpr"; + } + else { + return "func: " + this.name.actualText + } + } + + public ClearFlags(): void { + this.fncFlags = FncFlags.None; + } + + public isSignature() { return (this.fncFlags & FncFlags.Signature) != FncFlags.None; } + + public hasStaticDeclarations() { return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); } + } + + export class LocationInfo { + constructor (public filename: string, public lineMap: number[], public unitIndex) { } + } + + export var unknownLocationInfo = new LocationInfo("unknown", null, -1); + + export class Script extends FuncDecl { + public locationInfo: LocationInfo = null; + public referencedFiles: IFileReference[] = []; + public requiresGlobal = false; + public requiresInherits = false; + public isResident = false; + public isDeclareFile = false; + public hasBeenTypeChecked = false; + public topLevelMod: ModuleDeclaration = null; + public leftCurlyCount = 0; + public rightCurlyCount = 0; + public vars: ASTList; + public scopes: ASTList; + // Remember if the script contains Unicode chars, that is needed when generating code for this script object to decide the output file correct encoding. + public containsUnicodeChar = false; + public containsUnicodeCharInComment = false; + + constructor (vars: ASTList, scopes: ASTList) { + super(new Identifier("script"), null, false, null, vars, scopes, null, NodeType.Script); + this.vars = vars; + this.scopes = scopes; + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckScript(this); + } + + public treeViewLabel() { + return "Script"; + } + + public emitRequired() { + if (!this.isDeclareFile && !this.isResident && this.bod) { + for (var i = 0, len = this.bod.members.length; i < len; i++) { + var stmt = this.bod.members[i]; + if (stmt.nodeType == NodeType.ModuleDeclaration) { + if (!hasFlag((stmt).modFlags, ModuleFlags.ShouldEmitModuleDecl | ModuleFlags.Ambient)) { + return true; + } + } + else if (stmt.nodeType == NodeType.ClassDeclaration) { + if (!hasFlag((stmt).varFlags, VarFlags.Ambient)) { + return true; + } + } + else if (stmt.nodeType == NodeType.VarDecl) { + if (!hasFlag((stmt).varFlags, VarFlags.Ambient)) { + return true; + } + } + else if (stmt.nodeType == NodeType.FuncDecl) { + if (!(stmt).isSignature()) { + return true; + } + } + else if (stmt.nodeType != NodeType.InterfaceDeclaration && stmt.nodeType != NodeType.Empty) { + return true; + } + } + } + return false; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + if (this.emitRequired()) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascriptList(this.bod, null, TokenID.Semicolon, true, false, false, true, this.requiresInherits); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + } + + export class NamedDeclaration extends ModuleElement { + public leftCurlyCount = 0; + public rightCurlyCount = 0; + + constructor (nodeType: NodeType, + public name: Identifier, + public members: ASTList) { + super(nodeType); + } + } + + export class ModuleDeclaration extends NamedDeclaration { + public modFlags = ModuleFlags.ShouldEmitModuleDecl; + public mod: ModuleType; + public prettyName: string; + public amdDependencies: string[] = []; + public vars: ASTList; + public scopes: ASTList; + // Remember if the module contains Unicode chars, that is needed for dynamic module as we will generate a file for each. + public containsUnicodeChar = false; + public containsUnicodeCharInComment = false; + + constructor (name: Identifier, members: ASTList, vars: ASTList, scopes: ASTList, public endingToken: ASTSpan) { + super(NodeType.ModuleDeclaration, name, members); + + this.vars = vars; + this.scopes = scopes; + this.prettyName = this.name.actualText; + } + + public isExported() { return hasFlag(this.modFlags, ModuleFlags.Exported); } + public isAmbient() { return hasFlag(this.modFlags, ModuleFlags.Ambient); } + public isEnum() { return hasFlag(this.modFlags, ModuleFlags.IsEnum); } + + public recordNonInterface() { + this.modFlags &= ~ModuleFlags.ShouldEmitModuleDecl; + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckModule(this); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + if (!hasFlag(this.modFlags, ModuleFlags.ShouldEmitModuleDecl)) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascriptModule(this); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + } + + export class TypeDeclaration extends NamedDeclaration { + public varFlags = VarFlags.None; + + constructor (nodeType: NodeType, + name: Identifier, + public extendsList: ASTList, + public implementsList: ASTList, + members: ASTList) { + super(nodeType, name, members); + } + + public isExported() { + return hasFlag(this.varFlags, VarFlags.Exported); + } + + public isAmbient() { + return hasFlag(this.varFlags, VarFlags.Ambient); + } + } + + export class ClassDeclaration extends TypeDeclaration { + public knownMemberNames: any = {}; + public constructorDecl: FuncDecl = null; + public constructorNestingLevel = 0; + public endingToken: ASTSpan = null; + + constructor (name: Identifier, + members: ASTList, + extendsList: ASTList, + implementsList: ASTList) { + super(NodeType.ClassDeclaration, name, extendsList, implementsList, members); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckClass(this); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitJavascriptClass(this); + } + } + + export class InterfaceDeclaration extends TypeDeclaration { + constructor (name: Identifier, + members: ASTList, + extendsList: ASTList, + implementsList: ASTList) { + super(NodeType.InterfaceDeclaration, name, extendsList, implementsList, members); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckInterface(this); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + } + } + + export class Statement extends ModuleElement { + constructor (nodeType: NodeType) { + super(nodeType); + this.flags |= ASTFlags.IsStatement; + } + + public isLoop() { return false; } + + public isStatementOrExpression() { return true; } + + public isCompoundStatement() { return this.isLoop(); } + + public typeCheck(typeFlow: TypeFlow) { + this.type = typeFlow.voidType; + return this; + } + } + + export class LabeledStatement extends Statement { + constructor (public labels: ASTList, public stmt: AST) { + super(NodeType.LabeledStatement); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.labels) { + var labelsLen = this.labels.members.length; + for (var i = 0; i < labelsLen; i++) { + this.labels.members[i].emit(emitter, tokenId, startLine); + } + } + this.stmt.emit(emitter, tokenId, true); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + typeFlow.typeCheck(this.labels); + this.stmt = this.stmt.typeCheck(typeFlow); + return this; + } + + public addToControlFlow(context: ControlFlowContext): void { + var beforeBB = context.current; + var bb = new BasicBlock(); + context.current = bb; + beforeBB.addSuccessor(bb); + } + } + + export class Block extends Statement { + constructor (public statements: ASTList, + public isStatementBlock: boolean) { + super(NodeType.Block); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.isStatementBlock) { + emitter.writeLineToOutput(" {"); + emitter.indenter.increaseIndent(); + } else { + emitter.setInVarBlock(this.statements.members.length); + } + var temp = emitter.setInObjectLiteral(false); + if (this.statements) { + emitter.emitJavascriptList(this.statements, null, TokenID.Semicolon, true, false, false); + } + if (this.isStatementBlock) { + emitter.indenter.decreaseIndent(); + emitter.emitIndent(); + emitter.writeToOutput("}"); + } + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public addToControlFlow(context: ControlFlowContext) { + var afterIfNeeded = new BasicBlock(); + context.pushStatement(this, context.current, afterIfNeeded); + if (this.statements) { + context.walk(this.statements, this); + } + context.walker.options.goChildren = false; + context.popStatement(); + if (afterIfNeeded.predecessors.length > 0) { + context.current.addSuccessor(afterIfNeeded); + context.current = afterIfNeeded; + } + } + + public typeCheck(typeFlow: TypeFlow) { + if (!typeFlow.checker.styleSettings.emptyBlocks) { + if ((this.statements === null) || (this.statements.members.length == 0)) { + typeFlow.checker.errorReporter.styleError(this, "empty block"); + } + } + + typeFlow.typeCheck(this.statements); + return this; + } + } + + export class Jump extends Statement { + public target: string = null; + public hasExplicitTarget() { return (this.target); } + public resolvedTarget: Statement = null; + + constructor (nodeType: NodeType) { + super(nodeType); + } + + public setResolvedTarget(parser: Parser, stmt: Statement): boolean { + if (stmt.isLoop()) { + this.resolvedTarget = stmt; + return true; + } + if (this.nodeType === NodeType.Continue) { + parser.reportParseError("continue statement applies only to loops"); + return false; + } + else { + if ((stmt.nodeType == NodeType.Switch) || this.hasExplicitTarget()) { + this.resolvedTarget = stmt; + return true; + } + else { + parser.reportParseError("break statement with no label can apply only to a loop or switch statement"); + return false; + } + } + } + + public addToControlFlow(context: ControlFlowContext): void { + super.addToControlFlow(context); + context.unconditionalBranch(this.resolvedTarget, (this.nodeType == NodeType.Continue)); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.nodeType == NodeType.Break) { + emitter.writeToOutput("break"); + } + else { + emitter.writeToOutput("continue"); + } + if (this.hasExplicitTarget()) { + emitter.writeToOutput(" " + this.target); + } + emitter.recordSourceMappingEnd(this); + emitter.writeToOutput(";"); + emitter.emitParensAndCommentsInPlace(this, false); + } + } + + export class WhileStatement extends Statement { + public body: AST = null; + + constructor (public cond: AST) { + super(NodeType.While); + } + + public isLoop() { return true; } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.writeToOutput("while("); + emitter.emitJavascript(this.cond, TokenID.While, false); + emitter.writeToOutput(")"); + emitter.emitJavascriptStatements(this.body, false, false); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckWhile(this); + } + + public addToControlFlow(context: ControlFlowContext): void { + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + context.addContent(this.cond); + var condBlock = context.current; + var targetInfo: ITargetInfo = null; + if (this.body) { + context.current = new BasicBlock(); + condBlock.addSuccessor(context.current); + context.pushStatement(this, loopStart, afterLoop); + context.walk(this.body, this); + targetInfo = context.popStatement(); + } + if (!(context.noContinuation)) { + var loopEnd = context.current; + loopEnd.addSuccessor(loopStart); + } + context.current = afterLoop; + condBlock.addSuccessor(afterLoop); + // TODO: check for while (true) and then only continue if afterLoop has predecessors + context.noContinuation = false; + context.walker.options.goChildren = false; + } + } + + export class DoWhileStatement extends Statement { + public body: AST = null; + public whileAST: AST = null; + public cond: AST = null; + public isLoop() { return true; } + + constructor () { + super(NodeType.DoWhile); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.writeToOutput("do"); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.recordSourceMappingStart(this.whileAST); + emitter.writeToOutput("while"); + emitter.recordSourceMappingEnd(this.whileAST); + emitter.writeToOutput('('); + emitter.emitJavascript(this.cond, TokenID.CloseParen, false); + emitter.writeToOutput(")"); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckDoWhile(this); + } + + public addToControlFlow(context: ControlFlowContext): void { + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + var targetInfo: ITargetInfo = null; + if (this.body) { + context.pushStatement(this, loopStart, afterLoop); + context.walk(this.body, this); + targetInfo = context.popStatement(); + } + if (!(context.noContinuation)) { + var loopEnd = context.current; + loopEnd.addSuccessor(loopStart); + context.addContent(this.cond); + // TODO: check for while (true) + context.current = afterLoop; + loopEnd.addSuccessor(afterLoop); + } + else { + context.addUnreachable(this.cond); + } + context.walker.options.goChildren = false; + } + } + + export class IfStatement extends Statement { + public thenBod: AST; + public elseBod: AST = null; + public statement: ASTSpan = new ASTSpan(); + + constructor (public cond: AST) { + super(NodeType.If); + } + + public isCompoundStatement() { return true; } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("if("); + emitter.emitJavascript(this.cond, TokenID.If, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.emitJavascriptStatements(this.thenBod, true, false); + if (this.elseBod) { + emitter.writeToOutput(" else"); + emitter.emitJavascriptStatements(this.elseBod, true, true); + } + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckIf(this); + } + + public addToControlFlow(context: ControlFlowContext): void { + this.cond.addToControlFlow(context); + var afterIf = new BasicBlock(); + var beforeIf = context.current; + context.pushStatement(this, beforeIf, afterIf); + var hasContinuation = false; + context.current = new BasicBlock(); + beforeIf.addSuccessor(context.current); + context.walk(this.thenBod, this); + if (!context.noContinuation) { + hasContinuation = true; + context.current.addSuccessor(afterIf); + } + if (this.elseBod) { + // current block will be thenBod + context.current = new BasicBlock(); + context.noContinuation = false; + beforeIf.addSuccessor(context.current); + context.walk(this.elseBod, this); + if (!context.noContinuation) { + hasContinuation = true; + context.current.addSuccessor(afterIf); + } + else { + // thenBod created continuation for if statement + if (hasContinuation) { + context.noContinuation = false; + } + } + } + else { + beforeIf.addSuccessor(afterIf); + context.noContinuation = false; + hasContinuation = true; + } + var targetInfo = context.popStatement(); + if (afterIf.predecessors.length > 0) { + context.noContinuation = false; + hasContinuation = true; + } + if (hasContinuation) { + context.current = afterIf; + } + context.walker.options.goChildren = false; + } + } + + export class ReturnStatement extends Statement { + public returnExpression: AST = null; + + constructor () { + super(NodeType.Return); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + if (this.returnExpression) { + emitter.writeToOutput("return "); + emitter.emitJavascript(this.returnExpression, TokenID.Semicolon, false); + } + else { + emitter.writeToOutput("return;"); + } + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public addToControlFlow(context: ControlFlowContext): void { + super.addToControlFlow(context); + context.returnStmt(); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckReturn(this); + } + } + + export class EndCode extends AST { + constructor () { + super(NodeType.EndCode); + } + } + + export class ForInStatement extends Statement { + constructor (public lval: AST, public obj: AST) { + super(NodeType.ForIn); + if (this.lval && (this.lval.nodeType == NodeType.VarDecl)) { + (this.lval).varFlags |= VarFlags.AutoInit; + } + } + public statement: ASTSpan = new ASTSpan(); + public body: AST; + + public isLoop() { return true; } + + public isFiltered() { + if (this.body) { + var singleItem: AST = null; + if (this.body.nodeType == NodeType.List) { + var stmts = this.body; + if (stmts.members.length == 1) { + singleItem = stmts.members[0]; + } + } + else { + singleItem = this.body; + } + // match template for filtering 'own' properties from obj + if (singleItem !== null) { + if (singleItem.nodeType == NodeType.Block) { + var block = singleItem; + if ((block.statements !== null) && (block.statements.members.length == 1)) { + singleItem = block.statements.members[0]; + } + } + if (singleItem.nodeType == NodeType.If) { + var cond = (singleItem).cond; + if (cond.nodeType == NodeType.Call) { + var target = (cond).target; + if (target.nodeType == NodeType.Dot) { + var binex = target; + if ((binex.operand1.nodeType == NodeType.Name) && + (this.obj.nodeType == NodeType.Name) && + ((binex.operand1).actualText == (this.obj).actualText)) { + var prop = binex.operand2; + if (prop.actualText == "hasOwnProperty") { + var args = (cond).arguments; + if ((args !== null) && (args.members.length == 1)) { + var arg = args.members[0]; + if ((arg.nodeType == NodeType.Name) && + (this.lval.nodeType == NodeType.Name)) { + if (((this.lval).actualText) == (arg).actualText) { + return true; + } + } + } + } + } + } + } + } + } + } + return false; + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("for("); + emitter.emitJavascript(this.lval, TokenID.For, false); + emitter.writeToOutput(" in "); + emitter.emitJavascript(this.obj, TokenID.For, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + if (typeFlow.checker.styleSettings.forin) { + if (!this.isFiltered()) { + typeFlow.checker.errorReporter.styleError(this, "no hasOwnProperty filter"); + } + } + return typeFlow.typeCheckForIn(this); + } + + public addToControlFlow(context: ControlFlowContext): void { + if (this.lval) { + context.addContent(this.lval); + } + if (this.obj) { + context.addContent(this.obj); + } + + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + if (this.body) { + context.pushStatement(this, loopStart, afterLoop); + context.walk(this.body, this); + context.popStatement(); + } + if (!(context.noContinuation)) { + var loopEnd = context.current; + loopEnd.addSuccessor(loopStart); + } + context.current = afterLoop; + context.noContinuation = false; + loopHeader.addSuccessor(afterLoop); + context.walker.options.goChildren = false; + } + } + + export class ForStatement extends Statement { + public cond: AST; + public body: AST; + public incr: AST; + + constructor (public init: AST) { + super(NodeType.For); + } + + public isLoop() { return true; } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.writeToOutput("for("); + if (this.init) { + if (this.init.nodeType != NodeType.List) { + emitter.emitJavascript(this.init, TokenID.For, false); + } + else { + emitter.setInVarBlock((this.init).members.length); + emitter.emitJavascriptList(this.init, null, TokenID.For, false, false, false); + } + } + emitter.writeToOutput("; "); + emitter.emitJavascript(this.cond, TokenID.For, false); + emitter.writeToOutput("; "); + emitter.emitJavascript(this.incr, TokenID.For, false); + emitter.writeToOutput(")"); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckFor(this); + } + + public addToControlFlow(context: ControlFlowContext): void { + if (this.init) { + context.addContent(this.init); + } + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + var condBlock: BasicBlock = null; + var continueTarget = loopStart; + var incrBB: BasicBlock = null; + if (this.incr) { + incrBB = new BasicBlock(); + continueTarget = incrBB; + } + if (this.cond) { + condBlock = context.current; + context.addContent(this.cond); + context.current = new BasicBlock(); + condBlock.addSuccessor(context.current); + } + var targetInfo: ITargetInfo = null; + if (this.body) { + context.pushStatement(this, continueTarget, afterLoop); + context.walk(this.body, this); + targetInfo = context.popStatement(); + } + if (this.incr) { + if (context.noContinuation) { + if (incrBB.predecessors.length == 0) { + context.addUnreachable(this.incr); + } + } + else { + context.current.addSuccessor(incrBB); + context.current = incrBB; + context.addContent(this.incr); + } + } + var loopEnd = context.current; + if (!(context.noContinuation)) { + loopEnd.addSuccessor(loopStart); + + } + if (condBlock) { + condBlock.addSuccessor(afterLoop); + context.noContinuation = false; + } + if (afterLoop.predecessors.length > 0) { + context.noContinuation = false; + context.current = afterLoop; + } + context.walker.options.goChildren = false; + } + } + + export class WithStatement extends Statement { + public body: AST; + + public isCompoundStatement() { return true; } + + public withSym: WithSymbol = null; + + constructor (public expr: AST) { + super(NodeType.With); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("with ("); + if (this.expr) { + emitter.emitJavascript(this.expr, TokenID.With, false); + } + + emitter.writeToOutput(")"); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + return typeFlow.typeCheckWith(this); + } + } + + export class SwitchStatement extends Statement { + public caseList: ASTList; + public defaultCase: CaseStatement = null; + public statement: ASTSpan = new ASTSpan(); + + constructor (public val: AST) { + super(NodeType.Switch); + } + + public isCompoundStatement() { return true; } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("switch("); + emitter.emitJavascript(this.val, TokenID.Identifier, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.writeLineToOutput(" {"); + emitter.indenter.increaseIndent(); + var casesLen = this.caseList.members.length; + for (var i = 0; i < casesLen; i++) { + var caseExpr = this.caseList.members[i]; + emitter.emitJavascript(caseExpr, TokenID.Case, true); + emitter.writeLineToOutput(""); + } + emitter.indenter.decreaseIndent(); + emitter.emitIndent(); + emitter.writeToOutput("}"); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + var len = this.caseList.members.length; + this.val = typeFlow.typeCheck(this.val); + for (var i = 0; i < len; i++) { + this.caseList.members[i] = typeFlow.typeCheck(this.caseList.members[i]); + } + this.defaultCase = typeFlow.typeCheck(this.defaultCase); + this.type = typeFlow.voidType; + return this; + } + + // if there are break statements that match this switch, then just link cond block with block after switch + public addToControlFlow(context: ControlFlowContext) { + var condBlock = context.current; + context.addContent(this.val); + var execBlock = new BasicBlock(); + var afterSwitch = new BasicBlock(); + + condBlock.addSuccessor(execBlock); + context.pushSwitch(execBlock); + context.current = execBlock; + context.pushStatement(this, execBlock, afterSwitch); + context.walk(this.caseList, this); + context.popSwitch(); + var targetInfo = context.popStatement(); + var hasCondContinuation = (this.defaultCase == null); + if (this.defaultCase == null) { + condBlock.addSuccessor(afterSwitch); + } + if (afterSwitch.predecessors.length > 0) { + context.noContinuation = false; + context.current = afterSwitch; + } + else { + context.noContinuation = true; + } + context.walker.options.goChildren = false; + } + } + + export class CaseStatement extends Statement { + public expr: AST = null; + public body: ASTList; + + constructor () { + super(NodeType.Case); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.expr) { + emitter.writeToOutput("case "); + emitter.emitJavascript(this.expr, TokenID.Identifier, false); + } + else { + emitter.writeToOutput("default"); + } + emitter.writeToOutput(":"); + emitter.emitJavascriptStatements(this.body, false, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + this.expr = typeFlow.typeCheck(this.expr); + typeFlow.typeCheck(this.body); + this.type = typeFlow.voidType; + return this; + } + + // TODO: more reasoning about unreachable cases (such as duplicate literals as case expressions) + // for now, assume all cases are reachable, regardless of whether some cases fall through + public addToControlFlow(context: ControlFlowContext) { + var execBlock = new BasicBlock(); + var sw = context.currentSwitch[context.currentSwitch.length - 1]; + // TODO: fall-through from previous (+ to end of switch) + if (this.expr) { + var exprBlock = new BasicBlock(); + context.current = exprBlock; + sw.addSuccessor(exprBlock); + context.addContent(this.expr); + exprBlock.addSuccessor(execBlock); + } + else { + sw.addSuccessor(execBlock); + } + context.current = execBlock; + if (this.body) { + context.walk(this.body, this); + } + context.noContinuation = false; + context.walker.options.goChildren = false; + } + } + + export class TypeReference extends AST { + constructor (public term: AST, public arrayCount: number) { + super(NodeType.TypeRef); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + throw new Error("should not emit a type ref"); + } + + public typeCheck(typeFlow: TypeFlow) { + var prevInTCTR = typeFlow.inTypeRefTypeCheck; + typeFlow.inTypeRefTypeCheck = true; + var typeLink = getTypeLink(this, typeFlow.checker, true); + typeFlow.checker.resolveTypeLink(typeFlow.scope, typeLink, false); + + if (this.term) { + typeFlow.typeCheck(this.term); + } + + typeFlow.checkForVoidConstructor(typeLink.type, this); + + this.type = typeLink.type; + + // in error recovery cases, there may not be a term + if (this.term) { + this.term.type = this.type; + } + + typeFlow.inTypeRefTypeCheck = prevInTCTR; + return this; + } + } + + export class TryFinally extends Statement { + constructor (public tryNode: AST, public finallyNode: Finally) { + super(NodeType.TryFinally); + } + + public isCompoundStatement() { return true; } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.recordSourceMappingStart(this); + emitter.emitJavascript(this.tryNode, TokenID.Try, false); + emitter.emitJavascript(this.finallyNode, TokenID.Finally, false); + emitter.recordSourceMappingEnd(this); + } + + public typeCheck(typeFlow: TypeFlow) { + this.tryNode = typeFlow.typeCheck(this.tryNode); + this.finallyNode = typeFlow.typeCheck(this.finallyNode); + this.type = typeFlow.voidType; + return this; + } + + public addToControlFlow(context: ControlFlowContext) { + var afterFinally = new BasicBlock(); + context.walk(this.tryNode, this); + var finBlock = new BasicBlock(); + if (context.current) { + context.current.addSuccessor(finBlock); + } + context.current = finBlock; + context.pushStatement(this, null, afterFinally); + context.walk(this.finallyNode, this); + if (!context.noContinuation && context.current) { + context.current.addSuccessor(afterFinally); + } + if (afterFinally.predecessors.length > 0) { + context.current = afterFinally; + } + else { + context.noContinuation = true; + } + context.popStatement(); + context.walker.options.goChildren = false; + } + } + + export class TryCatch extends Statement { + constructor (public tryNode: Try, public catchNode: Catch) { + super(NodeType.TryCatch); + } + + public isCompoundStatement() { return true; } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascript(this.tryNode, TokenID.Try, false); + emitter.emitJavascript(this.catchNode, TokenID.Catch, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public addToControlFlow(context: ControlFlowContext) { + var beforeTry = context.current; + var tryBlock = new BasicBlock(); + beforeTry.addSuccessor(tryBlock); + context.current = tryBlock; + var afterTryCatch = new BasicBlock(); + context.pushStatement(this, null, afterTryCatch); + context.walk(this.tryNode, this); + if (!context.noContinuation) { + if (context.current) { + context.current.addSuccessor(afterTryCatch); + } + } + context.current = new BasicBlock(); + beforeTry.addSuccessor(context.current); + context.walk(this.catchNode, this); + context.popStatement(); + if (!context.noContinuation) { + if (context.current) { + context.current.addSuccessor(afterTryCatch); + } + } + context.current = afterTryCatch; + context.walker.options.goChildren = false; + } + + public typeCheck(typeFlow: TypeFlow) { + this.tryNode = typeFlow.typeCheck(this.tryNode); + this.catchNode = typeFlow.typeCheck(this.catchNode); + this.type = typeFlow.voidType; + return this; + } + } + + export class Try extends Statement { + constructor (public body: AST) { + super(NodeType.Try); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("try "); + emitter.emitJavascript(this.body, TokenID.Try, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public typeCheck(typeFlow: TypeFlow) { + this.body = typeFlow.typeCheck(this.body); + return this; + } + + public addToControlFlow(context: ControlFlowContext) { + if (this.body) { + context.walk(this.body, this); + } + context.walker.options.goChildren = false; + context.noContinuation = false; + } + } + + export class Catch extends Statement { + constructor (public param: VarDecl, public body: AST) { + super(NodeType.Catch); + if (this.param) { + this.param.varFlags |= VarFlags.AutoInit; + } + } + public statement: ASTSpan = new ASTSpan(); + public containedScope: SymbolScope = null; + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput(" "); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("catch ("); + emitter.emitJavascript(this.param, TokenID.OpenParen, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.emitJavascript(this.body, TokenID.Catch, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public addToControlFlow(context: ControlFlowContext) { + if (this.param) { + context.addContent(this.param); + var bodBlock = new BasicBlock(); + context.current.addSuccessor(bodBlock); + context.current = bodBlock; + } + if (this.body) { + context.walk(this.body, this); + } + context.noContinuation = false; + context.walker.options.goChildren = false; + } + + public typeCheck(typeFlow: TypeFlow) { + var prevScope = typeFlow.scope; + typeFlow.scope = this.containedScope; + this.param = typeFlow.typeCheck(this.param); + var exceptVar = new ValueLocation(); + var varSym = new VariableSymbol((this.param).id.text, + this.param.minChar, + typeFlow.checker.locationInfo.unitIndex, + exceptVar); + exceptVar.symbol = varSym; + exceptVar.typeLink = new TypeLink(); + // var type for now (add syntax for type annotation) + exceptVar.typeLink.type = typeFlow.anyType; + var thisFnc = typeFlow.thisFnc; + if (thisFnc && thisFnc.type) { + exceptVar.symbol.container = thisFnc.type.symbol; + } + else { + exceptVar.symbol.container = null; + } + this.param.sym = exceptVar.symbol; + typeFlow.scope.enter(exceptVar.symbol.container, this.param, exceptVar.symbol, + typeFlow.checker.errorReporter, false, false, false); + this.body = typeFlow.typeCheck(this.body); + + // if we're in provisional typecheck mode, clean up the symbol entry + // REVIEW: This is obviously bad form, since we're counting on the internal + // layout of the symbol table, but this is also the only place where we insert + // symbols during typecheck + if (typeFlow.checker.inProvisionalTypecheckMode()) { + var table = typeFlow.scope.getTable(); + (table).secondaryTable.table[exceptVar.symbol.name] = undefined; + } + this.type = typeFlow.voidType; + typeFlow.scope = prevScope; + return this; + } + } + + export class Finally extends Statement { + constructor (public body: AST) { + super(NodeType.Finally); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("finally"); + emitter.emitJavascript(this.body, TokenID.Finally, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + + public addToControlFlow(context: ControlFlowContext) { + if (this.body) { + context.walk(this.body, this); + } + context.walker.options.goChildren = false; + context.noContinuation = false; + } + + public typeCheck(typeFlow: TypeFlow) { + this.body = typeFlow.typeCheck(this.body); + return this; + } + } + + export class Comment extends AST { + + public text: string[] = null; + + constructor (public content: string, public isBlockComment: boolean, public endsLine) { + super(NodeType.Comment); + } + + public getText(): string[] { + if (this.text == null) { + if (this.isBlockComment) { + this.text = this.content.split("\n"); + for (var i = 0; i < this.text.length; i++) { + this.text[i] = this.text[i].replace(/^\s+|\s+$/g, ''); + } + } + else { + this.text = [(this.content.replace(/^\s+|\s+$/g, ''))]; + } + } + + return this.text; + } + } + + export class DebuggerStatement extends Statement { + constructor () { + super(NodeType.Debugger); + } + + public emit(emitter: Emitter, tokenId: TokenID, startLine: boolean) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeLineToOutput("debugger;"); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + } +} + +//// [parserRealSource11.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +/// +var TypeScript; +(function (TypeScript) { + var ASTSpan = (function () { + function ASTSpan() { + this.minChar = -1; // -1 = "undefined" or "compiler generated" + this.limChar = -1; // -1 = "undefined" or "compiler generated" + } + return ASTSpan; + })(); + TypeScript.ASTSpan = ASTSpan; + var AST = (function (_super) { + __extends(AST, _super); + function AST(nodeType) { + _super.call(this); + this.nodeType = nodeType; + this.type = null; + this.flags = ASTFlags.Writeable; + // REVIEW: for diagnostic purposes + this.passCreated = CompilerDiagnostics.analysisPass; + this.preComments = null; + this.postComments = null; + this.isParenthesized = false; + } + AST.prototype.isExpression = function () { + return false; + }; + AST.prototype.isStatementOrExpression = function () { + return false; + }; + AST.prototype.isCompoundStatement = function () { + return false; + }; + AST.prototype.isLeaf = function () { + return this.isStatementOrExpression() && (!this.isCompoundStatement()); + }; + AST.prototype.typeCheck = function (typeFlow) { + switch (this.nodeType) { + case NodeType.Error: + case NodeType.EmptyExpr: + this.type = typeFlow.anyType; + break; + case NodeType.This: + return typeFlow.typeCheckThis(this); + case NodeType.Null: + this.type = typeFlow.nullType; + break; + case NodeType.False: + case NodeType.True: + this.type = typeFlow.booleanType; + break; + case NodeType.Super: + return typeFlow.typeCheckSuper(this); + case NodeType.EndCode: + case NodeType.Empty: + case NodeType.Void: + this.type = typeFlow.voidType; + break; + default: + throw new Error("please implement in derived class"); + } + return this; + }; + AST.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + switch (this.nodeType) { + case NodeType.This: + emitter.recordSourceMappingStart(this); + if (emitter.thisFnc && (hasFlag(emitter.thisFnc.fncFlags, FncFlags.IsFatArrowFunction))) { + emitter.writeToOutput("_this"); + } + else { + emitter.writeToOutput("this"); + } + emitter.recordSourceMappingEnd(this); + break; + case NodeType.Null: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("null"); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.False: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("false"); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.True: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("true"); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.Super: + emitter.recordSourceMappingStart(this); + emitter.emitSuperReference(); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.EndCode: + break; + case NodeType.Error: + case NodeType.EmptyExpr: + break; + case NodeType.Empty: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("; "); + emitter.recordSourceMappingEnd(this); + break; + case NodeType.Void: + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("void "); + emitter.recordSourceMappingEnd(this); + break; + default: + throw new Error("please implement in derived class"); + } + emitter.emitParensAndCommentsInPlace(this, false); + }; + AST.prototype.print = function (context) { + context.startLine(); + var lineCol = { line: -1, col: -1 }; + var limLineCol = { line: -1, col: -1 }; + if (context.parser !== null) { + context.parser.getSourceLineCol(lineCol, this.minChar); + context.parser.getSourceLineCol(limLineCol, this.limChar); + context.write("(" + lineCol.line + "," + lineCol.col + ")--" + "(" + limLineCol.line + "," + limLineCol.col + "): "); + } + var lab = this.printLabel(); + if (hasFlag(this.flags, ASTFlags.Error)) { + lab += " (Error)"; + } + context.writeLine(lab); + }; + AST.prototype.printLabel = function () { + if (nodeTypeTable[this.nodeType] !== undefined) { + return nodeTypeTable[this.nodeType]; + } + else { + return NodeType._map[this.nodeType]; + } + }; + AST.prototype.addToControlFlow = function (context) { + // by default, AST adds itself to current basic block and does not check its children + context.walker.options.goChildren = false; + context.addContent(this); + }; + AST.prototype.netFreeUses = function (container, freeUses) { + }; + AST.prototype.treeViewLabel = function () { + return NodeType._map[this.nodeType]; + }; + AST.getResolvedIdentifierName = function (name) { + if (!name) + return ""; + var resolved = ""; + var start = 0; + var i = 0; + while (i <= name.length - 6) { + // Look for escape sequence \uxxxx + if (name.charAt(i) == '\\' && name.charAt(i + 1) == 'u') { + var charCode = parseInt(name.substr(i + 2, 4), 16); + resolved += name.substr(start, i - start); + resolved += String.fromCharCode(charCode); + i += 6; + start = i; + continue; + } + i++; + } + // Append remaining string + resolved += name.substring(start); + return resolved; + }; + return AST; + })(ASTSpan); + TypeScript.AST = AST; + var IncompleteAST = (function (_super) { + __extends(IncompleteAST, _super); + function IncompleteAST(min, lim) { + _super.call(this, NodeType.Error); + this.minChar = min; + this.limChar = lim; + } + return IncompleteAST; + })(AST); + TypeScript.IncompleteAST = IncompleteAST; + var ASTList = (function (_super) { + __extends(ASTList, _super); + function ASTList() { + _super.call(this, NodeType.List); + this.enclosingScope = null; + this.members = new AST[]; + } + ASTList.prototype.addToControlFlow = function (context) { + var len = this.members.length; + for (var i = 0; i < len; i++) { + if (context.noContinuation) { + context.addUnreachable(this.members[i]); + break; + } + else { + this.members[i] = context.walk(this.members[i], this); + } + } + context.walker.options.goChildren = false; + }; + ASTList.prototype.append = function (ast) { + this.members[this.members.length] = ast; + return this; + }; + ASTList.prototype.appendAll = function (ast) { + if (ast.nodeType == NodeType.List) { + var list = ast; + for (var i = 0, len = list.members.length; i < len; i++) { + this.append(list.members[i]); + } + } + else { + this.append(ast); + } + return this; + }; + ASTList.prototype.emit = function (emitter, tokenId, startLine) { + emitter.recordSourceMappingStart(this); + emitter.emitJavascriptList(this, null, TokenID.Semicolon, startLine, false, false); + emitter.recordSourceMappingEnd(this); + }; + ASTList.prototype.typeCheck = function (typeFlow) { + var len = this.members.length; + typeFlow.nestingLevel++; + for (var i = 0; i < len; i++) { + if (this.members[i]) { + this.members[i] = this.members[i].typeCheck(typeFlow); + } + } + typeFlow.nestingLevel--; + return this; + }; + return ASTList; + })(AST); + TypeScript.ASTList = ASTList; + var Identifier = (function (_super) { + __extends(Identifier, _super); + // 'actualText' is the text that the user has entered for the identifier. the text might + // include any Unicode escape sequences (e.g.: \u0041 for 'A'). 'text', however, contains + // the resolved value of any escape sequences in the actual text; so in the previous + // example, actualText = '\u0041', text = 'A'. + // + // For purposes of finding a symbol, use text, as this will allow you to match all + // variations of the variable text. For full-fidelity translation of the user input, such + // as emitting, use the actualText field. + // + // Note: + // To change text, and to avoid running into a situation where 'actualText' does not + // match 'text', always use setText. + function Identifier(actualText, hasEscapeSequence) { + _super.call(this, NodeType.Name); + this.actualText = actualText; + this.hasEscapeSequence = hasEscapeSequence; + this.sym = null; + this.cloId = -1; + this.setText(actualText, hasEscapeSequence); + } + Identifier.prototype.setText = function (actualText, hasEscapeSequence) { + this.actualText = actualText; + if (hasEscapeSequence) { + this.text = AST.getResolvedIdentifierName(actualText); + } + else { + this.text = actualText; + } + }; + Identifier.prototype.isMissing = function () { + return false; + }; + Identifier.prototype.isLeaf = function () { + return true; + }; + Identifier.prototype.treeViewLabel = function () { + return "id: " + this.actualText; + }; + Identifier.prototype.printLabel = function () { + if (this.actualText) { + return "id: " + this.actualText; + } + else { + return "name node"; + } + }; + Identifier.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckName(this); + }; + Identifier.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitJavascriptName(this, true); + }; + Identifier.fromToken = function (token) { + return new Identifier(token.getText(), token.hasEscapeSequence); + }; + return Identifier; + })(AST); + TypeScript.Identifier = Identifier; + var MissingIdentifier = (function (_super) { + __extends(MissingIdentifier, _super); + function MissingIdentifier() { + _super.call(this, "__missing"); + } + MissingIdentifier.prototype.isMissing = function () { + return true; + }; + MissingIdentifier.prototype.emit = function (emitter, tokenId, startLine) { + // Emit nothing for a missing ID + }; + return MissingIdentifier; + })(Identifier); + TypeScript.MissingIdentifier = MissingIdentifier; + var Label = (function (_super) { + __extends(Label, _super); + function Label(id) { + _super.call(this, NodeType.Label); + this.id = id; + } + Label.prototype.printLabel = function () { + return this.id.actualText + ":"; + }; + Label.prototype.typeCheck = function (typeFlow) { + this.type = typeFlow.voidType; + return this; + }; + Label.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.recordSourceMappingStart(this.id); + emitter.writeToOutput(this.id.actualText); + emitter.recordSourceMappingEnd(this.id); + emitter.writeLineToOutput(":"); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return Label; + })(AST); + TypeScript.Label = Label; + var Expression = (function (_super) { + __extends(Expression, _super); + function Expression(nodeType) { + _super.call(this, nodeType); + } + Expression.prototype.isExpression = function () { + return true; + }; + Expression.prototype.isStatementOrExpression = function () { + return true; + }; + return Expression; + })(AST); + TypeScript.Expression = Expression; + var UnaryExpression = (function (_super) { + __extends(UnaryExpression, _super); + function UnaryExpression(nodeType, operand) { + _super.call(this, nodeType); + this.operand = operand; + this.targetType = null; // Target type for an object literal (null if no target type) + this.castTerm = null; + } + UnaryExpression.prototype.addToControlFlow = function (context) { + _super.prototype.addToControlFlow.call(this, context); + // TODO: add successor as catch block/finally block if present + if (this.nodeType == NodeType.Throw) { + context.returnStmt(); + } + }; + UnaryExpression.prototype.typeCheck = function (typeFlow) { + switch (this.nodeType) { + case NodeType.Not: + return typeFlow.typeCheckBitNot(this); + case NodeType.LogNot: + return typeFlow.typeCheckLogNot(this); + case NodeType.Pos: + case NodeType.Neg: + return typeFlow.typeCheckUnaryNumberOperator(this); + case NodeType.IncPost: + case NodeType.IncPre: + case NodeType.DecPost: + case NodeType.DecPre: + return typeFlow.typeCheckIncOrDec(this); + case NodeType.ArrayLit: + typeFlow.typeCheckArrayLit(this); + return this; + case NodeType.ObjectLit: + typeFlow.typeCheckObjectLit(this); + return this; + case NodeType.Throw: + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.voidType; + return this; + case NodeType.Typeof: + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.stringType; + return this; + case NodeType.Delete: + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.booleanType; + break; + case NodeType.TypeAssertion: + this.castTerm = typeFlow.typeCheck(this.castTerm); + var applyTargetType = !this.operand.isParenthesized; + var targetType = applyTargetType ? this.castTerm.type : null; + typeFlow.checker.typeCheckWithContextualType(targetType, typeFlow.checker.inProvisionalTypecheckMode(), true, this.operand); + typeFlow.castWithCoercion(this.operand, this.castTerm.type, false, true); + this.type = this.castTerm.type; + return this; + case NodeType.Void: + // REVIEW - Although this is good to do for completeness's sake, + // this shouldn't be strictly necessary from the void operator's + // point of view + this.operand = typeFlow.typeCheck(this.operand); + this.type = typeFlow.checker.undefinedType; + break; + default: + throw new Error("please implement in derived class"); + } + return this; + }; + UnaryExpression.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + switch (this.nodeType) { + case NodeType.IncPost: + emitter.emitJavascript(this.operand, TokenID.PlusPlus, false); + emitter.writeToOutput("++"); + break; + case NodeType.LogNot: + emitter.writeToOutput("!"); + emitter.emitJavascript(this.operand, TokenID.Exclamation, false); + break; + case NodeType.DecPost: + emitter.emitJavascript(this.operand, TokenID.MinusMinus, false); + emitter.writeToOutput("--"); + break; + case NodeType.ObjectLit: + emitter.emitObjectLiteral(this.operand); + break; + case NodeType.ArrayLit: + emitter.emitArrayLiteral(this.operand); + break; + case NodeType.Not: + emitter.writeToOutput("~"); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.Neg: + emitter.writeToOutput("-"); + if (this.operand.nodeType == NodeType.Neg) { + this.operand.isParenthesized = true; + } + emitter.emitJavascript(this.operand, TokenID.Minus, false); + break; + case NodeType.Pos: + emitter.writeToOutput("+"); + if (this.operand.nodeType == NodeType.Pos) { + this.operand.isParenthesized = true; + } + emitter.emitJavascript(this.operand, TokenID.Plus, false); + break; + case NodeType.IncPre: + emitter.writeToOutput("++"); + emitter.emitJavascript(this.operand, TokenID.PlusPlus, false); + break; + case NodeType.DecPre: + emitter.writeToOutput("--"); + emitter.emitJavascript(this.operand, TokenID.MinusMinus, false); + break; + case NodeType.Throw: + emitter.writeToOutput("throw "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + emitter.writeToOutput(";"); + break; + case NodeType.Typeof: + emitter.writeToOutput("typeof "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.Delete: + emitter.writeToOutput("delete "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.Void: + emitter.writeToOutput("void "); + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + case NodeType.TypeAssertion: + emitter.emitJavascript(this.operand, TokenID.Tilde, false); + break; + default: + throw new Error("please implement in derived class"); + } + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return UnaryExpression; + })(Expression); + TypeScript.UnaryExpression = UnaryExpression; + var CallExpression = (function (_super) { + __extends(CallExpression, _super); + function CallExpression(nodeType, target, arguments) { + _super.call(this, nodeType); + this.target = target; + this.arguments = arguments; + this.signature = null; + this.minChar = this.target.minChar; + } + CallExpression.prototype.typeCheck = function (typeFlow) { + if (this.nodeType == NodeType.New) { + return typeFlow.typeCheckNew(this); + } + else { + return typeFlow.typeCheckCall(this); + } + }; + CallExpression.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.nodeType == NodeType.New) { + emitter.emitNew(this.target, this.arguments); + } + else { + emitter.emitCall(this, this.target, this.arguments); + } + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return CallExpression; + })(Expression); + TypeScript.CallExpression = CallExpression; + var BinaryExpression = (function (_super) { + __extends(BinaryExpression, _super); + function BinaryExpression(nodeType, operand1, operand2) { + _super.call(this, nodeType); + this.operand1 = operand1; + this.operand2 = operand2; + } + BinaryExpression.prototype.typeCheck = function (typeFlow) { + switch (this.nodeType) { + case NodeType.Dot: + return typeFlow.typeCheckDotOperator(this); + case NodeType.Asg: + return typeFlow.typeCheckAsgOperator(this); + case NodeType.Add: + case NodeType.Sub: + case NodeType.Mul: + case NodeType.Div: + case NodeType.Mod: + case NodeType.Or: + case NodeType.And: + return typeFlow.typeCheckArithmeticOperator(this, false); + case NodeType.Xor: + return typeFlow.typeCheckBitwiseOperator(this, false); + case NodeType.Ne: + case NodeType.Eq: + var text; + if (typeFlow.checker.styleSettings.eqeqeq) { + text = nodeTypeTable[this.nodeType]; + typeFlow.checker.errorReporter.styleError(this, "use of " + text); + } + else if (typeFlow.checker.styleSettings.eqnull) { + text = nodeTypeTable[this.nodeType]; + if ((this.operand2 !== null) && (this.operand2.nodeType == NodeType.Null)) { + typeFlow.checker.errorReporter.styleError(this, "use of " + text + " to compare with null"); + } + } + case NodeType.Eqv: + case NodeType.NEqv: + case NodeType.Lt: + case NodeType.Le: + case NodeType.Ge: + case NodeType.Gt: + return typeFlow.typeCheckBooleanOperator(this); + case NodeType.Index: + return typeFlow.typeCheckIndex(this); + case NodeType.Member: + this.type = typeFlow.voidType; + return this; + case NodeType.LogOr: + return typeFlow.typeCheckLogOr(this); + case NodeType.LogAnd: + return typeFlow.typeCheckLogAnd(this); + case NodeType.AsgAdd: + case NodeType.AsgSub: + case NodeType.AsgMul: + case NodeType.AsgDiv: + case NodeType.AsgMod: + case NodeType.AsgOr: + case NodeType.AsgAnd: + return typeFlow.typeCheckArithmeticOperator(this, true); + case NodeType.AsgXor: + return typeFlow.typeCheckBitwiseOperator(this, true); + case NodeType.Lsh: + case NodeType.Rsh: + case NodeType.Rs2: + return typeFlow.typeCheckShift(this, false); + case NodeType.AsgLsh: + case NodeType.AsgRsh: + case NodeType.AsgRs2: + return typeFlow.typeCheckShift(this, true); + case NodeType.Comma: + return typeFlow.typeCheckCommaOperator(this); + case NodeType.InstOf: + return typeFlow.typeCheckInstOf(this); + case NodeType.In: + return typeFlow.typeCheckInOperator(this); + case NodeType.From: + typeFlow.checker.errorReporter.simpleError(this, "Illegal use of 'from' keyword in binary expression"); + break; + default: + throw new Error("please implement in derived class"); + } + return this; + }; + BinaryExpression.prototype.emit = function (emitter, tokenId, startLine) { + var binTokenId = nodeTypeToTokTable[this.nodeType]; + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (binTokenId != undefined) { + emitter.emitJavascript(this.operand1, binTokenId, false); + if (tokenTable[binTokenId].text == "instanceof") { + emitter.writeToOutput(" instanceof "); + } + else if (tokenTable[binTokenId].text == "in") { + emitter.writeToOutput(" in "); + } + else { + emitter.writeToOutputTrimmable(" " + tokenTable[binTokenId].text + " "); + } + emitter.emitJavascript(this.operand2, binTokenId, false); + } + else { + switch (this.nodeType) { + case NodeType.Dot: + if (!emitter.tryEmitConstant(this)) { + emitter.emitJavascript(this.operand1, TokenID.Dot, false); + emitter.writeToOutput("."); + emitter.emitJavascriptName(this.operand2, false); + } + break; + case NodeType.Index: + emitter.emitIndex(this.operand1, this.operand2); + break; + case NodeType.Member: + if (this.operand2.nodeType == NodeType.FuncDecl && this.operand2.isAccessor()) { + var funcDecl = this.operand2; + if (hasFlag(funcDecl.fncFlags, FncFlags.GetAccessor)) { + emitter.writeToOutput("get "); + } + else { + emitter.writeToOutput("set "); + } + emitter.emitJavascript(this.operand1, TokenID.Colon, false); + } + else { + emitter.emitJavascript(this.operand1, TokenID.Colon, false); + emitter.writeToOutputTrimmable(": "); + } + emitter.emitJavascript(this.operand2, TokenID.Comma, false); + break; + case NodeType.Comma: + emitter.emitJavascript(this.operand1, TokenID.Comma, false); + if (emitter.emitState.inObjectLiteral) { + emitter.writeLineToOutput(", "); + } + else { + emitter.writeToOutput(","); + } + emitter.emitJavascript(this.operand2, TokenID.Comma, false); + break; + case NodeType.Is: + throw new Error("should be de-sugared during type check"); + default: + throw new Error("please implement in derived class"); + } + } + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return BinaryExpression; + })(Expression); + TypeScript.BinaryExpression = BinaryExpression; + var ConditionalExpression = (function (_super) { + __extends(ConditionalExpression, _super); + function ConditionalExpression(operand1, operand2, operand3) { + _super.call(this, NodeType.ConditionalExpression); + this.operand1 = operand1; + this.operand2 = operand2; + this.operand3 = operand3; + } + ConditionalExpression.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckQMark(this); + }; + ConditionalExpression.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascript(this.operand1, TokenID.Question, false); + emitter.writeToOutput(" ? "); + emitter.emitJavascript(this.operand2, TokenID.Question, false); + emitter.writeToOutput(" : "); + emitter.emitJavascript(this.operand3, TokenID.Question, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return ConditionalExpression; + })(Expression); + TypeScript.ConditionalExpression = ConditionalExpression; + var NumberLiteral = (function (_super) { + __extends(NumberLiteral, _super); + function NumberLiteral(value, hasEmptyFraction) { + _super.call(this, NodeType.NumberLit); + this.value = value; + this.hasEmptyFraction = hasEmptyFraction; + this.isNegativeZero = false; + } + NumberLiteral.prototype.typeCheck = function (typeFlow) { + this.type = typeFlow.doubleType; + return this; + }; + NumberLiteral.prototype.treeViewLabel = function () { + return "num: " + this.printLabel(); + }; + NumberLiteral.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.isNegativeZero) { + emitter.writeToOutput("-"); + } + emitter.writeToOutput(this.value.toString()); + if (this.hasEmptyFraction) + emitter.writeToOutput(".0"); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + NumberLiteral.prototype.printLabel = function () { + if (Math.floor(this.value) != this.value) { + return this.value.toFixed(2).toString(); + } + else if (this.hasEmptyFraction) { + return this.value.toString() + ".0"; + } + else { + return this.value.toString(); + } + }; + return NumberLiteral; + })(Expression); + TypeScript.NumberLiteral = NumberLiteral; + var RegexLiteral = (function (_super) { + __extends(RegexLiteral, _super); + function RegexLiteral(regex) { + _super.call(this, NodeType.Regex); + this.regex = regex; + } + RegexLiteral.prototype.typeCheck = function (typeFlow) { + this.type = typeFlow.regexType; + return this; + }; + RegexLiteral.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput(this.regex.toString()); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return RegexLiteral; + })(Expression); + TypeScript.RegexLiteral = RegexLiteral; + var StringLiteral = (function (_super) { + __extends(StringLiteral, _super); + function StringLiteral(text) { + _super.call(this, NodeType.QString); + this.text = text; + } + StringLiteral.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitStringLiteral(this.text); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + StringLiteral.prototype.typeCheck = function (typeFlow) { + this.type = typeFlow.stringType; + return this; + }; + StringLiteral.prototype.treeViewLabel = function () { + return "st: " + this.text; + }; + StringLiteral.prototype.printLabel = function () { + return this.text; + }; + return StringLiteral; + })(Expression); + TypeScript.StringLiteral = StringLiteral; + var ModuleElement = (function (_super) { + __extends(ModuleElement, _super); + function ModuleElement(nodeType) { + _super.call(this, nodeType); + } + return ModuleElement; + })(AST); + TypeScript.ModuleElement = ModuleElement; + var ImportDeclaration = (function (_super) { + __extends(ImportDeclaration, _super); + function ImportDeclaration(id, alias) { + _super.call(this, NodeType.ImportDeclaration); + this.id = id; + this.alias = alias; + this.varFlags = VarFlags.None; + this.isDynamicImport = false; + } + ImportDeclaration.prototype.isStatementOrExpression = function () { + return true; + }; + ImportDeclaration.prototype.emit = function (emitter, tokenId, startLine) { + var mod = this.alias.type; + // REVIEW: Only modules may be aliased for now, though there's no real + // restriction on what the type symbol may be + if (!this.isDynamicImport || (this.id.sym && !this.id.sym.onlyReferencedAsTypeRef)) { + var prevModAliasId = emitter.modAliasId; + var prevFirstModAlias = emitter.firstModAlias; + emitter.recordSourceMappingStart(this); + emitter.emitParensAndCommentsInPlace(this, true); + emitter.writeToOutput("var " + this.id.actualText + " = "); + emitter.modAliasId = this.id.actualText; + emitter.firstModAlias = this.firstAliasedModToString(); + emitter.emitJavascript(this.alias, TokenID.Tilde, false); + // the dynamic import case will insert the semi-colon automatically + if (!this.isDynamicImport) { + emitter.writeToOutput(";"); + } + emitter.emitParensAndCommentsInPlace(this, false); + emitter.recordSourceMappingEnd(this); + emitter.modAliasId = prevModAliasId; + emitter.firstModAlias = prevFirstModAlias; + } + }; + ImportDeclaration.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckImportDecl(this); + }; + ImportDeclaration.prototype.getAliasName = function (aliasAST) { + if (aliasAST === void 0) { aliasAST = this.alias; } + if (aliasAST.nodeType == NodeType.Name) { + return aliasAST.actualText; + } + else { + var dotExpr = aliasAST; + return this.getAliasName(dotExpr.operand1) + "." + this.getAliasName(dotExpr.operand2); + } + }; + ImportDeclaration.prototype.firstAliasedModToString = function () { + if (this.alias.nodeType == NodeType.Name) { + return this.alias.actualText; + } + else { + var dotExpr = this.alias; + var firstMod = dotExpr.operand1; + return firstMod.actualText; + } + }; + return ImportDeclaration; + })(ModuleElement); + TypeScript.ImportDeclaration = ImportDeclaration; + var BoundDecl = (function (_super) { + __extends(BoundDecl, _super); + function BoundDecl(id, nodeType, nestingLevel) { + _super.call(this, nodeType); + this.id = id; + this.nestingLevel = nestingLevel; + this.init = null; + this.typeExpr = null; + this.varFlags = VarFlags.None; + this.sym = null; + } + BoundDecl.prototype.isStatementOrExpression = function () { + return true; + }; + BoundDecl.prototype.isPrivate = function () { + return hasFlag(this.varFlags, VarFlags.Private); + }; + BoundDecl.prototype.isPublic = function () { + return hasFlag(this.varFlags, VarFlags.Public); + }; + BoundDecl.prototype.isProperty = function () { + return hasFlag(this.varFlags, VarFlags.Property); + }; + BoundDecl.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckBoundDecl(this); + }; + BoundDecl.prototype.printLabel = function () { + return this.treeViewLabel(); + }; + return BoundDecl; + })(AST); + TypeScript.BoundDecl = BoundDecl; + var VarDecl = (function (_super) { + __extends(VarDecl, _super); + function VarDecl(id, nest) { + _super.call(this, id, NodeType.VarDecl, nest); + } + VarDecl.prototype.isAmbient = function () { + return hasFlag(this.varFlags, VarFlags.Ambient); + }; + VarDecl.prototype.isExported = function () { + return hasFlag(this.varFlags, VarFlags.Exported); + }; + VarDecl.prototype.isStatic = function () { + return hasFlag(this.varFlags, VarFlags.Static); + }; + VarDecl.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitJavascriptVarDecl(this, tokenId); + }; + VarDecl.prototype.treeViewLabel = function () { + return "var " + this.id.actualText; + }; + return VarDecl; + })(BoundDecl); + TypeScript.VarDecl = VarDecl; + var ArgDecl = (function (_super) { + __extends(ArgDecl, _super); + function ArgDecl(id) { + _super.call(this, id, NodeType.ArgDecl, 0); + this.isOptional = false; + this.parameterPropertySym = null; + } + ArgDecl.prototype.isOptionalArg = function () { + return this.isOptional || this.init; + }; + ArgDecl.prototype.treeViewLabel = function () { + return "arg: " + this.id.actualText; + }; + ArgDecl.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput(this.id.actualText); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return ArgDecl; + })(BoundDecl); + TypeScript.ArgDecl = ArgDecl; + var internalId = 0; + var FuncDecl = (function (_super) { + __extends(FuncDecl, _super); + function FuncDecl(name, bod, isConstructor, arguments, vars, scopes, statics, nodeType) { + _super.call(this, nodeType); + this.name = name; + this.bod = bod; + this.isConstructor = isConstructor; + this.arguments = arguments; + this.vars = vars; + this.scopes = scopes; + this.statics = statics; + this.hint = null; + this.fncFlags = FncFlags.None; + this.returnTypeAnnotation = null; + this.variableArgList = false; + this.jumpRefs = null; + this.internalNameCache = null; + this.tmp1Declared = false; + this.enclosingFnc = null; + this.freeVariables = []; + this.unitIndex = -1; + this.classDecl = null; + this.boundToProperty = null; + this.isOverload = false; + this.innerStaticFuncs = []; + this.isTargetTypedAsMethod = false; + this.isInlineCallLiteral = false; + this.accessorSymbol = null; + this.leftCurlyCount = 0; + this.rightCurlyCount = 0; + this.returnStatementsWithExpressions = []; + this.scopeType = null; // Type of the FuncDecl, before target typing + this.endingToken = null; + } + FuncDecl.prototype.internalName = function () { + if (this.internalNameCache == null) { + var extName = this.getNameText(); + if (extName) { + this.internalNameCache = "_internal_" + extName; + } + else { + this.internalNameCache = "_internal_" + internalId++; + } + } + return this.internalNameCache; + }; + FuncDecl.prototype.hasSelfReference = function () { + return hasFlag(this.fncFlags, FncFlags.HasSelfReference); + }; + FuncDecl.prototype.setHasSelfReference = function () { + this.fncFlags |= FncFlags.HasSelfReference; + }; + FuncDecl.prototype.addCloRef = function (id, sym) { + if (this.envids == null) { + this.envids = new Identifier[]; + } + this.envids[this.envids.length] = id; + var outerFnc = this.enclosingFnc; + if (sym) { + while (outerFnc && (outerFnc.type.symbol != sym.container)) { + outerFnc.addJumpRef(sym); + outerFnc = outerFnc.enclosingFnc; + } + } + return this.envids.length - 1; + }; + FuncDecl.prototype.addJumpRef = function (sym) { + if (this.jumpRefs == null) { + this.jumpRefs = new Identifier[]; + } + var id = new Identifier(sym.name); + this.jumpRefs[this.jumpRefs.length] = id; + id.sym = sym; + id.cloId = this.addCloRef(id, null); + }; + FuncDecl.prototype.buildControlFlow = function () { + var entry = new BasicBlock(); + var exit = new BasicBlock(); + var context = new ControlFlowContext(entry, exit); + var controlFlowPrefix = function (ast, parent, walker) { + ast.addToControlFlow(walker.state); + return ast; + }; + var walker = getAstWalkerFactory().getWalker(controlFlowPrefix, null, null, context); + context.walker = walker; + walker.walk(this.bod, this); + return context; + }; + FuncDecl.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckFunction(this); + }; + FuncDecl.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitJavascriptFunction(this); + }; + FuncDecl.prototype.getNameText = function () { + if (this.name) { + return this.name.actualText; + } + else { + return this.hint; + } + }; + FuncDecl.prototype.isMethod = function () { + return (this.fncFlags & FncFlags.Method) != FncFlags.None; + }; + FuncDecl.prototype.isCallMember = function () { + return hasFlag(this.fncFlags, FncFlags.CallMember); + }; + FuncDecl.prototype.isConstructMember = function () { + return hasFlag(this.fncFlags, FncFlags.ConstructMember); + }; + FuncDecl.prototype.isIndexerMember = function () { + return hasFlag(this.fncFlags, FncFlags.IndexerMember); + }; + FuncDecl.prototype.isSpecialFn = function () { + return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); + }; + FuncDecl.prototype.isAnonymousFn = function () { + return this.name === null; + }; + FuncDecl.prototype.isAccessor = function () { + return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); + }; + FuncDecl.prototype.isGetAccessor = function () { + return hasFlag(this.fncFlags, FncFlags.GetAccessor); + }; + FuncDecl.prototype.isSetAccessor = function () { + return hasFlag(this.fncFlags, FncFlags.SetAccessor); + }; + FuncDecl.prototype.isAmbient = function () { + return hasFlag(this.fncFlags, FncFlags.Ambient); + }; + FuncDecl.prototype.isExported = function () { + return hasFlag(this.fncFlags, FncFlags.Exported); + }; + FuncDecl.prototype.isPrivate = function () { + return hasFlag(this.fncFlags, FncFlags.Private); + }; + FuncDecl.prototype.isPublic = function () { + return hasFlag(this.fncFlags, FncFlags.Public); + }; + FuncDecl.prototype.isStatic = function () { + return hasFlag(this.fncFlags, FncFlags.Static); + }; + FuncDecl.prototype.treeViewLabel = function () { + if (this.name == null) { + return "funcExpr"; + } + else { + return "func: " + this.name.actualText; + } + }; + FuncDecl.prototype.ClearFlags = function () { + this.fncFlags = FncFlags.None; + }; + FuncDecl.prototype.isSignature = function () { + return (this.fncFlags & FncFlags.Signature) != FncFlags.None; + }; + FuncDecl.prototype.hasStaticDeclarations = function () { + return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); + }; + return FuncDecl; + })(AST); + TypeScript.FuncDecl = FuncDecl; + var LocationInfo = (function () { + function LocationInfo(filename, lineMap, unitIndex) { + this.filename = filename; + this.lineMap = lineMap; + this.unitIndex = unitIndex; + } + return LocationInfo; + })(); + TypeScript.LocationInfo = LocationInfo; + TypeScript.unknownLocationInfo = new LocationInfo("unknown", null, -1); + var Script = (function (_super) { + __extends(Script, _super); + function Script(vars, scopes) { + _super.call(this, new Identifier("script"), null, false, null, vars, scopes, null, NodeType.Script); + this.locationInfo = null; + this.referencedFiles = []; + this.requiresGlobal = false; + this.requiresInherits = false; + this.isResident = false; + this.isDeclareFile = false; + this.hasBeenTypeChecked = false; + this.topLevelMod = null; + this.leftCurlyCount = 0; + this.rightCurlyCount = 0; + // Remember if the script contains Unicode chars, that is needed when generating code for this script object to decide the output file correct encoding. + this.containsUnicodeChar = false; + this.containsUnicodeCharInComment = false; + this.vars = vars; + this.scopes = scopes; + } + Script.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckScript(this); + }; + Script.prototype.treeViewLabel = function () { + return "Script"; + }; + Script.prototype.emitRequired = function () { + if (!this.isDeclareFile && !this.isResident && this.bod) { + for (var i = 0, len = this.bod.members.length; i < len; i++) { + var stmt = this.bod.members[i]; + if (stmt.nodeType == NodeType.ModuleDeclaration) { + if (!hasFlag(stmt.modFlags, ModuleFlags.ShouldEmitModuleDecl | ModuleFlags.Ambient)) { + return true; + } + } + else if (stmt.nodeType == NodeType.ClassDeclaration) { + if (!hasFlag(stmt.varFlags, VarFlags.Ambient)) { + return true; + } + } + else if (stmt.nodeType == NodeType.VarDecl) { + if (!hasFlag(stmt.varFlags, VarFlags.Ambient)) { + return true; + } + } + else if (stmt.nodeType == NodeType.FuncDecl) { + if (!stmt.isSignature()) { + return true; + } + } + else if (stmt.nodeType != NodeType.InterfaceDeclaration && stmt.nodeType != NodeType.Empty) { + return true; + } + } + } + return false; + }; + Script.prototype.emit = function (emitter, tokenId, startLine) { + if (this.emitRequired()) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascriptList(this.bod, null, TokenID.Semicolon, true, false, false, true, this.requiresInherits); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + }; + return Script; + })(FuncDecl); + TypeScript.Script = Script; + var NamedDeclaration = (function (_super) { + __extends(NamedDeclaration, _super); + function NamedDeclaration(nodeType, name, members) { + _super.call(this, nodeType); + this.name = name; + this.members = members; + this.leftCurlyCount = 0; + this.rightCurlyCount = 0; + } + return NamedDeclaration; + })(ModuleElement); + TypeScript.NamedDeclaration = NamedDeclaration; + var ModuleDeclaration = (function (_super) { + __extends(ModuleDeclaration, _super); + function ModuleDeclaration(name, members, vars, scopes, endingToken) { + _super.call(this, NodeType.ModuleDeclaration, name, members); + this.endingToken = endingToken; + this.modFlags = ModuleFlags.ShouldEmitModuleDecl; + this.amdDependencies = []; + // Remember if the module contains Unicode chars, that is needed for dynamic module as we will generate a file for each. + this.containsUnicodeChar = false; + this.containsUnicodeCharInComment = false; + this.vars = vars; + this.scopes = scopes; + this.prettyName = this.name.actualText; + } + ModuleDeclaration.prototype.isExported = function () { + return hasFlag(this.modFlags, ModuleFlags.Exported); + }; + ModuleDeclaration.prototype.isAmbient = function () { + return hasFlag(this.modFlags, ModuleFlags.Ambient); + }; + ModuleDeclaration.prototype.isEnum = function () { + return hasFlag(this.modFlags, ModuleFlags.IsEnum); + }; + ModuleDeclaration.prototype.recordNonInterface = function () { + this.modFlags &= ~ModuleFlags.ShouldEmitModuleDecl; + }; + ModuleDeclaration.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckModule(this); + }; + ModuleDeclaration.prototype.emit = function (emitter, tokenId, startLine) { + if (!hasFlag(this.modFlags, ModuleFlags.ShouldEmitModuleDecl)) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascriptModule(this); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + } + }; + return ModuleDeclaration; + })(NamedDeclaration); + TypeScript.ModuleDeclaration = ModuleDeclaration; + var TypeDeclaration = (function (_super) { + __extends(TypeDeclaration, _super); + function TypeDeclaration(nodeType, name, extendsList, implementsList, members) { + _super.call(this, nodeType, name, members); + this.extendsList = extendsList; + this.implementsList = implementsList; + this.varFlags = VarFlags.None; + } + TypeDeclaration.prototype.isExported = function () { + return hasFlag(this.varFlags, VarFlags.Exported); + }; + TypeDeclaration.prototype.isAmbient = function () { + return hasFlag(this.varFlags, VarFlags.Ambient); + }; + return TypeDeclaration; + })(NamedDeclaration); + TypeScript.TypeDeclaration = TypeDeclaration; + var ClassDeclaration = (function (_super) { + __extends(ClassDeclaration, _super); + function ClassDeclaration(name, members, extendsList, implementsList) { + _super.call(this, NodeType.ClassDeclaration, name, extendsList, implementsList, members); + this.knownMemberNames = {}; + this.constructorDecl = null; + this.constructorNestingLevel = 0; + this.endingToken = null; + } + ClassDeclaration.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckClass(this); + }; + ClassDeclaration.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitJavascriptClass(this); + }; + return ClassDeclaration; + })(TypeDeclaration); + TypeScript.ClassDeclaration = ClassDeclaration; + var InterfaceDeclaration = (function (_super) { + __extends(InterfaceDeclaration, _super); + function InterfaceDeclaration(name, members, extendsList, implementsList) { + _super.call(this, NodeType.InterfaceDeclaration, name, extendsList, implementsList, members); + } + InterfaceDeclaration.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckInterface(this); + }; + InterfaceDeclaration.prototype.emit = function (emitter, tokenId, startLine) { + }; + return InterfaceDeclaration; + })(TypeDeclaration); + TypeScript.InterfaceDeclaration = InterfaceDeclaration; + var Statement = (function (_super) { + __extends(Statement, _super); + function Statement(nodeType) { + _super.call(this, nodeType); + this.flags |= ASTFlags.IsStatement; + } + Statement.prototype.isLoop = function () { + return false; + }; + Statement.prototype.isStatementOrExpression = function () { + return true; + }; + Statement.prototype.isCompoundStatement = function () { + return this.isLoop(); + }; + Statement.prototype.typeCheck = function (typeFlow) { + this.type = typeFlow.voidType; + return this; + }; + return Statement; + })(ModuleElement); + TypeScript.Statement = Statement; + var LabeledStatement = (function (_super) { + __extends(LabeledStatement, _super); + function LabeledStatement(labels, stmt) { + _super.call(this, NodeType.LabeledStatement); + this.labels = labels; + this.stmt = stmt; + } + LabeledStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.labels) { + var labelsLen = this.labels.members.length; + for (var i = 0; i < labelsLen; i++) { + this.labels.members[i].emit(emitter, tokenId, startLine); + } + } + this.stmt.emit(emitter, tokenId, true); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + LabeledStatement.prototype.typeCheck = function (typeFlow) { + typeFlow.typeCheck(this.labels); + this.stmt = this.stmt.typeCheck(typeFlow); + return this; + }; + LabeledStatement.prototype.addToControlFlow = function (context) { + var beforeBB = context.current; + var bb = new BasicBlock(); + context.current = bb; + beforeBB.addSuccessor(bb); + }; + return LabeledStatement; + })(Statement); + TypeScript.LabeledStatement = LabeledStatement; + var Block = (function (_super) { + __extends(Block, _super); + function Block(statements, isStatementBlock) { + _super.call(this, NodeType.Block); + this.statements = statements; + this.isStatementBlock = isStatementBlock; + } + Block.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.isStatementBlock) { + emitter.writeLineToOutput(" {"); + emitter.indenter.increaseIndent(); + } + else { + emitter.setInVarBlock(this.statements.members.length); + } + var temp = emitter.setInObjectLiteral(false); + if (this.statements) { + emitter.emitJavascriptList(this.statements, null, TokenID.Semicolon, true, false, false); + } + if (this.isStatementBlock) { + emitter.indenter.decreaseIndent(); + emitter.emitIndent(); + emitter.writeToOutput("}"); + } + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + Block.prototype.addToControlFlow = function (context) { + var afterIfNeeded = new BasicBlock(); + context.pushStatement(this, context.current, afterIfNeeded); + if (this.statements) { + context.walk(this.statements, this); + } + context.walker.options.goChildren = false; + context.popStatement(); + if (afterIfNeeded.predecessors.length > 0) { + context.current.addSuccessor(afterIfNeeded); + context.current = afterIfNeeded; + } + }; + Block.prototype.typeCheck = function (typeFlow) { + if (!typeFlow.checker.styleSettings.emptyBlocks) { + if ((this.statements === null) || (this.statements.members.length == 0)) { + typeFlow.checker.errorReporter.styleError(this, "empty block"); + } + } + typeFlow.typeCheck(this.statements); + return this; + }; + return Block; + })(Statement); + TypeScript.Block = Block; + var Jump = (function (_super) { + __extends(Jump, _super); + function Jump(nodeType) { + _super.call(this, nodeType); + this.target = null; + this.resolvedTarget = null; + } + Jump.prototype.hasExplicitTarget = function () { + return (this.target); + }; + Jump.prototype.setResolvedTarget = function (parser, stmt) { + if (stmt.isLoop()) { + this.resolvedTarget = stmt; + return true; + } + if (this.nodeType === NodeType.Continue) { + parser.reportParseError("continue statement applies only to loops"); + return false; + } + else { + if ((stmt.nodeType == NodeType.Switch) || this.hasExplicitTarget()) { + this.resolvedTarget = stmt; + return true; + } + else { + parser.reportParseError("break statement with no label can apply only to a loop or switch statement"); + return false; + } + } + }; + Jump.prototype.addToControlFlow = function (context) { + _super.prototype.addToControlFlow.call(this, context); + context.unconditionalBranch(this.resolvedTarget, (this.nodeType == NodeType.Continue)); + }; + Jump.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.nodeType == NodeType.Break) { + emitter.writeToOutput("break"); + } + else { + emitter.writeToOutput("continue"); + } + if (this.hasExplicitTarget()) { + emitter.writeToOutput(" " + this.target); + } + emitter.recordSourceMappingEnd(this); + emitter.writeToOutput(";"); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return Jump; + })(Statement); + TypeScript.Jump = Jump; + var WhileStatement = (function (_super) { + __extends(WhileStatement, _super); + function WhileStatement(cond) { + _super.call(this, NodeType.While); + this.cond = cond; + this.body = null; + } + WhileStatement.prototype.isLoop = function () { + return true; + }; + WhileStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.writeToOutput("while("); + emitter.emitJavascript(this.cond, TokenID.While, false); + emitter.writeToOutput(")"); + emitter.emitJavascriptStatements(this.body, false, false); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + WhileStatement.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckWhile(this); + }; + WhileStatement.prototype.addToControlFlow = function (context) { + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + context.addContent(this.cond); + var condBlock = context.current; + var targetInfo = null; + if (this.body) { + context.current = new BasicBlock(); + condBlock.addSuccessor(context.current); + context.pushStatement(this, loopStart, afterLoop); + context.walk(this.body, this); + targetInfo = context.popStatement(); + } + if (!(context.noContinuation)) { + var loopEnd = context.current; + loopEnd.addSuccessor(loopStart); + } + context.current = afterLoop; + condBlock.addSuccessor(afterLoop); + // TODO: check for while (true) and then only continue if afterLoop has predecessors + context.noContinuation = false; + context.walker.options.goChildren = false; + }; + return WhileStatement; + })(Statement); + TypeScript.WhileStatement = WhileStatement; + var DoWhileStatement = (function (_super) { + __extends(DoWhileStatement, _super); + function DoWhileStatement() { + _super.call(this, NodeType.DoWhile); + this.body = null; + this.whileAST = null; + this.cond = null; + } + DoWhileStatement.prototype.isLoop = function () { + return true; + }; + DoWhileStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.writeToOutput("do"); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.recordSourceMappingStart(this.whileAST); + emitter.writeToOutput("while"); + emitter.recordSourceMappingEnd(this.whileAST); + emitter.writeToOutput('('); + emitter.emitJavascript(this.cond, TokenID.CloseParen, false); + emitter.writeToOutput(")"); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + DoWhileStatement.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckDoWhile(this); + }; + DoWhileStatement.prototype.addToControlFlow = function (context) { + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + var targetInfo = null; + if (this.body) { + context.pushStatement(this, loopStart, afterLoop); + context.walk(this.body, this); + targetInfo = context.popStatement(); + } + if (!(context.noContinuation)) { + var loopEnd = context.current; + loopEnd.addSuccessor(loopStart); + context.addContent(this.cond); + // TODO: check for while (true) + context.current = afterLoop; + loopEnd.addSuccessor(afterLoop); + } + else { + context.addUnreachable(this.cond); + } + context.walker.options.goChildren = false; + }; + return DoWhileStatement; + })(Statement); + TypeScript.DoWhileStatement = DoWhileStatement; + var IfStatement = (function (_super) { + __extends(IfStatement, _super); + function IfStatement(cond) { + _super.call(this, NodeType.If); + this.cond = cond; + this.elseBod = null; + this.statement = new ASTSpan(); + } + IfStatement.prototype.isCompoundStatement = function () { + return true; + }; + IfStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("if("); + emitter.emitJavascript(this.cond, TokenID.If, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.emitJavascriptStatements(this.thenBod, true, false); + if (this.elseBod) { + emitter.writeToOutput(" else"); + emitter.emitJavascriptStatements(this.elseBod, true, true); + } + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + IfStatement.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckIf(this); + }; + IfStatement.prototype.addToControlFlow = function (context) { + this.cond.addToControlFlow(context); + var afterIf = new BasicBlock(); + var beforeIf = context.current; + context.pushStatement(this, beforeIf, afterIf); + var hasContinuation = false; + context.current = new BasicBlock(); + beforeIf.addSuccessor(context.current); + context.walk(this.thenBod, this); + if (!context.noContinuation) { + hasContinuation = true; + context.current.addSuccessor(afterIf); + } + if (this.elseBod) { + // current block will be thenBod + context.current = new BasicBlock(); + context.noContinuation = false; + beforeIf.addSuccessor(context.current); + context.walk(this.elseBod, this); + if (!context.noContinuation) { + hasContinuation = true; + context.current.addSuccessor(afterIf); + } + else { + // thenBod created continuation for if statement + if (hasContinuation) { + context.noContinuation = false; + } + } + } + else { + beforeIf.addSuccessor(afterIf); + context.noContinuation = false; + hasContinuation = true; + } + var targetInfo = context.popStatement(); + if (afterIf.predecessors.length > 0) { + context.noContinuation = false; + hasContinuation = true; + } + if (hasContinuation) { + context.current = afterIf; + } + context.walker.options.goChildren = false; + }; + return IfStatement; + })(Statement); + TypeScript.IfStatement = IfStatement; + var ReturnStatement = (function (_super) { + __extends(ReturnStatement, _super); + function ReturnStatement() { + _super.call(this, NodeType.Return); + this.returnExpression = null; + } + ReturnStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + if (this.returnExpression) { + emitter.writeToOutput("return "); + emitter.emitJavascript(this.returnExpression, TokenID.Semicolon, false); + } + else { + emitter.writeToOutput("return;"); + } + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + ReturnStatement.prototype.addToControlFlow = function (context) { + _super.prototype.addToControlFlow.call(this, context); + context.returnStmt(); + }; + ReturnStatement.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckReturn(this); + }; + return ReturnStatement; + })(Statement); + TypeScript.ReturnStatement = ReturnStatement; + var EndCode = (function (_super) { + __extends(EndCode, _super); + function EndCode() { + _super.call(this, NodeType.EndCode); + } + return EndCode; + })(AST); + TypeScript.EndCode = EndCode; + var ForInStatement = (function (_super) { + __extends(ForInStatement, _super); + function ForInStatement(lval, obj) { + _super.call(this, NodeType.ForIn); + this.lval = lval; + this.obj = obj; + this.statement = new ASTSpan(); + if (this.lval && (this.lval.nodeType == NodeType.VarDecl)) { + this.lval.varFlags |= VarFlags.AutoInit; + } + } + ForInStatement.prototype.isLoop = function () { + return true; + }; + ForInStatement.prototype.isFiltered = function () { + if (this.body) { + var singleItem = null; + if (this.body.nodeType == NodeType.List) { + var stmts = this.body; + if (stmts.members.length == 1) { + singleItem = stmts.members[0]; + } + } + else { + singleItem = this.body; + } + // match template for filtering 'own' properties from obj + if (singleItem !== null) { + if (singleItem.nodeType == NodeType.Block) { + var block = singleItem; + if ((block.statements !== null) && (block.statements.members.length == 1)) { + singleItem = block.statements.members[0]; + } + } + if (singleItem.nodeType == NodeType.If) { + var cond = singleItem.cond; + if (cond.nodeType == NodeType.Call) { + var target = cond.target; + if (target.nodeType == NodeType.Dot) { + var binex = target; + if ((binex.operand1.nodeType == NodeType.Name) && (this.obj.nodeType == NodeType.Name) && (binex.operand1.actualText == this.obj.actualText)) { + var prop = binex.operand2; + if (prop.actualText == "hasOwnProperty") { + var args = cond.arguments; + if ((args !== null) && (args.members.length == 1)) { + var arg = args.members[0]; + if ((arg.nodeType == NodeType.Name) && (this.lval.nodeType == NodeType.Name)) { + if ((this.lval.actualText) == arg.actualText) { + return true; + } + } + } + } + } + } + } + } + } + } + return false; + }; + ForInStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("for("); + emitter.emitJavascript(this.lval, TokenID.For, false); + emitter.writeToOutput(" in "); + emitter.emitJavascript(this.obj, TokenID.For, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + ForInStatement.prototype.typeCheck = function (typeFlow) { + if (typeFlow.checker.styleSettings.forin) { + if (!this.isFiltered()) { + typeFlow.checker.errorReporter.styleError(this, "no hasOwnProperty filter"); + } + } + return typeFlow.typeCheckForIn(this); + }; + ForInStatement.prototype.addToControlFlow = function (context) { + if (this.lval) { + context.addContent(this.lval); + } + if (this.obj) { + context.addContent(this.obj); + } + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + if (this.body) { + context.pushStatement(this, loopStart, afterLoop); + context.walk(this.body, this); + context.popStatement(); + } + if (!(context.noContinuation)) { + var loopEnd = context.current; + loopEnd.addSuccessor(loopStart); + } + context.current = afterLoop; + context.noContinuation = false; + loopHeader.addSuccessor(afterLoop); + context.walker.options.goChildren = false; + }; + return ForInStatement; + })(Statement); + TypeScript.ForInStatement = ForInStatement; + var ForStatement = (function (_super) { + __extends(ForStatement, _super); + function ForStatement(init) { + _super.call(this, NodeType.For); + this.init = init; + } + ForStatement.prototype.isLoop = function () { + return true; + }; + ForStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.writeToOutput("for("); + if (this.init) { + if (this.init.nodeType != NodeType.List) { + emitter.emitJavascript(this.init, TokenID.For, false); + } + else { + emitter.setInVarBlock(this.init.members.length); + emitter.emitJavascriptList(this.init, null, TokenID.For, false, false, false); + } + } + emitter.writeToOutput("; "); + emitter.emitJavascript(this.cond, TokenID.For, false); + emitter.writeToOutput("; "); + emitter.emitJavascript(this.incr, TokenID.For, false); + emitter.writeToOutput(")"); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + ForStatement.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckFor(this); + }; + ForStatement.prototype.addToControlFlow = function (context) { + if (this.init) { + context.addContent(this.init); + } + var loopHeader = context.current; + var loopStart = new BasicBlock(); + var afterLoop = new BasicBlock(); + loopHeader.addSuccessor(loopStart); + context.current = loopStart; + var condBlock = null; + var continueTarget = loopStart; + var incrBB = null; + if (this.incr) { + incrBB = new BasicBlock(); + continueTarget = incrBB; + } + if (this.cond) { + condBlock = context.current; + context.addContent(this.cond); + context.current = new BasicBlock(); + condBlock.addSuccessor(context.current); + } + var targetInfo = null; + if (this.body) { + context.pushStatement(this, continueTarget, afterLoop); + context.walk(this.body, this); + targetInfo = context.popStatement(); + } + if (this.incr) { + if (context.noContinuation) { + if (incrBB.predecessors.length == 0) { + context.addUnreachable(this.incr); + } + } + else { + context.current.addSuccessor(incrBB); + context.current = incrBB; + context.addContent(this.incr); + } + } + var loopEnd = context.current; + if (!(context.noContinuation)) { + loopEnd.addSuccessor(loopStart); + } + if (condBlock) { + condBlock.addSuccessor(afterLoop); + context.noContinuation = false; + } + if (afterLoop.predecessors.length > 0) { + context.noContinuation = false; + context.current = afterLoop; + } + context.walker.options.goChildren = false; + }; + return ForStatement; + })(Statement); + TypeScript.ForStatement = ForStatement; + var WithStatement = (function (_super) { + __extends(WithStatement, _super); + function WithStatement(expr) { + _super.call(this, NodeType.With); + this.expr = expr; + this.withSym = null; + } + WithStatement.prototype.isCompoundStatement = function () { + return true; + }; + WithStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("with ("); + if (this.expr) { + emitter.emitJavascript(this.expr, TokenID.With, false); + } + emitter.writeToOutput(")"); + emitter.emitJavascriptStatements(this.body, true, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + WithStatement.prototype.typeCheck = function (typeFlow) { + return typeFlow.typeCheckWith(this); + }; + return WithStatement; + })(Statement); + TypeScript.WithStatement = WithStatement; + var SwitchStatement = (function (_super) { + __extends(SwitchStatement, _super); + function SwitchStatement(val) { + _super.call(this, NodeType.Switch); + this.val = val; + this.defaultCase = null; + this.statement = new ASTSpan(); + } + SwitchStatement.prototype.isCompoundStatement = function () { + return true; + }; + SwitchStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + var temp = emitter.setInObjectLiteral(false); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("switch("); + emitter.emitJavascript(this.val, TokenID.Identifier, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.writeLineToOutput(" {"); + emitter.indenter.increaseIndent(); + var casesLen = this.caseList.members.length; + for (var i = 0; i < casesLen; i++) { + var caseExpr = this.caseList.members[i]; + emitter.emitJavascript(caseExpr, TokenID.Case, true); + emitter.writeLineToOutput(""); + } + emitter.indenter.decreaseIndent(); + emitter.emitIndent(); + emitter.writeToOutput("}"); + emitter.setInObjectLiteral(temp); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + SwitchStatement.prototype.typeCheck = function (typeFlow) { + var len = this.caseList.members.length; + this.val = typeFlow.typeCheck(this.val); + for (var i = 0; i < len; i++) { + this.caseList.members[i] = typeFlow.typeCheck(this.caseList.members[i]); + } + this.defaultCase = typeFlow.typeCheck(this.defaultCase); + this.type = typeFlow.voidType; + return this; + }; + // if there are break statements that match this switch, then just link cond block with block after switch + SwitchStatement.prototype.addToControlFlow = function (context) { + var condBlock = context.current; + context.addContent(this.val); + var execBlock = new BasicBlock(); + var afterSwitch = new BasicBlock(); + condBlock.addSuccessor(execBlock); + context.pushSwitch(execBlock); + context.current = execBlock; + context.pushStatement(this, execBlock, afterSwitch); + context.walk(this.caseList, this); + context.popSwitch(); + var targetInfo = context.popStatement(); + var hasCondContinuation = (this.defaultCase == null); + if (this.defaultCase == null) { + condBlock.addSuccessor(afterSwitch); + } + if (afterSwitch.predecessors.length > 0) { + context.noContinuation = false; + context.current = afterSwitch; + } + else { + context.noContinuation = true; + } + context.walker.options.goChildren = false; + }; + return SwitchStatement; + })(Statement); + TypeScript.SwitchStatement = SwitchStatement; + var CaseStatement = (function (_super) { + __extends(CaseStatement, _super); + function CaseStatement() { + _super.call(this, NodeType.Case); + this.expr = null; + } + CaseStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + if (this.expr) { + emitter.writeToOutput("case "); + emitter.emitJavascript(this.expr, TokenID.Identifier, false); + } + else { + emitter.writeToOutput("default"); + } + emitter.writeToOutput(":"); + emitter.emitJavascriptStatements(this.body, false, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + CaseStatement.prototype.typeCheck = function (typeFlow) { + this.expr = typeFlow.typeCheck(this.expr); + typeFlow.typeCheck(this.body); + this.type = typeFlow.voidType; + return this; + }; + // TODO: more reasoning about unreachable cases (such as duplicate literals as case expressions) + // for now, assume all cases are reachable, regardless of whether some cases fall through + CaseStatement.prototype.addToControlFlow = function (context) { + var execBlock = new BasicBlock(); + var sw = context.currentSwitch[context.currentSwitch.length - 1]; + // TODO: fall-through from previous (+ to end of switch) + if (this.expr) { + var exprBlock = new BasicBlock(); + context.current = exprBlock; + sw.addSuccessor(exprBlock); + context.addContent(this.expr); + exprBlock.addSuccessor(execBlock); + } + else { + sw.addSuccessor(execBlock); + } + context.current = execBlock; + if (this.body) { + context.walk(this.body, this); + } + context.noContinuation = false; + context.walker.options.goChildren = false; + }; + return CaseStatement; + })(Statement); + TypeScript.CaseStatement = CaseStatement; + var TypeReference = (function (_super) { + __extends(TypeReference, _super); + function TypeReference(term, arrayCount) { + _super.call(this, NodeType.TypeRef); + this.term = term; + this.arrayCount = arrayCount; + } + TypeReference.prototype.emit = function (emitter, tokenId, startLine) { + throw new Error("should not emit a type ref"); + }; + TypeReference.prototype.typeCheck = function (typeFlow) { + var prevInTCTR = typeFlow.inTypeRefTypeCheck; + typeFlow.inTypeRefTypeCheck = true; + var typeLink = getTypeLink(this, typeFlow.checker, true); + typeFlow.checker.resolveTypeLink(typeFlow.scope, typeLink, false); + if (this.term) { + typeFlow.typeCheck(this.term); + } + typeFlow.checkForVoidConstructor(typeLink.type, this); + this.type = typeLink.type; + // in error recovery cases, there may not be a term + if (this.term) { + this.term.type = this.type; + } + typeFlow.inTypeRefTypeCheck = prevInTCTR; + return this; + }; + return TypeReference; + })(AST); + TypeScript.TypeReference = TypeReference; + var TryFinally = (function (_super) { + __extends(TryFinally, _super); + function TryFinally(tryNode, finallyNode) { + _super.call(this, NodeType.TryFinally); + this.tryNode = tryNode; + this.finallyNode = finallyNode; + } + TryFinally.prototype.isCompoundStatement = function () { + return true; + }; + TryFinally.prototype.emit = function (emitter, tokenId, startLine) { + emitter.recordSourceMappingStart(this); + emitter.emitJavascript(this.tryNode, TokenID.Try, false); + emitter.emitJavascript(this.finallyNode, TokenID.Finally, false); + emitter.recordSourceMappingEnd(this); + }; + TryFinally.prototype.typeCheck = function (typeFlow) { + this.tryNode = typeFlow.typeCheck(this.tryNode); + this.finallyNode = typeFlow.typeCheck(this.finallyNode); + this.type = typeFlow.voidType; + return this; + }; + TryFinally.prototype.addToControlFlow = function (context) { + var afterFinally = new BasicBlock(); + context.walk(this.tryNode, this); + var finBlock = new BasicBlock(); + if (context.current) { + context.current.addSuccessor(finBlock); + } + context.current = finBlock; + context.pushStatement(this, null, afterFinally); + context.walk(this.finallyNode, this); + if (!context.noContinuation && context.current) { + context.current.addSuccessor(afterFinally); + } + if (afterFinally.predecessors.length > 0) { + context.current = afterFinally; + } + else { + context.noContinuation = true; + } + context.popStatement(); + context.walker.options.goChildren = false; + }; + return TryFinally; + })(Statement); + TypeScript.TryFinally = TryFinally; + var TryCatch = (function (_super) { + __extends(TryCatch, _super); + function TryCatch(tryNode, catchNode) { + _super.call(this, NodeType.TryCatch); + this.tryNode = tryNode; + this.catchNode = catchNode; + } + TryCatch.prototype.isCompoundStatement = function () { + return true; + }; + TryCatch.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.emitJavascript(this.tryNode, TokenID.Try, false); + emitter.emitJavascript(this.catchNode, TokenID.Catch, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + TryCatch.prototype.addToControlFlow = function (context) { + var beforeTry = context.current; + var tryBlock = new BasicBlock(); + beforeTry.addSuccessor(tryBlock); + context.current = tryBlock; + var afterTryCatch = new BasicBlock(); + context.pushStatement(this, null, afterTryCatch); + context.walk(this.tryNode, this); + if (!context.noContinuation) { + if (context.current) { + context.current.addSuccessor(afterTryCatch); + } + } + context.current = new BasicBlock(); + beforeTry.addSuccessor(context.current); + context.walk(this.catchNode, this); + context.popStatement(); + if (!context.noContinuation) { + if (context.current) { + context.current.addSuccessor(afterTryCatch); + } + } + context.current = afterTryCatch; + context.walker.options.goChildren = false; + }; + TryCatch.prototype.typeCheck = function (typeFlow) { + this.tryNode = typeFlow.typeCheck(this.tryNode); + this.catchNode = typeFlow.typeCheck(this.catchNode); + this.type = typeFlow.voidType; + return this; + }; + return TryCatch; + })(Statement); + TypeScript.TryCatch = TryCatch; + var Try = (function (_super) { + __extends(Try, _super); + function Try(body) { + _super.call(this, NodeType.Try); + this.body = body; + } + Try.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("try "); + emitter.emitJavascript(this.body, TokenID.Try, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + Try.prototype.typeCheck = function (typeFlow) { + this.body = typeFlow.typeCheck(this.body); + return this; + }; + Try.prototype.addToControlFlow = function (context) { + if (this.body) { + context.walk(this.body, this); + } + context.walker.options.goChildren = false; + context.noContinuation = false; + }; + return Try; + })(Statement); + TypeScript.Try = Try; + var Catch = (function (_super) { + __extends(Catch, _super); + function Catch(param, body) { + _super.call(this, NodeType.Catch); + this.param = param; + this.body = body; + this.statement = new ASTSpan(); + this.containedScope = null; + if (this.param) { + this.param.varFlags |= VarFlags.AutoInit; + } + } + Catch.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput(" "); + emitter.recordSourceMappingStart(this.statement); + emitter.writeToOutput("catch ("); + emitter.emitJavascript(this.param, TokenID.OpenParen, false); + emitter.writeToOutput(")"); + emitter.recordSourceMappingEnd(this.statement); + emitter.emitJavascript(this.body, TokenID.Catch, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + Catch.prototype.addToControlFlow = function (context) { + if (this.param) { + context.addContent(this.param); + var bodBlock = new BasicBlock(); + context.current.addSuccessor(bodBlock); + context.current = bodBlock; + } + if (this.body) { + context.walk(this.body, this); + } + context.noContinuation = false; + context.walker.options.goChildren = false; + }; + Catch.prototype.typeCheck = function (typeFlow) { + var prevScope = typeFlow.scope; + typeFlow.scope = this.containedScope; + this.param = typeFlow.typeCheck(this.param); + var exceptVar = new ValueLocation(); + var varSym = new VariableSymbol(this.param.id.text, this.param.minChar, typeFlow.checker.locationInfo.unitIndex, exceptVar); + exceptVar.symbol = varSym; + exceptVar.typeLink = new TypeLink(); + // var type for now (add syntax for type annotation) + exceptVar.typeLink.type = typeFlow.anyType; + var thisFnc = typeFlow.thisFnc; + if (thisFnc && thisFnc.type) { + exceptVar.symbol.container = thisFnc.type.symbol; + } + else { + exceptVar.symbol.container = null; + } + this.param.sym = exceptVar.symbol; + typeFlow.scope.enter(exceptVar.symbol.container, this.param, exceptVar.symbol, typeFlow.checker.errorReporter, false, false, false); + this.body = typeFlow.typeCheck(this.body); + // if we're in provisional typecheck mode, clean up the symbol entry + // REVIEW: This is obviously bad form, since we're counting on the internal + // layout of the symbol table, but this is also the only place where we insert + // symbols during typecheck + if (typeFlow.checker.inProvisionalTypecheckMode()) { + var table = typeFlow.scope.getTable(); + table.secondaryTable.table[exceptVar.symbol.name] = undefined; + } + this.type = typeFlow.voidType; + typeFlow.scope = prevScope; + return this; + }; + return Catch; + })(Statement); + TypeScript.Catch = Catch; + var Finally = (function (_super) { + __extends(Finally, _super); + function Finally(body) { + _super.call(this, NodeType.Finally); + this.body = body; + } + Finally.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeToOutput("finally"); + emitter.emitJavascript(this.body, TokenID.Finally, false); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + Finally.prototype.addToControlFlow = function (context) { + if (this.body) { + context.walk(this.body, this); + } + context.walker.options.goChildren = false; + context.noContinuation = false; + }; + Finally.prototype.typeCheck = function (typeFlow) { + this.body = typeFlow.typeCheck(this.body); + return this; + }; + return Finally; + })(Statement); + TypeScript.Finally = Finally; + var Comment = (function (_super) { + __extends(Comment, _super); + function Comment(content, isBlockComment, endsLine) { + _super.call(this, NodeType.Comment); + this.content = content; + this.isBlockComment = isBlockComment; + this.endsLine = endsLine; + this.text = null; + } + Comment.prototype.getText = function () { + if (this.text == null) { + if (this.isBlockComment) { + this.text = this.content.split("\n"); + for (var i = 0; i < this.text.length; i++) { + this.text[i] = this.text[i].replace(/^\s+|\s+$/g, ''); + } + } + else { + this.text = [(this.content.replace(/^\s+|\s+$/g, ''))]; + } + } + return this.text; + }; + return Comment; + })(AST); + TypeScript.Comment = Comment; + var DebuggerStatement = (function (_super) { + __extends(DebuggerStatement, _super); + function DebuggerStatement() { + _super.call(this, NodeType.Debugger); + } + DebuggerStatement.prototype.emit = function (emitter, tokenId, startLine) { + emitter.emitParensAndCommentsInPlace(this, true); + emitter.recordSourceMappingStart(this); + emitter.writeLineToOutput("debugger;"); + emitter.recordSourceMappingEnd(this); + emitter.emitParensAndCommentsInPlace(this, false); + }; + return DebuggerStatement; + })(Statement); + TypeScript.DebuggerStatement = DebuggerStatement; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource12.js b/tests/baselines/reference/parserRealSource12.js new file mode 100644 index 00000000000..831c121ab08 --- /dev/null +++ b/tests/baselines/reference/parserRealSource12.js @@ -0,0 +1,1032 @@ +//// [parserRealSource12.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + export interface IAstWalker { + walk(ast: AST, parent: AST): AST; + options: AstWalkOptions; + state: any; // user state object + } + + export class AstWalkOptions { + public goChildren = true; + public goNextSibling = true; + public reverseSiblings = false; // visit siblings in reverse execution order + + public stopWalk(stop:boolean = true) { + this.goChildren = !stop; + this.goNextSibling = !stop; + } + } + + export interface IAstWalkCallback { + (ast: AST, parent: AST, walker: IAstWalker): AST; + } + + export interface IAstWalkChildren { + (preAst: AST, parent: AST, walker: IAstWalker): void; + } + + class AstWalker implements IAstWalker { + constructor ( + private childrenWalkers: IAstWalkChildren[], + private pre: IAstWalkCallback, + private post: IAstWalkCallback, + public options: AstWalkOptions, + public state: any) { + } + + public walk(ast: AST, parent: AST): AST { + var preAst = this.pre(ast, parent, this); + if (preAst === undefined) { + preAst = ast; + } + if (this.options.goChildren) { + var svGoSib = this.options.goNextSibling; + this.options.goNextSibling = true; + // Call the "walkChildren" function corresponding to "nodeType". + this.childrenWalkers[ast.nodeType](ast, parent, this); + this.options.goNextSibling = svGoSib; + } + else { + // no go only applies to children of node issuing it + this.options.goChildren = true; + } + if (this.post) { + var postAst = this.post(preAst, parent, this); + if (postAst === undefined) { + postAst = preAst; + } + return postAst; + } + else { + return preAst; + } + } + } + + export class AstWalkerFactory { + private childrenWalkers: IAstWalkChildren[] = []; + + constructor () { + this.initChildrenWalkers(); + } + + public walk(ast: AST, pre: IAstWalkCallback, post?: IAstWalkCallback, options?: AstWalkOptions, state?: any): AST { + return this.getWalker(pre, post, options, state).walk(ast, null) + } + + public getWalker(pre: IAstWalkCallback, post?: IAstWalkCallback, options?: AstWalkOptions, state?: any): IAstWalker { + return this.getSlowWalker(pre, post, options, state); + } + + private getSlowWalker(pre: IAstWalkCallback, post?: IAstWalkCallback, options?: AstWalkOptions, state?: any): IAstWalker { + if (!options) { + options = new AstWalkOptions(); + } + + return new AstWalker(this.childrenWalkers, pre, post, options, state); + } + + private initChildrenWalkers(): void { + this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren; + this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren; + this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren; + this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren; + this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren; + this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren; + this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren; + this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren; + this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren; + this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren; + this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren; + this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren; + this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren; + this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren; + this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren; + this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren; + this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren; + this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren; + this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren; + this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren; + this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren; + this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren; + this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren; + this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren; + this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren; + this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren; + this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone; + + // Verify the code is up to date with the enum + for (var e in (NodeType)._map) { + if ((this.childrenWalkers)[e] === undefined) { + throw new Error("initWalkers function is not up to date with enum content!"); + } + } + } + } + + var globalAstWalkerFactory: AstWalkerFactory; + + export function getAstWalkerFactory(): AstWalkerFactory { + if (!globalAstWalkerFactory) { + globalAstWalkerFactory = new AstWalkerFactory(); + } + return globalAstWalkerFactory; + } + + module ChildrenWalkers { + export function walkNone(preAst: ASTList, parent: AST, walker: IAstWalker): void { + // Nothing to do + } + + export function walkListChildren(preAst: ASTList, parent: AST, walker: IAstWalker): void { + var len = preAst.members.length; + if (walker.options.reverseSiblings) { + for (var i = len - 1; i >= 0; i--) { + if (walker.options.goNextSibling) { + preAst.members[i] = walker.walk(preAst.members[i], preAst); + } + } + } + else { + for (var i = 0; i < len; i++) { + if (walker.options.goNextSibling) { + preAst.members[i] = walker.walk(preAst.members[i], preAst); + } + } + } + } + + export function walkUnaryExpressionChildren(preAst: UnaryExpression, parent: AST, walker: IAstWalker): void { + if (preAst.castTerm) { + preAst.castTerm = walker.walk(preAst.castTerm, preAst); + } + if (preAst.operand) { + preAst.operand = walker.walk(preAst.operand, preAst); + } + } + + export function walkBinaryExpressionChildren(preAst: BinaryExpression, parent: AST, walker: IAstWalker): void { + if (walker.options.reverseSiblings) { + if (preAst.operand2) { + preAst.operand2 = walker.walk(preAst.operand2, preAst); + } + if ((preAst.operand1) && (walker.options.goNextSibling)) { + preAst.operand1 = walker.walk(preAst.operand1, preAst); + } + } else { + if (preAst.operand1) { + preAst.operand1 = walker.walk(preAst.operand1, preAst); + } + if ((preAst.operand2) && (walker.options.goNextSibling)) { + preAst.operand2 = walker.walk(preAst.operand2, preAst); + } + } + } + + export function walkTypeReferenceChildren(preAst: TypeReference, parent: AST, walker: IAstWalker): void { + if (preAst.term) { + preAst.term = walker.walk(preAst.term, preAst); + } + } + + export function walkCallExpressionChildren(preAst: CallExpression, parent: AST, walker: IAstWalker): void { + if (!walker.options.reverseSiblings) { + preAst.target = walker.walk(preAst.target, preAst); + } + if (preAst.arguments && (walker.options.goNextSibling)) { + preAst.arguments = walker.walk(preAst.arguments, preAst); + } + if ((walker.options.reverseSiblings) && (walker.options.goNextSibling)) { + preAst.target = walker.walk(preAst.target, preAst); + } + } + + export function walkTrinaryExpressionChildren(preAst: ConditionalExpression, parent: AST, walker: IAstWalker): void { + if (preAst.operand1) { + preAst.operand1 = walker.walk(preAst.operand1, preAst); + } + if (preAst.operand2 && (walker.options.goNextSibling)) { + preAst.operand2 = walker.walk(preAst.operand2, preAst); + } + if (preAst.operand3 && (walker.options.goNextSibling)) { + preAst.operand3 = walker.walk(preAst.operand3, preAst); + } + } + + export function walkFuncDeclChildren(preAst: FuncDecl, parent: AST, walker: IAstWalker): void { + if (preAst.name) { + preAst.name = walker.walk(preAst.name, preAst); + } + if (preAst.arguments && (preAst.arguments.members.length > 0) && (walker.options.goNextSibling)) { + preAst.arguments = walker.walk(preAst.arguments, preAst); + } + if (preAst.returnTypeAnnotation && (walker.options.goNextSibling)) { + preAst.returnTypeAnnotation = walker.walk(preAst.returnTypeAnnotation, preAst); + } + if (preAst.bod && (preAst.bod.members.length > 0) && (walker.options.goNextSibling)) { + preAst.bod = walker.walk(preAst.bod, preAst); + } + } + + export function walkBoundDeclChildren(preAst: BoundDecl, parent: AST, walker: IAstWalker): void { + if (preAst.id) { + preAst.id = walker.walk(preAst.id, preAst); + } + if (preAst.init) { + preAst.init = walker.walk(preAst.init, preAst); + } + if ((preAst.typeExpr) && (walker.options.goNextSibling)) { + preAst.typeExpr = walker.walk(preAst.typeExpr, preAst); + } + } + + export function walkReturnStatementChildren(preAst: ReturnStatement, parent: AST, walker: IAstWalker): void { + if (preAst.returnExpression) { + preAst.returnExpression = walker.walk(preAst.returnExpression, preAst); + } + } + + export function walkForStatementChildren(preAst: ForStatement, parent: AST, walker: IAstWalker): void { + if (preAst.init) { + preAst.init = walker.walk(preAst.init, preAst); + } + + if (preAst.cond && walker.options.goNextSibling) { + preAst.cond = walker.walk(preAst.cond, preAst); + } + + if (preAst.incr && walker.options.goNextSibling) { + preAst.incr = walker.walk(preAst.incr, preAst); + } + + if (preAst.body && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkForInStatementChildren(preAst: ForInStatement, parent: AST, walker: IAstWalker): void { + preAst.lval = walker.walk(preAst.lval, preAst); + if (walker.options.goNextSibling) { + preAst.obj = walker.walk(preAst.obj, preAst); + } + if (preAst.body && (walker.options.goNextSibling)) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkIfStatementChildren(preAst: IfStatement, parent: AST, walker: IAstWalker): void { + preAst.cond = walker.walk(preAst.cond, preAst); + if (preAst.thenBod && (walker.options.goNextSibling)) { + preAst.thenBod = walker.walk(preAst.thenBod, preAst); + } + if (preAst.elseBod && (walker.options.goNextSibling)) { + preAst.elseBod = walker.walk(preAst.elseBod, preAst); + } + } + + export function walkWhileStatementChildren(preAst: WhileStatement, parent: AST, walker: IAstWalker): void { + preAst.cond = walker.walk(preAst.cond, preAst); + if (preAst.body && (walker.options.goNextSibling)) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkDoWhileStatementChildren(preAst: DoWhileStatement, parent: AST, walker: IAstWalker): void { + preAst.cond = walker.walk(preAst.cond, preAst); + if (preAst.body && (walker.options.goNextSibling)) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkBlockChildren(preAst: Block, parent: AST, walker: IAstWalker): void { + if (preAst.statements) { + preAst.statements = walker.walk(preAst.statements, preAst); + } + } + + export function walkCaseStatementChildren(preAst: CaseStatement, parent: AST, walker: IAstWalker): void { + if (preAst.expr) { + preAst.expr = walker.walk(preAst.expr, preAst); + } + + if (preAst.body && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkSwitchStatementChildren(preAst: SwitchStatement, parent: AST, walker: IAstWalker): void { + if (preAst.val) { + preAst.val = walker.walk(preAst.val, preAst); + } + + if ((preAst.caseList) && walker.options.goNextSibling) { + preAst.caseList = walker.walk(preAst.caseList, preAst); + } + } + + export function walkTryChildren(preAst: Try, parent: AST, walker: IAstWalker): void { + if (preAst.body) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkTryCatchChildren(preAst: TryCatch, parent: AST, walker: IAstWalker): void { + if (preAst.tryNode) { + preAst.tryNode = walker.walk(preAst.tryNode, preAst); + } + + if ((preAst.catchNode) && walker.options.goNextSibling) { + preAst.catchNode = walker.walk(preAst.catchNode, preAst); + } + } + + export function walkTryFinallyChildren(preAst: TryFinally, parent: AST, walker: IAstWalker): void { + if (preAst.tryNode) { + preAst.tryNode = walker.walk(preAst.tryNode, preAst); + } + + if (preAst.finallyNode && walker.options.goNextSibling) { + preAst.finallyNode = walker.walk(preAst.finallyNode, preAst); + } + } + + export function walkFinallyChildren(preAst: Finally, parent: AST, walker: IAstWalker): void { + if (preAst.body) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkCatchChildren(preAst: Catch, parent: AST, walker: IAstWalker): void { + if (preAst.param) { + preAst.param = walker.walk(preAst.param, preAst); + } + + if ((preAst.body) && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkRecordChildren(preAst: NamedDeclaration, parent: AST, walker: IAstWalker): void { + preAst.name = walker.walk(preAst.name, preAst); + if (walker.options.goNextSibling && preAst.members) { + preAst.members = walker.walk(preAst.members, preAst); + } + + } + + export function walkNamedTypeChildren(preAst: TypeDeclaration, parent: AST, walker: IAstWalker): void { + walkRecordChildren(preAst, parent, walker); + } + + export function walkClassDeclChildren(preAst: ClassDeclaration, parent: AST, walker: IAstWalker): void { + walkNamedTypeChildren(preAst, parent, walker); + + if (walker.options.goNextSibling && preAst.extendsList) { + preAst.extendsList = walker.walk(preAst.extendsList, preAst); + } + + if (walker.options.goNextSibling && preAst.implementsList) { + preAst.implementsList = walker.walk(preAst.implementsList, preAst); + } + } + + export function walkScriptChildren(preAst: Script, parent: AST, walker: IAstWalker): void { + if (preAst.bod) { + preAst.bod = walker.walk(preAst.bod, preAst); + } + } + + export function walkTypeDeclChildren(preAst: InterfaceDeclaration, parent: AST, walker: IAstWalker): void { + walkNamedTypeChildren(preAst, parent, walker); + + // walked arguments as part of members + if (walker.options.goNextSibling && preAst.extendsList) { + preAst.extendsList = walker.walk(preAst.extendsList, preAst); + } + + if (walker.options.goNextSibling && preAst.implementsList) { + preAst.implementsList = walker.walk(preAst.implementsList, preAst); + } + } + + export function walkModuleDeclChildren(preAst: ModuleDeclaration, parent: AST, walker: IAstWalker): void { + walkRecordChildren(preAst, parent, walker); + } + + export function walkImportDeclChildren(preAst: ImportDeclaration, parent: AST, walker: IAstWalker): void { + if (preAst.id) { + preAst.id = walker.walk(preAst.id, preAst); + } + if (preAst.alias) { + preAst.alias = walker.walk(preAst.alias, preAst); + } + } + + export function walkWithStatementChildren(preAst: WithStatement, parent: AST, walker: IAstWalker): void { + if (preAst.expr) { + preAst.expr = walker.walk(preAst.expr, preAst); + } + + if (preAst.body && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + + export function walkLabelChildren(preAst: Label, parent: AST, walker: IAstWalker): void { + //TODO: Walk "id"? + } + + export function walkLabeledStatementChildren(preAst: LabeledStatement, parent: AST, walker: IAstWalker): void { + preAst.labels = walker.walk(preAst.labels, preAst); + if (walker.options.goNextSibling) { + preAst.stmt = walker.walk(preAst.stmt, preAst); + } + } + } +} + +//// [parserRealSource12.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + var AstWalkOptions = (function () { + function AstWalkOptions() { + this.goChildren = true; + this.goNextSibling = true; + this.reverseSiblings = false; // visit siblings in reverse execution order + } + AstWalkOptions.prototype.stopWalk = function (stop) { + if (stop === void 0) { stop = true; } + this.goChildren = !stop; + this.goNextSibling = !stop; + }; + return AstWalkOptions; + })(); + TypeScript.AstWalkOptions = AstWalkOptions; + var AstWalker = (function () { + function AstWalker(childrenWalkers, pre, post, options, state) { + this.childrenWalkers = childrenWalkers; + this.pre = pre; + this.post = post; + this.options = options; + this.state = state; + } + AstWalker.prototype.walk = function (ast, parent) { + var preAst = this.pre(ast, parent, this); + if (preAst === undefined) { + preAst = ast; + } + if (this.options.goChildren) { + var svGoSib = this.options.goNextSibling; + this.options.goNextSibling = true; + // Call the "walkChildren" function corresponding to "nodeType". + this.childrenWalkers[ast.nodeType](ast, parent, this); + this.options.goNextSibling = svGoSib; + } + else { + // no go only applies to children of node issuing it + this.options.goChildren = true; + } + if (this.post) { + var postAst = this.post(preAst, parent, this); + if (postAst === undefined) { + postAst = preAst; + } + return postAst; + } + else { + return preAst; + } + }; + return AstWalker; + })(); + var AstWalkerFactory = (function () { + function AstWalkerFactory() { + this.childrenWalkers = []; + this.initChildrenWalkers(); + } + AstWalkerFactory.prototype.walk = function (ast, pre, post, options, state) { + return this.getWalker(pre, post, options, state).walk(ast, null); + }; + AstWalkerFactory.prototype.getWalker = function (pre, post, options, state) { + return this.getSlowWalker(pre, post, options, state); + }; + AstWalkerFactory.prototype.getSlowWalker = function (pre, post, options, state) { + if (!options) { + options = new AstWalkOptions(); + } + return new AstWalker(this.childrenWalkers, pre, post, options, state); + }; + AstWalkerFactory.prototype.initChildrenWalkers = function () { + this.childrenWalkers[NodeType.None] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Empty] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EmptyExpr] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.True] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.False] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.This] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Super] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.QString] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Regex] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Null] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.ArrayLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.ObjectLit] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Void] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Comma] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Pos] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Neg] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Delete] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.Await] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.In] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Dot] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.From] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Is] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.InstOf] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Typeof] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.NumberLit] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Name] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.TypeRef] = ChildrenWalkers.walkTypeReferenceChildren; + this.childrenWalkers[NodeType.Index] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Call] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.New] = ChildrenWalkers.walkCallExpressionChildren; + this.childrenWalkers[NodeType.Asg] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAdd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgSub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgDiv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgMod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgXor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgLsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.AsgRs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.ConditionalExpression] = ChildrenWalkers.walkTrinaryExpressionChildren; + this.childrenWalkers[NodeType.LogOr] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.LogAnd] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Or] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Xor] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.And] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eq] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ne] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Eqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.NEqv] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Le] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Gt] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Ge] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Add] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Sub] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mul] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Div] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Mod] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Lsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rsh] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Rs2] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.Not] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.LogNot] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPre] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.IncPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.DecPost] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.TypeAssertion] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.FuncDecl] = ChildrenWalkers.walkFuncDeclChildren; + this.childrenWalkers[NodeType.Member] = ChildrenWalkers.walkBinaryExpressionChildren; + this.childrenWalkers[NodeType.VarDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.ArgDecl] = ChildrenWalkers.walkBoundDeclChildren; + this.childrenWalkers[NodeType.Return] = ChildrenWalkers.walkReturnStatementChildren; + this.childrenWalkers[NodeType.Break] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Continue] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Throw] = ChildrenWalkers.walkUnaryExpressionChildren; + this.childrenWalkers[NodeType.For] = ChildrenWalkers.walkForStatementChildren; + this.childrenWalkers[NodeType.ForIn] = ChildrenWalkers.walkForInStatementChildren; + this.childrenWalkers[NodeType.If] = ChildrenWalkers.walkIfStatementChildren; + this.childrenWalkers[NodeType.While] = ChildrenWalkers.walkWhileStatementChildren; + this.childrenWalkers[NodeType.DoWhile] = ChildrenWalkers.walkDoWhileStatementChildren; + this.childrenWalkers[NodeType.Block] = ChildrenWalkers.walkBlockChildren; + this.childrenWalkers[NodeType.Case] = ChildrenWalkers.walkCaseStatementChildren; + this.childrenWalkers[NodeType.Switch] = ChildrenWalkers.walkSwitchStatementChildren; + this.childrenWalkers[NodeType.Try] = ChildrenWalkers.walkTryChildren; + this.childrenWalkers[NodeType.TryCatch] = ChildrenWalkers.walkTryCatchChildren; + this.childrenWalkers[NodeType.TryFinally] = ChildrenWalkers.walkTryFinallyChildren; + this.childrenWalkers[NodeType.Finally] = ChildrenWalkers.walkFinallyChildren; + this.childrenWalkers[NodeType.Catch] = ChildrenWalkers.walkCatchChildren; + this.childrenWalkers[NodeType.List] = ChildrenWalkers.walkListChildren; + this.childrenWalkers[NodeType.Script] = ChildrenWalkers.walkScriptChildren; + this.childrenWalkers[NodeType.ClassDeclaration] = ChildrenWalkers.walkClassDeclChildren; + this.childrenWalkers[NodeType.InterfaceDeclaration] = ChildrenWalkers.walkTypeDeclChildren; + this.childrenWalkers[NodeType.ModuleDeclaration] = ChildrenWalkers.walkModuleDeclChildren; + this.childrenWalkers[NodeType.ImportDeclaration] = ChildrenWalkers.walkImportDeclChildren; + this.childrenWalkers[NodeType.With] = ChildrenWalkers.walkWithStatementChildren; + this.childrenWalkers[NodeType.Label] = ChildrenWalkers.walkLabelChildren; + this.childrenWalkers[NodeType.LabeledStatement] = ChildrenWalkers.walkLabeledStatementChildren; + this.childrenWalkers[NodeType.EBStart] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.GotoEB] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.EndCode] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Error] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Comment] = ChildrenWalkers.walkNone; + this.childrenWalkers[NodeType.Debugger] = ChildrenWalkers.walkNone; + // Verify the code is up to date with the enum + for (var e in NodeType._map) { + if (this.childrenWalkers[e] === undefined) { + throw new Error("initWalkers function is not up to date with enum content!"); + } + } + }; + return AstWalkerFactory; + })(); + TypeScript.AstWalkerFactory = AstWalkerFactory; + var globalAstWalkerFactory; + function getAstWalkerFactory() { + if (!globalAstWalkerFactory) { + globalAstWalkerFactory = new AstWalkerFactory(); + } + return globalAstWalkerFactory; + } + TypeScript.getAstWalkerFactory = getAstWalkerFactory; + var ChildrenWalkers; + (function (ChildrenWalkers) { + function walkNone(preAst, parent, walker) { + // Nothing to do + } + ChildrenWalkers.walkNone = walkNone; + function walkListChildren(preAst, parent, walker) { + var len = preAst.members.length; + if (walker.options.reverseSiblings) { + for (var i = len - 1; i >= 0; i--) { + if (walker.options.goNextSibling) { + preAst.members[i] = walker.walk(preAst.members[i], preAst); + } + } + } + else { + for (var i = 0; i < len; i++) { + if (walker.options.goNextSibling) { + preAst.members[i] = walker.walk(preAst.members[i], preAst); + } + } + } + } + ChildrenWalkers.walkListChildren = walkListChildren; + function walkUnaryExpressionChildren(preAst, parent, walker) { + if (preAst.castTerm) { + preAst.castTerm = walker.walk(preAst.castTerm, preAst); + } + if (preAst.operand) { + preAst.operand = walker.walk(preAst.operand, preAst); + } + } + ChildrenWalkers.walkUnaryExpressionChildren = walkUnaryExpressionChildren; + function walkBinaryExpressionChildren(preAst, parent, walker) { + if (walker.options.reverseSiblings) { + if (preAst.operand2) { + preAst.operand2 = walker.walk(preAst.operand2, preAst); + } + if ((preAst.operand1) && (walker.options.goNextSibling)) { + preAst.operand1 = walker.walk(preAst.operand1, preAst); + } + } + else { + if (preAst.operand1) { + preAst.operand1 = walker.walk(preAst.operand1, preAst); + } + if ((preAst.operand2) && (walker.options.goNextSibling)) { + preAst.operand2 = walker.walk(preAst.operand2, preAst); + } + } + } + ChildrenWalkers.walkBinaryExpressionChildren = walkBinaryExpressionChildren; + function walkTypeReferenceChildren(preAst, parent, walker) { + if (preAst.term) { + preAst.term = walker.walk(preAst.term, preAst); + } + } + ChildrenWalkers.walkTypeReferenceChildren = walkTypeReferenceChildren; + function walkCallExpressionChildren(preAst, parent, walker) { + if (!walker.options.reverseSiblings) { + preAst.target = walker.walk(preAst.target, preAst); + } + if (preAst.arguments && (walker.options.goNextSibling)) { + preAst.arguments = walker.walk(preAst.arguments, preAst); + } + if ((walker.options.reverseSiblings) && (walker.options.goNextSibling)) { + preAst.target = walker.walk(preAst.target, preAst); + } + } + ChildrenWalkers.walkCallExpressionChildren = walkCallExpressionChildren; + function walkTrinaryExpressionChildren(preAst, parent, walker) { + if (preAst.operand1) { + preAst.operand1 = walker.walk(preAst.operand1, preAst); + } + if (preAst.operand2 && (walker.options.goNextSibling)) { + preAst.operand2 = walker.walk(preAst.operand2, preAst); + } + if (preAst.operand3 && (walker.options.goNextSibling)) { + preAst.operand3 = walker.walk(preAst.operand3, preAst); + } + } + ChildrenWalkers.walkTrinaryExpressionChildren = walkTrinaryExpressionChildren; + function walkFuncDeclChildren(preAst, parent, walker) { + if (preAst.name) { + preAst.name = walker.walk(preAst.name, preAst); + } + if (preAst.arguments && (preAst.arguments.members.length > 0) && (walker.options.goNextSibling)) { + preAst.arguments = walker.walk(preAst.arguments, preAst); + } + if (preAst.returnTypeAnnotation && (walker.options.goNextSibling)) { + preAst.returnTypeAnnotation = walker.walk(preAst.returnTypeAnnotation, preAst); + } + if (preAst.bod && (preAst.bod.members.length > 0) && (walker.options.goNextSibling)) { + preAst.bod = walker.walk(preAst.bod, preAst); + } + } + ChildrenWalkers.walkFuncDeclChildren = walkFuncDeclChildren; + function walkBoundDeclChildren(preAst, parent, walker) { + if (preAst.id) { + preAst.id = walker.walk(preAst.id, preAst); + } + if (preAst.init) { + preAst.init = walker.walk(preAst.init, preAst); + } + if ((preAst.typeExpr) && (walker.options.goNextSibling)) { + preAst.typeExpr = walker.walk(preAst.typeExpr, preAst); + } + } + ChildrenWalkers.walkBoundDeclChildren = walkBoundDeclChildren; + function walkReturnStatementChildren(preAst, parent, walker) { + if (preAst.returnExpression) { + preAst.returnExpression = walker.walk(preAst.returnExpression, preAst); + } + } + ChildrenWalkers.walkReturnStatementChildren = walkReturnStatementChildren; + function walkForStatementChildren(preAst, parent, walker) { + if (preAst.init) { + preAst.init = walker.walk(preAst.init, preAst); + } + if (preAst.cond && walker.options.goNextSibling) { + preAst.cond = walker.walk(preAst.cond, preAst); + } + if (preAst.incr && walker.options.goNextSibling) { + preAst.incr = walker.walk(preAst.incr, preAst); + } + if (preAst.body && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkForStatementChildren = walkForStatementChildren; + function walkForInStatementChildren(preAst, parent, walker) { + preAst.lval = walker.walk(preAst.lval, preAst); + if (walker.options.goNextSibling) { + preAst.obj = walker.walk(preAst.obj, preAst); + } + if (preAst.body && (walker.options.goNextSibling)) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkForInStatementChildren = walkForInStatementChildren; + function walkIfStatementChildren(preAst, parent, walker) { + preAst.cond = walker.walk(preAst.cond, preAst); + if (preAst.thenBod && (walker.options.goNextSibling)) { + preAst.thenBod = walker.walk(preAst.thenBod, preAst); + } + if (preAst.elseBod && (walker.options.goNextSibling)) { + preAst.elseBod = walker.walk(preAst.elseBod, preAst); + } + } + ChildrenWalkers.walkIfStatementChildren = walkIfStatementChildren; + function walkWhileStatementChildren(preAst, parent, walker) { + preAst.cond = walker.walk(preAst.cond, preAst); + if (preAst.body && (walker.options.goNextSibling)) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkWhileStatementChildren = walkWhileStatementChildren; + function walkDoWhileStatementChildren(preAst, parent, walker) { + preAst.cond = walker.walk(preAst.cond, preAst); + if (preAst.body && (walker.options.goNextSibling)) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkDoWhileStatementChildren = walkDoWhileStatementChildren; + function walkBlockChildren(preAst, parent, walker) { + if (preAst.statements) { + preAst.statements = walker.walk(preAst.statements, preAst); + } + } + ChildrenWalkers.walkBlockChildren = walkBlockChildren; + function walkCaseStatementChildren(preAst, parent, walker) { + if (preAst.expr) { + preAst.expr = walker.walk(preAst.expr, preAst); + } + if (preAst.body && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkCaseStatementChildren = walkCaseStatementChildren; + function walkSwitchStatementChildren(preAst, parent, walker) { + if (preAst.val) { + preAst.val = walker.walk(preAst.val, preAst); + } + if ((preAst.caseList) && walker.options.goNextSibling) { + preAst.caseList = walker.walk(preAst.caseList, preAst); + } + } + ChildrenWalkers.walkSwitchStatementChildren = walkSwitchStatementChildren; + function walkTryChildren(preAst, parent, walker) { + if (preAst.body) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkTryChildren = walkTryChildren; + function walkTryCatchChildren(preAst, parent, walker) { + if (preAst.tryNode) { + preAst.tryNode = walker.walk(preAst.tryNode, preAst); + } + if ((preAst.catchNode) && walker.options.goNextSibling) { + preAst.catchNode = walker.walk(preAst.catchNode, preAst); + } + } + ChildrenWalkers.walkTryCatchChildren = walkTryCatchChildren; + function walkTryFinallyChildren(preAst, parent, walker) { + if (preAst.tryNode) { + preAst.tryNode = walker.walk(preAst.tryNode, preAst); + } + if (preAst.finallyNode && walker.options.goNextSibling) { + preAst.finallyNode = walker.walk(preAst.finallyNode, preAst); + } + } + ChildrenWalkers.walkTryFinallyChildren = walkTryFinallyChildren; + function walkFinallyChildren(preAst, parent, walker) { + if (preAst.body) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkFinallyChildren = walkFinallyChildren; + function walkCatchChildren(preAst, parent, walker) { + if (preAst.param) { + preAst.param = walker.walk(preAst.param, preAst); + } + if ((preAst.body) && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkCatchChildren = walkCatchChildren; + function walkRecordChildren(preAst, parent, walker) { + preAst.name = walker.walk(preAst.name, preAst); + if (walker.options.goNextSibling && preAst.members) { + preAst.members = walker.walk(preAst.members, preAst); + } + } + ChildrenWalkers.walkRecordChildren = walkRecordChildren; + function walkNamedTypeChildren(preAst, parent, walker) { + walkRecordChildren(preAst, parent, walker); + } + ChildrenWalkers.walkNamedTypeChildren = walkNamedTypeChildren; + function walkClassDeclChildren(preAst, parent, walker) { + walkNamedTypeChildren(preAst, parent, walker); + if (walker.options.goNextSibling && preAst.extendsList) { + preAst.extendsList = walker.walk(preAst.extendsList, preAst); + } + if (walker.options.goNextSibling && preAst.implementsList) { + preAst.implementsList = walker.walk(preAst.implementsList, preAst); + } + } + ChildrenWalkers.walkClassDeclChildren = walkClassDeclChildren; + function walkScriptChildren(preAst, parent, walker) { + if (preAst.bod) { + preAst.bod = walker.walk(preAst.bod, preAst); + } + } + ChildrenWalkers.walkScriptChildren = walkScriptChildren; + function walkTypeDeclChildren(preAst, parent, walker) { + walkNamedTypeChildren(preAst, parent, walker); + // walked arguments as part of members + if (walker.options.goNextSibling && preAst.extendsList) { + preAst.extendsList = walker.walk(preAst.extendsList, preAst); + } + if (walker.options.goNextSibling && preAst.implementsList) { + preAst.implementsList = walker.walk(preAst.implementsList, preAst); + } + } + ChildrenWalkers.walkTypeDeclChildren = walkTypeDeclChildren; + function walkModuleDeclChildren(preAst, parent, walker) { + walkRecordChildren(preAst, parent, walker); + } + ChildrenWalkers.walkModuleDeclChildren = walkModuleDeclChildren; + function walkImportDeclChildren(preAst, parent, walker) { + if (preAst.id) { + preAst.id = walker.walk(preAst.id, preAst); + } + if (preAst.alias) { + preAst.alias = walker.walk(preAst.alias, preAst); + } + } + ChildrenWalkers.walkImportDeclChildren = walkImportDeclChildren; + function walkWithStatementChildren(preAst, parent, walker) { + if (preAst.expr) { + preAst.expr = walker.walk(preAst.expr, preAst); + } + if (preAst.body && walker.options.goNextSibling) { + preAst.body = walker.walk(preAst.body, preAst); + } + } + ChildrenWalkers.walkWithStatementChildren = walkWithStatementChildren; + function walkLabelChildren(preAst, parent, walker) { + //TODO: Walk "id"? + } + ChildrenWalkers.walkLabelChildren = walkLabelChildren; + function walkLabeledStatementChildren(preAst, parent, walker) { + preAst.labels = walker.walk(preAst.labels, preAst); + if (walker.options.goNextSibling) { + preAst.stmt = walker.walk(preAst.stmt, preAst); + } + } + ChildrenWalkers.walkLabeledStatementChildren = walkLabeledStatementChildren; + })(ChildrenWalkers || (ChildrenWalkers = {})); +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource13.js b/tests/baselines/reference/parserRealSource13.js new file mode 100644 index 00000000000..7c1ecdc7372 --- /dev/null +++ b/tests/baselines/reference/parserRealSource13.js @@ -0,0 +1,183 @@ +//// [parserRealSource13.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript.AstWalkerWithDetailCallback { + export interface AstWalkerDetailCallback { + EmptyCallback? (pre, ast: AST): boolean; + EmptyExprCallback? (pre, ast: AST): boolean; + TrueCallback? (pre, ast: AST): boolean; + FalseCallback? (pre, ast: AST): boolean; + ThisCallback? (pre, ast: AST): boolean; + SuperCallback? (pre, ast: AST): boolean; + QStringCallback? (pre, ast: AST): boolean; + RegexCallback? (pre, ast: AST): boolean; + NullCallback? (pre, ast: AST): boolean; + ArrayLitCallback? (pre, ast: AST): boolean; + ObjectLitCallback? (pre, ast: AST): boolean; + VoidCallback? (pre, ast: AST): boolean; + CommaCallback? (pre, ast: AST): boolean; + PosCallback? (pre, ast: AST): boolean; + NegCallback? (pre, ast: AST): boolean; + DeleteCallback? (pre, ast: AST): boolean; + AwaitCallback? (pre, ast: AST): boolean; + InCallback? (pre, ast: AST): boolean; + DotCallback? (pre, ast: AST): boolean; + FromCallback? (pre, ast: AST): boolean; + IsCallback? (pre, ast: AST): boolean; + InstOfCallback? (pre, ast: AST): boolean; + TypeofCallback? (pre, ast: AST): boolean; + NumberLitCallback? (pre, ast: AST): boolean; + NameCallback? (pre, identifierAst: Identifier): boolean; + TypeRefCallback? (pre, ast: AST): boolean; + IndexCallback? (pre, ast: AST): boolean; + CallCallback? (pre, ast: AST): boolean; + NewCallback? (pre, ast: AST): boolean; + AsgCallback? (pre, ast: AST): boolean; + AsgAddCallback? (pre, ast: AST): boolean; + AsgSubCallback? (pre, ast: AST): boolean; + AsgDivCallback? (pre, ast: AST): boolean; + AsgMulCallback? (pre, ast: AST): boolean; + AsgModCallback? (pre, ast: AST): boolean; + AsgAndCallback? (pre, ast: AST): boolean; + AsgXorCallback? (pre, ast: AST): boolean; + AsgOrCallback? (pre, ast: AST): boolean; + AsgLshCallback? (pre, ast: AST): boolean; + AsgRshCallback? (pre, ast: AST): boolean; + AsgRs2Callback? (pre, ast: AST): boolean; + QMarkCallback? (pre, ast: AST): boolean; + LogOrCallback? (pre, ast: AST): boolean; + LogAndCallback? (pre, ast: AST): boolean; + OrCallback? (pre, ast: AST): boolean; + XorCallback? (pre, ast: AST): boolean; + AndCallback? (pre, ast: AST): boolean; + EqCallback? (pre, ast: AST): boolean; + NeCallback? (pre, ast: AST): boolean; + EqvCallback? (pre, ast: AST): boolean; + NEqvCallback? (pre, ast: AST): boolean; + LtCallback? (pre, ast: AST): boolean; + LeCallback? (pre, ast: AST): boolean; + GtCallback? (pre, ast: AST): boolean; + GeCallback? (pre, ast: AST): boolean; + AddCallback? (pre, ast: AST): boolean; + SubCallback? (pre, ast: AST): boolean; + MulCallback? (pre, ast: AST): boolean; + DivCallback? (pre, ast: AST): boolean; + ModCallback? (pre, ast: AST): boolean; + LshCallback? (pre, ast: AST): boolean; + RshCallback? (pre, ast: AST): boolean; + Rs2Callback? (pre, ast: AST): boolean; + NotCallback? (pre, ast: AST): boolean; + LogNotCallback? (pre, ast: AST): boolean; + IncPreCallback? (pre, ast: AST): boolean; + DecPreCallback? (pre, ast: AST): boolean; + IncPostCallback? (pre, ast: AST): boolean; + DecPostCallback? (pre, ast: AST): boolean; + TypeAssertionCallback? (pre, ast: AST): boolean; + FuncDeclCallback? (pre, funcDecl: FuncDecl): boolean; + MemberCallback? (pre, ast: AST): boolean; + VarDeclCallback? (pre, varDecl: VarDecl): boolean; + ArgDeclCallback? (pre, ast: AST): boolean; + ReturnCallback? (pre, ast: AST): boolean; + BreakCallback? (pre, ast: AST): boolean; + ContinueCallback? (pre, ast: AST): boolean; + ThrowCallback? (pre, ast: AST): boolean; + ForCallback? (pre, ast: AST): boolean; + ForInCallback? (pre, ast: AST): boolean; + IfCallback? (pre, ast: AST): boolean; + WhileCallback? (pre, ast: AST): boolean; + DoWhileCallback? (pre, ast: AST): boolean; + BlockCallback? (pre, block: Block): boolean; + CaseCallback? (pre, ast: AST): boolean; + SwitchCallback? (pre, ast: AST): boolean; + TryCallback? (pre, ast: AST): boolean; + TryCatchCallback? (pre, ast: AST): boolean; + TryFinallyCallback? (pre, ast: AST): boolean; + FinallyCallback? (pre, ast: AST): boolean; + CatchCallback? (pre, ast: AST): boolean; + ListCallback? (pre, astList: ASTList): boolean; + ScriptCallback? (pre, script: Script): boolean; + ClassDeclarationCallback? (pre, ast: AST): boolean; + InterfaceDeclarationCallback? (pre, interfaceDecl: InterfaceDeclaration): boolean; + ModuleDeclarationCallback? (pre, moduleDecl: ModuleDeclaration): boolean; + ImportDeclarationCallback? (pre, ast: AST): boolean; + WithCallback? (pre, ast: AST): boolean; + LabelCallback? (pre, labelAST: AST): boolean; + LabeledStatementCallback? (pre, ast: AST): boolean; + EBStartCallback? (pre, ast: AST): boolean; + GotoEBCallback? (pre, ast: AST): boolean; + EndCodeCallback? (pre, ast: AST): boolean; + ErrorCallback? (pre, ast: AST): boolean; + CommentCallback? (pre, ast: AST): boolean; + DebuggerCallback? (pre, ast: AST): boolean; + DefaultCallback? (pre, ast: AST): boolean; + } + + export function walk(script: Script, callback: AstWalkerDetailCallback): void { + var pre = (cur: AST, parent: AST) => { + walker.options.goChildren = AstWalkerCallback(true, cur, callback); + return cur; + } + + var post = (cur: AST, parent: AST) => { + AstWalkerCallback(false, cur, callback); + return cur; + } + + var walker = TypeScript.getAstWalkerFactory().getWalker(pre, post); + walker.walk(script, null); + } + + function AstWalkerCallback(pre: boolean, ast: AST, callback: AstWalkerDetailCallback): boolean { + // See if the Callback needs to be handled using specific one or default one + var nodeType = ast.nodeType; + var callbackString = (NodeType)._map[nodeType] + "Callback"; + if (callback[callbackString]) { + return callback[callbackString](pre, ast); + } + + if (callback.DefaultCallback) { + return callback.DefaultCallback(pre, ast); + } + + return true; + } +} + +//// [parserRealSource13.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + var AstWalkerWithDetailCallback; + (function (AstWalkerWithDetailCallback) { + function walk(script, callback) { + var pre = function (cur, parent) { + walker.options.goChildren = AstWalkerCallback(true, cur, callback); + return cur; + }; + var post = function (cur, parent) { + AstWalkerCallback(false, cur, callback); + return cur; + }; + var walker = TypeScript.getAstWalkerFactory().getWalker(pre, post); + walker.walk(script, null); + } + AstWalkerWithDetailCallback.walk = walk; + function AstWalkerCallback(pre, ast, callback) { + // See if the Callback needs to be handled using specific one or default one + var nodeType = ast.nodeType; + var callbackString = NodeType._map[nodeType] + "Callback"; + if (callback[callbackString]) { + return callback[callbackString](pre, ast); + } + if (callback.DefaultCallback) { + return callback.DefaultCallback(pre, ast); + } + return true; + } + })(AstWalkerWithDetailCallback = TypeScript.AstWalkerWithDetailCallback || (TypeScript.AstWalkerWithDetailCallback = {})); +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js new file mode 100644 index 00000000000..9b9ee2bcf84 --- /dev/null +++ b/tests/baselines/reference/parserRealSource14.js @@ -0,0 +1,956 @@ +//// [parserRealSource14.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + export function lastOf(items: any[]): any { + return (items === null || items.length === 0) ? null : items[items.length - 1]; + } + + export function max(a: number, b: number): number { + return a >= b ? a : b; + } + + export function min(a: number, b: number): number { + return a <= b ? a : b; + } + + // + // Helper class representing a path from a root ast node to a (grand)child ast node. + // This is helpful as our tree don't have parents. + // + export class AstPath { + public asts: TypeScript.AST[] = []; + public top: number = -1; + + static reverseIndexOf(items: any[], index: number): any { + return (items === null || items.length <= index) ? null : items[items.length - index - 1]; + } + + public clone(): AstPath { + var clone = new AstPath(); + clone.asts = this.asts.map((value) => { return value; }); + clone.top = this.top; + return clone; + } + + public pop(): TypeScript.AST { + var head = this.ast(); + this.up(); + + while (this.asts.length > this.count()) { + this.asts.pop(); + } + return head; + } + + public push(ast: TypeScript.AST) { + while (this.asts.length > this.count()) { + this.asts.pop(); + } + this.top = this.asts.length; + this.asts.push(ast); + } + + public up() { + if (this.top <= -1) + throw new Error("Invalid call to 'up'"); + this.top--; + } + + public down() { + if (this.top == this.ast.length - 1) + throw new Error("Invalid call to 'down'"); + this.top++; + } + + public nodeType(): TypeScript.NodeType { + if (this.ast() == null) + return TypeScript.NodeType.None; + return this.ast().nodeType; + } + + public ast() { + return AstPath.reverseIndexOf(this.asts, this.asts.length - (this.top + 1)); + } + + public parent() { + return AstPath.reverseIndexOf(this.asts, this.asts.length - this.top); + } + + public count() { + return this.top + 1; + } + + public get(index: number): TypeScript.AST { + return this.asts[index]; + } + + public isNameOfClass(): boolean { + if (this.ast() === null || this.parent() === null) + return false; + + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && + ((this.parent()).name === this.ast()); + } + + public isNameOfInterface(): boolean { + if (this.ast() === null || this.parent() === null) + return false; + + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && + ((this.parent()).name === this.ast()); + } + + public isNameOfArgument(): boolean { + if (this.ast() === null || this.parent() === null) + return false; + + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && + ((this.parent()).id === this.ast()); + } + + public isNameOfVariable(): boolean { + if (this.ast() === null || this.parent() === null) + return false; + + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.VarDecl) && + ((this.parent()).id === this.ast()); + } + + public isNameOfModule(): boolean { + if (this.ast() === null || this.parent() === null) + return false; + + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && + ((this.parent()).name === this.ast()); + } + + public isNameOfFunction(): boolean { + if (this.ast() === null || this.parent() === null) + return false; + + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && + ((this.parent()).name === this.ast()); + } + + public isChildOfScript(): boolean { + var ast = lastOf(this.asts); + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; + } + + public isChildOfModule(): boolean { + var ast = lastOf(this.asts); + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; + } + + public isChildOfClass(): boolean { + var ast = lastOf(this.asts); + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; + } + + public isArgumentOfClassConstructor(): boolean { + var ast = lastOf(this.asts); + return this.count() >= 5 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && + ((this.asts[this.top - 2]).isConstructor) && + ((this.asts[this.top - 2]).arguments === this.asts[this.top - 1]) && + ((this.asts[this.top - 4]).constructorDecl === this.asts[this.top - 2]); + } + + public isChildOfInterface(): boolean { + var ast = lastOf(this.asts); + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; + } + + public isTopLevelImplicitModule() { + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && + TypeScript.hasFlag((this.asts[this.top]).modFlags, TypeScript.ModuleFlags.IsWholeFile); + } + + public isBodyOfTopLevelImplicitModule() { + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + (this.asts[this.top - 1]).members == this.asts[this.top - 0] && + TypeScript.hasFlag((this.asts[this.top - 1]).modFlags, TypeScript.ModuleFlags.IsWholeFile); + } + + public isBodyOfScript(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && + (this.asts[this.top - 1]).bod == this.asts[this.top - 0]; + } + + public isBodyOfSwitch(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && + (this.asts[this.top - 1]).caseList == this.asts[this.top - 0]; + } + + public isBodyOfModule(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + (this.asts[this.top - 1]).members == this.asts[this.top - 0]; + } + + public isBodyOfClass(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && + (this.asts[this.top - 1]).members == this.asts[this.top - 0]; + } + + public isBodyOfFunction(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + (this.asts[this.top - 1]).bod == this.asts[this.top - 0]; + } + + public isBodyOfInterface(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && + (this.asts[this.top - 1]).members == this.asts[this.top - 0]; + } + + public isBodyOfBlock(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && + (this.asts[this.top - 1]).statements == this.asts[this.top - 0]; + } + + public isBodyOfFor(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfCase(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfTry(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfCatch(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfDoWhile(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfWhile(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfForIn(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfWith(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isBodyOfFinally(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && + (this.asts[this.top - 1]).body == this.asts[this.top - 0]; + } + + public isCaseOfSwitch(): boolean { + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + (this.asts[this.top - 2]).caseList == this.asts[this.top - 1]; + } + + public isDefaultCaseOfSwitch(): boolean { + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + (this.asts[this.top - 2]).caseList == this.asts[this.top - 1] && + (this.asts[this.top - 2]).defaultCase == this.asts[this.top - 0]; + } + + public isListOfObjectLit(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + (this.asts[this.top - 1]).operand == this.asts[this.top - 0]; + } + + public isBodyOfObjectLit(): boolean { + return this.isListOfObjectLit(); + } + + public isEmptyListOfObjectLit(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + (this.asts[this.top - 1]).operand == this.asts[this.top - 0] && + (this.asts[this.top - 0]).members.length == 0; + } + + public isMemberOfObjectLit(): boolean { + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && + (this.asts[this.top - 2]).operand == this.asts[this.top - 1]; + } + + public isNameOfMemberOfObjectLit(): boolean { + return this.count() >= 4 && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && + (this.asts[this.top - 3]).operand == this.asts[this.top - 2]; + } + + public isListOfArrayLit(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + (this.asts[this.top - 1]).operand == this.asts[this.top - 0]; + } + + public isTargetOfMember(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + (this.asts[this.top - 1]).operand1 === this.asts[this.top - 0]; + } + + public isMemberOfMember(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + (this.asts[this.top - 1]).operand2 === this.asts[this.top - 0]; + } + + public isItemOfList(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; + //(this.asts[this.top - 1]).operand2 === this.asts[this.top - 0]; + } + + public isThenOfIf(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + (this.asts[this.top - 1]).thenBod == this.asts[this.top - 0]; + } + + public isElseOfIf(): boolean { + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + (this.asts[this.top - 1]).elseBod == this.asts[this.top - 0]; + } + + public isBodyOfDefaultCase(): boolean { + return this.isBodyOfCase(); + } + + public isSingleStatementList(): boolean { + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.List && + (this.asts[this.top]).members.length === 1; + } + + public isArgumentListOfFunction(): boolean { + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + (this.asts[this.top - 1]).arguments === this.asts[this.top - 0]; + } + + public isArgumentOfFunction(): boolean { + return this.count() >= 3 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + (this.asts[this.top - 2]).arguments === this.asts[this.top - 1]; + } + + public isArgumentListOfCall(): boolean { + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && + (this.asts[this.top - 1]).arguments === this.asts[this.top - 0]; + } + + public isArgumentListOfNew(): boolean { + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && + (this.asts[this.top - 1]).arguments === this.asts[this.top - 0]; + } + + public isSynthesizedBlock(): boolean { + return this.count() >= 1 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && + (this.asts[this.top - 0]).isStatementBlock === false; + } + } + + export function isValidAstNode(ast: TypeScript.ASTSpan): boolean { + if (ast === null) + return false; + + if (ast.minChar === -1 || ast.limChar === -1) + return false; + + return true; + } + + export class AstPathContext { + public path = new TypeScript.AstPath(); + } + + export enum GetAstPathOptions { + Default = 0, + EdgeInclusive = 1, + //We need this options dealing with an AST coming from an incomplete AST. For example: + // class foo { // r + // If we ask for the AST at the position after the "r" character, we won't see we are + // inside a comment, because the "class" AST node has a limChar corresponding to the position of + // the "{" character, meaning we don't traverse the tree down to the stmt list of the class, meaning + // we don't find the "precomment" attached to the errorneous empty stmt. + //TODO: It would be nice to be able to get rid of this. + DontPruneSearchBasedOnPosition = 1 << 1, + } + + /// + /// Return the stack of AST nodes containing "position" + /// + export function getAstPathToPosition(script: TypeScript.AST, pos: number, options = GetAstPathOptions.Default): TypeScript.AstPath { + var lookInComments = (comments: TypeScript.Comment[]) => { + if (comments && comments.length > 0) { + for (var i = 0; i < comments.length; i++) { + var minChar = comments[i].minChar; + var limChar = comments[i].limChar; + if (!comments[i].isBlockComment) { + limChar++; // For single line comments, include 1 more character (for the newline) + } + if (pos >= minChar && pos < limChar) { + ctx.path.push(comments[i]); + } + } + } + } + + var pre = function (cur: TypeScript.AST, parent: TypeScript.AST, walker: IAstWalker) { + if (isValidAstNode(cur)) { + + // Add "cur" to the stack if it contains our position + // For "identifier" nodes, we need a special case: A position equal to "limChar" is + // valid, since the position corresponds to a caret position (in between characters) + // For example: + // bar + // 0123 + // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid + var inclusive = + hasFlag(options, GetAstPathOptions.EdgeInclusive) || + cur.nodeType === TypeScript.NodeType.Name || + pos === script.limChar; // Special "EOF" case + + var minChar = cur.minChar; + var limChar = cur.limChar + (inclusive ? 1 : 0) + if (pos >= minChar && pos < limChar) { + + // TODO: Since AST is sometimes not correct wrt to position, only add "cur" if it's better + // than top of the stack. + var previous = ctx.path.ast(); + if (previous == null || (cur.minChar >= previous.minChar && cur.limChar <= previous.limChar)) { + ctx.path.push(cur); + } + else { + //logger.log("TODO: Ignoring node because minChar, limChar not better than previous node in stack"); + } + } + + // The AST walker skips comments, but we might be in one, so check the pre/post comments for this node manually + if (pos < limChar) { + lookInComments(cur.preComments); + } + if (pos >= minChar) { + lookInComments(cur.postComments); + } + + if (!hasFlag(options, GetAstPathOptions.DontPruneSearchBasedOnPosition)) { + // Don't go further down the tree if pos is outside of [minChar, limChar] + walker.options.goChildren = (minChar <= pos && pos <= limChar); + } + } + return cur; + } + + var ctx = new AstPathContext(); + TypeScript.getAstWalkerFactory().walk(script, pre, null, null, ctx); + return ctx.path; + } + + // + // Find a source text offset that is safe for lexing tokens at the given position. + // This is used when "position" might be inside a comment or string, etc. + // + export function getTokenizationOffset(script: TypeScript.Script, position: number): number { + var bestOffset = 0; + var pre = (cur: TypeScript.AST, parent: TypeScript.AST, walker: TypeScript.IAstWalker): TypeScript.AST => { + if (TypeScript.isValidAstNode(cur)) { + // Did we find a closer offset? + if (cur.minChar <= position) { + bestOffset = max(bestOffset, cur.minChar); + } + + // Stop the walk if this node is not related to "minChar" + if (cur.minChar > position || cur.limChar < bestOffset) { + walker.options.goChildren = false; + } + } + + return cur; + } + + TypeScript.getAstWalkerFactory().walk(script, pre); + return bestOffset; + } + + /// + /// Simple function to Walk an AST using a simple callback function. + /// + export function walkAST(ast: TypeScript.AST, callback: (path: AstPath, walker: TypeScript.IAstWalker) => void ): void { + var pre = function (cur: TypeScript.AST, parent: TypeScript.AST, walker: TypeScript.IAstWalker) { + var path: TypeScript.AstPath = walker.state; + path.push(cur); + callback(path, walker); + return cur; + } + var post = function (cur: TypeScript.AST, parent: TypeScript.AST, walker: TypeScript.IAstWalker) { + var path: TypeScript.AstPath = walker.state; + path.pop(); + return cur; + } + + var path = new AstPath(); + TypeScript.getAstWalkerFactory().walk(ast, pre, post, null, path); + } +} + + +//// [parserRealSource14.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + function lastOf(items) { + return (items === null || items.length === 0) ? null : items[items.length - 1]; + } + TypeScript.lastOf = lastOf; + function max(a, b) { + return a >= b ? a : b; + } + TypeScript.max = max; + function min(a, b) { + return a <= b ? a : b; + } + TypeScript.min = min; + // + // Helper class representing a path from a root ast node to a (grand)child ast node. + // This is helpful as our tree don't have parents. + // + var AstPath = (function () { + function AstPath() { + this.asts = []; + this.top = -1; + } + AstPath.reverseIndexOf = function (items, index) { + return (items === null || items.length <= index) ? null : items[items.length - index - 1]; + }; + AstPath.prototype.clone = function () { + var clone = new AstPath(); + clone.asts = this.asts.map(function (value) { + return value; + }); + clone.top = this.top; + return clone; + }; + AstPath.prototype.pop = function () { + var head = this.ast(); + this.up(); + while (this.asts.length > this.count()) { + this.asts.pop(); + } + return head; + }; + AstPath.prototype.push = function (ast) { + while (this.asts.length > this.count()) { + this.asts.pop(); + } + this.top = this.asts.length; + this.asts.push(ast); + }; + AstPath.prototype.up = function () { + if (this.top <= -1) + throw new Error("Invalid call to 'up'"); + this.top--; + }; + AstPath.prototype.down = function () { + if (this.top == this.ast.length - 1) + throw new Error("Invalid call to 'down'"); + this.top++; + }; + AstPath.prototype.nodeType = function () { + if (this.ast() == null) + return TypeScript.NodeType.None; + return this.ast().nodeType; + }; + AstPath.prototype.ast = function () { + return AstPath.reverseIndexOf(this.asts, this.asts.length - (this.top + 1)); + }; + AstPath.prototype.parent = function () { + return AstPath.reverseIndexOf(this.asts, this.asts.length - this.top); + }; + AstPath.prototype.count = function () { + return this.top + 1; + }; + AstPath.prototype.get = function (index) { + return this.asts[index]; + }; + AstPath.prototype.isNameOfClass = function () { + if (this.ast() === null || this.parent() === null) + return false; + return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && (this.parent().name === this.ast()); + }; + AstPath.prototype.isNameOfInterface = function () { + if (this.ast() === null || this.parent() === null) + return false; + return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && (this.parent().name === this.ast()); + }; + AstPath.prototype.isNameOfArgument = function () { + if (this.ast() === null || this.parent() === null) + return false; + return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && (this.parent().id === this.ast()); + }; + AstPath.prototype.isNameOfVariable = function () { + if (this.ast() === null || this.parent() === null) + return false; + return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.VarDecl) && (this.parent().id === this.ast()); + }; + AstPath.prototype.isNameOfModule = function () { + if (this.ast() === null || this.parent() === null) + return false; + return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && (this.parent().name === this.ast()); + }; + AstPath.prototype.isNameOfFunction = function () { + if (this.ast() === null || this.parent() === null) + return false; + return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && (this.parent().name === this.ast()); + }; + AstPath.prototype.isChildOfScript = function () { + var ast = lastOf(this.asts); + return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; + }; + AstPath.prototype.isChildOfModule = function () { + var ast = lastOf(this.asts); + return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; + }; + AstPath.prototype.isChildOfClass = function () { + var ast = lastOf(this.asts); + return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; + }; + AstPath.prototype.isArgumentOfClassConstructor = function () { + var ast = lastOf(this.asts); + return this.count() >= 5 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && (this.asts[this.top - 2].isConstructor) && (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); + }; + AstPath.prototype.isChildOfInterface = function () { + var ast = lastOf(this.asts); + return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; + }; + AstPath.prototype.isTopLevelImplicitModule = function () { + return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); + }; + AstPath.prototype.isBodyOfTopLevelImplicitModule = function () { + return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0] && TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); + }; + AstPath.prototype.isBodyOfScript = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfSwitch = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].caseList == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfModule = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfClass = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfFunction = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfInterface = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfBlock = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 1].statements == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfFor = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfCase = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfTry = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfCatch = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfDoWhile = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfWhile = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfForIn = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfWith = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfFinally = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && this.asts[this.top - 1].body == this.asts[this.top - 0]; + }; + AstPath.prototype.isCaseOfSwitch = function () { + return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1]; + }; + AstPath.prototype.isDefaultCaseOfSwitch = function () { + return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1] && this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; + }; + AstPath.prototype.isListOfObjectLit = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfObjectLit = function () { + return this.isListOfObjectLit(); + }; + AstPath.prototype.isEmptyListOfObjectLit = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0] && this.asts[this.top - 0].members.length == 0; + }; + AstPath.prototype.isMemberOfObjectLit = function () { + return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 2].operand == this.asts[this.top - 1]; + }; + AstPath.prototype.isNameOfMemberOfObjectLit = function () { + return this.count() >= 4 && this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && this.asts[this.top - 3].operand == this.asts[this.top - 2]; + }; + AstPath.prototype.isListOfArrayLit = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + }; + AstPath.prototype.isTargetOfMember = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; + }; + AstPath.prototype.isMemberOfMember = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; + }; + AstPath.prototype.isItemOfList = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; + //(this.asts[this.top - 1]).operand2 === this.asts[this.top - 0]; + }; + AstPath.prototype.isThenOfIf = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; + }; + AstPath.prototype.isElseOfIf = function () { + return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; + }; + AstPath.prototype.isBodyOfDefaultCase = function () { + return this.isBodyOfCase(); + }; + AstPath.prototype.isSingleStatementList = function () { + return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.List && this.asts[this.top].members.length === 1; + }; + AstPath.prototype.isArgumentListOfFunction = function () { + return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + }; + AstPath.prototype.isArgumentOfFunction = function () { + return this.count() >= 3 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 2].arguments === this.asts[this.top - 1]; + }; + AstPath.prototype.isArgumentListOfCall = function () { + return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + }; + AstPath.prototype.isArgumentListOfNew = function () { + return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + }; + AstPath.prototype.isSynthesizedBlock = function () { + return this.count() >= 1 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 0].isStatementBlock === false; + }; + return AstPath; + })(); + TypeScript.AstPath = AstPath; + function isValidAstNode(ast) { + if (ast === null) + return false; + if (ast.minChar === -1 || ast.limChar === -1) + return false; + return true; + } + TypeScript.isValidAstNode = isValidAstNode; + var AstPathContext = (function () { + function AstPathContext() { + this.path = new TypeScript.AstPath(); + } + return AstPathContext; + })(); + TypeScript.AstPathContext = AstPathContext; + (function (GetAstPathOptions) { + GetAstPathOptions[GetAstPathOptions["Default"] = 0] = "Default"; + GetAstPathOptions[GetAstPathOptions["EdgeInclusive"] = 1] = "EdgeInclusive"; + //We need this options dealing with an AST coming from an incomplete AST. For example: + // class foo { // r + // If we ask for the AST at the position after the "r" character, we won't see we are + // inside a comment, because the "class" AST node has a limChar corresponding to the position of + // the "{" character, meaning we don't traverse the tree down to the stmt list of the class, meaning + // we don't find the "precomment" attached to the errorneous empty stmt. + //TODO: It would be nice to be able to get rid of this. + GetAstPathOptions[GetAstPathOptions["DontPruneSearchBasedOnPosition"] = 1 << 1] = "DontPruneSearchBasedOnPosition"; + })(TypeScript.GetAstPathOptions || (TypeScript.GetAstPathOptions = {})); + var GetAstPathOptions = TypeScript.GetAstPathOptions; + /// + /// Return the stack of AST nodes containing "position" + /// + function getAstPathToPosition(script, pos, options) { + if (options === void 0) { options = 0 /* Default */; } + var lookInComments = function (comments) { + if (comments && comments.length > 0) { + for (var i = 0; i < comments.length; i++) { + var minChar = comments[i].minChar; + var limChar = comments[i].limChar; + if (!comments[i].isBlockComment) { + limChar++; // For single line comments, include 1 more character (for the newline) + } + if (pos >= minChar && pos < limChar) { + ctx.path.push(comments[i]); + } + } + } + }; + var pre = function (cur, parent, walker) { + if (isValidAstNode(cur)) { + // Add "cur" to the stack if it contains our position + // For "identifier" nodes, we need a special case: A position equal to "limChar" is + // valid, since the position corresponds to a caret position (in between characters) + // For example: + // bar + // 0123 + // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid + var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case + var minChar = cur.minChar; + var limChar = cur.limChar + (inclusive ? 1 : 0); + if (pos >= minChar && pos < limChar) { + // TODO: Since AST is sometimes not correct wrt to position, only add "cur" if it's better + // than top of the stack. + var previous = ctx.path.ast(); + if (previous == null || (cur.minChar >= previous.minChar && cur.limChar <= previous.limChar)) { + ctx.path.push(cur); + } + else { + } + } + // The AST walker skips comments, but we might be in one, so check the pre/post comments for this node manually + if (pos < limChar) { + lookInComments(cur.preComments); + } + if (pos >= minChar) { + lookInComments(cur.postComments); + } + if (!hasFlag(options, GetAstPathOptions.DontPruneSearchBasedOnPosition)) { + // Don't go further down the tree if pos is outside of [minChar, limChar] + walker.options.goChildren = (minChar <= pos && pos <= limChar); + } + } + return cur; + }; + var ctx = new AstPathContext(); + TypeScript.getAstWalkerFactory().walk(script, pre, null, null, ctx); + return ctx.path; + } + TypeScript.getAstPathToPosition = getAstPathToPosition; + // + // Find a source text offset that is safe for lexing tokens at the given position. + // This is used when "position" might be inside a comment or string, etc. + // + function getTokenizationOffset(script, position) { + var bestOffset = 0; + var pre = function (cur, parent, walker) { + if (TypeScript.isValidAstNode(cur)) { + // Did we find a closer offset? + if (cur.minChar <= position) { + bestOffset = max(bestOffset, cur.minChar); + } + // Stop the walk if this node is not related to "minChar" + if (cur.minChar > position || cur.limChar < bestOffset) { + walker.options.goChildren = false; + } + } + return cur; + }; + TypeScript.getAstWalkerFactory().walk(script, pre); + return bestOffset; + } + TypeScript.getTokenizationOffset = getTokenizationOffset; + /// + /// Simple function to Walk an AST using a simple callback function. + /// + function walkAST(ast, callback) { + var pre = function (cur, parent, walker) { + var path = walker.state; + path.push(cur); + callback(path, walker); + return cur; + }; + var post = function (cur, parent, walker) { + var path = walker.state; + path.pop(); + return cur; + }; + var path = new AstPath(); + TypeScript.getAstWalkerFactory().walk(ast, pre, post, null, path); + } + TypeScript.walkAST = walkAST; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource2.js b/tests/baselines/reference/parserRealSource2.js new file mode 100644 index 00000000000..0dbe7dfef40 --- /dev/null +++ b/tests/baselines/reference/parserRealSource2.js @@ -0,0 +1,534 @@ +//// [parserRealSource2.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + + export function hasFlag(val: number, flag: number) { + return (val & flag) != 0; + } + + export enum ErrorRecoverySet { + None = 0, + Comma = 1, // Comma + SColon = 1 << 1, // SColon + Asg = 1 << 2, // Asg + BinOp = 1 << 3, // Lsh, Rsh, Rs2, Le, Ge, INSTANCEOF, EQ, NE, Eqv, NEqv, LogAnd, LogOr, AsgMul, AsgDiv + // AsgMod, AsgAdd, AsgSub, AsgLsh, AsgRsh, AsgRs2, AsgAnd, AsgXor, AsgOr, QMark, Mult, Div, + // Pct, GT, LT, And, Xor, Or + RBrack = 1 << 4, // RBrack + RCurly = 1 << 5, // RCurly + RParen = 1 << 6, // RParen + Dot = 1 << 7, // Dot + Colon = 1 << 8, // Colon + PrimType = 1 << 9, // number, string, boolean + AddOp = 1 << 10, // Add, Sub + LCurly = 1 << 11, // LCurly + PreOp = 1 << 12, // Tilde, Bang, Inc, Dec + RegExp = 1 << 13, // RegExp + LParen = 1 << 14, // LParen + LBrack = 1 << 15, // LBrack + Scope = 1 << 16, // Scope + In = 1 << 17, // IN + SCase = 1 << 18, // CASE, DEFAULT + Else = 1 << 19, // ELSE + Catch = 1 << 20, // CATCH, FINALLY + Var = 1 << 21, // + Stmt = 1 << 22, // BREAK, RETURN, THROW, DEBUGGER, FOR, SWITCH, DO, IF, TRY, WITH + While = 1 << 23, // WHILE + ID = 1 << 24, // ID + Prefix = 1 << 25, // VOID, DELETE, TYPEOF, AWAIT + Literal = 1 << 26, // IntCon, FltCon, StrCon + RLit = 1 << 27, // THIS, TRUE, FALSE, NULL + Func = 1 << 28, // FUNCTION + EOF = 1 << 29, // EOF + + // REVIEW: Name this something clearer. + TypeScriptS = 1 << 30, // PROPERTY, PRIVATE, STATIC, INTERFACE, CLASS, MODULE, EXPORT, IMPORT + ExprStart = SColon | AddOp | LCurly | PreOp | RegExp | LParen | LBrack | ID | Prefix | RLit | Func | Literal, + StmtStart = ExprStart | SColon | Var | Stmt | While | TypeScriptS, + Postfix = Dot | LParen | LBrack, + } + + export enum AllowedElements { + None = 0, + ModuleDeclarations = 1 << 2, + ClassDeclarations = 1 << 3, + InterfaceDeclarations = 1 << 4, + AmbientDeclarations = 1 << 10, + Properties = 1 << 11, + + Global = ModuleDeclarations | ClassDeclarations | InterfaceDeclarations | AmbientDeclarations, + QuickParse = Global | Properties, + } + + export enum Modifiers { + None = 0, + Private = 1, + Public = 1 << 1, + Readonly = 1 << 2, + Ambient = 1 << 3, + Exported = 1 << 4, + Getter = 1 << 5, + Setter = 1 << 6, + Static = 1 << 7, + } + + export enum ASTFlags { + None = 0, + ExplicitSemicolon = 1, // statment terminated by an explicit semicolon + AutomaticSemicolon = 1 << 1, // statment terminated by an automatic semicolon + Writeable = 1 << 2, // node is lhs that can be modified + Error = 1 << 3, // node has an error + DotLHSPartial = 1 << 4, // node is the lhs of an incomplete dot expr at cursor + DotLHS = 1 << 5, // node is the lhs of a dot expr + IsStatement = 1 << 6, // node is a statement + StrictMode = 1 << 7, // node is in the strict mode environment + PossibleOptionalParameter = 1 << 8, + ClassBaseConstructorCall = 1 << 9, + OptionalName = 1 << 10, + // REVIEW: This flag is to mark lambda nodes to note that the LParen of an expression has already been matched in the lambda header. + // The flag is used to communicate this piece of information to the calling parseTerm, which intern will remove it. + // Once we have a better way to associate information with nodes, this flag should not be used. + SkipNextRParen = 1 << 11, + } + + export enum DeclFlags { + None = 0, + Exported = 1, + Private = 1 << 1, + Public = 1 << 2, + Ambient = 1 << 3, + Static = 1 << 4, + LocalStatic = 1 << 5, + GetAccessor = 1 << 6, + SetAccessor = 1 << 7, + } + + export enum ModuleFlags { + None = 0, + Exported = 1, + Private = 1 << 1, + Public = 1 << 2, + Ambient = 1 << 3, + Static = 1 << 4, + LocalStatic = 1 << 5, + GetAccessor = 1 << 6, + SetAccessor = 1 << 7, + IsEnum = 1 << 8, + ShouldEmitModuleDecl = 1 << 9, + IsWholeFile = 1 << 10, + IsDynamic = 1 << 11, + MustCaptureThis = 1 << 12, + } + + export enum SymbolFlags { + None = 0, + Exported = 1, + Private = 1 << 1, + Public = 1 << 2, + Ambient = 1 << 3, + Static = 1 << 4, + LocalStatic = 1 << 5, + GetAccessor = 1 << 6, + SetAccessor = 1 << 7, + Property = 1 << 8, + Readonly = 1 << 9, + ModuleMember = 1 << 10, + InterfaceMember = 1 << 11, + ClassMember = 1 << 12, + BuiltIn = 1 << 13, + TypeSetDuringScopeAssignment = 1 << 14, + Constant = 1 << 15, + Optional = 1 << 16, + RecursivelyReferenced = 1 << 17, + Bound = 1 << 18, + CompilerGenerated = 1 << 19, + } + + export enum VarFlags { + None = 0, + Exported = 1, + Private = 1 << 1, + Public = 1 << 2, + Ambient = 1 << 3, + Static = 1 << 4, + LocalStatic = 1 << 5, + GetAccessor = 1 << 6, + SetAccessor = 1 << 7, + AutoInit = 1 << 8, + Property = 1 << 9, + Readonly = 1 << 10, + Class = 1 << 11, + ClassProperty = 1 << 12, + ClassBodyProperty = 1 << 13, + ClassConstructorProperty = 1 << 14, + ClassSuperMustBeFirstCallInConstructor = 1 << 15, + Constant = 1 << 16, + MustCaptureThis = 1 << 17, + } + + export enum FncFlags { + None = 0, + Exported = 1, + Private = 1 << 1, + Public = 1 << 2, + Ambient = 1 << 3, + Static = 1 << 4, + LocalStatic = 1 << 5, + GetAccessor = 1 << 6, + SetAccessor = 1 << 7, + Definition = 1 << 8, + Signature = 1 << 9, + Method = 1 << 10, + HasReturnExpression = 1 << 11, + CallMember = 1 << 12, + ConstructMember = 1 << 13, + HasSelfReference = 1 << 14, + IsFatArrowFunction = 1 << 15, + IndexerMember = 1 << 16, + IsFunctionExpression = 1 << 17, + ClassMethod = 1 << 18, + ClassPropertyMethodExported = 1 << 19, + } + + export enum SignatureFlags { + None = 0, + IsIndexer = 1, + IsStringIndexer = 1 << 1, + IsNumberIndexer = 1 << 2, + } + + export function ToDeclFlags(fncFlags: FncFlags) : DeclFlags; + export function ToDeclFlags(varFlags: VarFlags) : DeclFlags; + export function ToDeclFlags(symFlags: SymbolFlags): DeclFlags; + export function ToDeclFlags(moduleFlags: ModuleFlags): DeclFlags; + export function ToDeclFlags(fncOrVarOrSymbolOrModuleFlags: any) { + return fncOrVarOrSymbolOrModuleFlags; + } + + export enum TypeFlags { + None = 0, + HasImplementation = 1, + HasSelfReference = 1 << 1, + MergeResult = 1 << 2, + IsEnum = 1 << 3, + BuildingName = 1 << 4, + HasBaseType = 1 << 5, + HasBaseTypeOfObject = 1 << 6, + IsClass = 1 << 7, + } + + export enum TypeRelationshipFlags { + SuccessfulComparison = 0, + SourceIsNullTargetIsVoidOrUndefined = 1, + RequiredPropertyIsMissing = 1 << 1, + IncompatibleSignatures = 1 << 2, + SourceSignatureHasTooManyParameters = 3, + IncompatibleReturnTypes = 1 << 4, + IncompatiblePropertyTypes = 1 << 5, + IncompatibleParameterTypes = 1 << 6, + } + + export enum CodeGenTarget { + ES3 = 0, + ES5 = 1, + } + + export enum ModuleGenTarget { + Synchronous = 0, + Asynchronous = 1, + Local = 1 << 1, + } + + // Compiler defaults to generating ES5-compliant code for + // - getters and setters + export var codeGenTarget: CodeGenTarget = CodeGenTarget.ES3; + + export var moduleGenTarget: ModuleGenTarget = ModuleGenTarget.Synchronous; + + export var optimizeModuleCodeGen = true; + + export function flagsToString(e, flags: number): string { + var builder = ""; + for (var i = 1; i < (1 << 31) ; i = i << 1) { + if ((flags & i) != 0) { + for (var k in e) { + if (e[k] == i) { + if (builder.length > 0) { + builder += "|"; + } + builder += k; + break; + } + } + } + } + return builder; + } + +} + +//// [parserRealSource2.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + function hasFlag(val, flag) { + return (val & flag) != 0; + } + TypeScript.hasFlag = hasFlag; + (function (ErrorRecoverySet) { + ErrorRecoverySet[ErrorRecoverySet["None"] = 0] = "None"; + ErrorRecoverySet[ErrorRecoverySet["Comma"] = 1] = "Comma"; + ErrorRecoverySet[ErrorRecoverySet["SColon"] = 1 << 1] = "SColon"; + ErrorRecoverySet[ErrorRecoverySet["Asg"] = 1 << 2] = "Asg"; + ErrorRecoverySet[ErrorRecoverySet["BinOp"] = 1 << 3] = "BinOp"; + // AsgMod, AsgAdd, AsgSub, AsgLsh, AsgRsh, AsgRs2, AsgAnd, AsgXor, AsgOr, QMark, Mult, Div, + // Pct, GT, LT, And, Xor, Or + ErrorRecoverySet[ErrorRecoverySet["RBrack"] = 1 << 4] = "RBrack"; + ErrorRecoverySet[ErrorRecoverySet["RCurly"] = 1 << 5] = "RCurly"; + ErrorRecoverySet[ErrorRecoverySet["RParen"] = 1 << 6] = "RParen"; + ErrorRecoverySet[ErrorRecoverySet["Dot"] = 1 << 7] = "Dot"; + ErrorRecoverySet[ErrorRecoverySet["Colon"] = 1 << 8] = "Colon"; + ErrorRecoverySet[ErrorRecoverySet["PrimType"] = 1 << 9] = "PrimType"; + ErrorRecoverySet[ErrorRecoverySet["AddOp"] = 1 << 10] = "AddOp"; + ErrorRecoverySet[ErrorRecoverySet["LCurly"] = 1 << 11] = "LCurly"; + ErrorRecoverySet[ErrorRecoverySet["PreOp"] = 1 << 12] = "PreOp"; + ErrorRecoverySet[ErrorRecoverySet["RegExp"] = 1 << 13] = "RegExp"; + ErrorRecoverySet[ErrorRecoverySet["LParen"] = 1 << 14] = "LParen"; + ErrorRecoverySet[ErrorRecoverySet["LBrack"] = 1 << 15] = "LBrack"; + ErrorRecoverySet[ErrorRecoverySet["Scope"] = 1 << 16] = "Scope"; + ErrorRecoverySet[ErrorRecoverySet["In"] = 1 << 17] = "In"; + ErrorRecoverySet[ErrorRecoverySet["SCase"] = 1 << 18] = "SCase"; + ErrorRecoverySet[ErrorRecoverySet["Else"] = 1 << 19] = "Else"; + ErrorRecoverySet[ErrorRecoverySet["Catch"] = 1 << 20] = "Catch"; + ErrorRecoverySet[ErrorRecoverySet["Var"] = 1 << 21] = "Var"; + ErrorRecoverySet[ErrorRecoverySet["Stmt"] = 1 << 22] = "Stmt"; + ErrorRecoverySet[ErrorRecoverySet["While"] = 1 << 23] = "While"; + ErrorRecoverySet[ErrorRecoverySet["ID"] = 1 << 24] = "ID"; + ErrorRecoverySet[ErrorRecoverySet["Prefix"] = 1 << 25] = "Prefix"; + ErrorRecoverySet[ErrorRecoverySet["Literal"] = 1 << 26] = "Literal"; + ErrorRecoverySet[ErrorRecoverySet["RLit"] = 1 << 27] = "RLit"; + ErrorRecoverySet[ErrorRecoverySet["Func"] = 1 << 28] = "Func"; + ErrorRecoverySet[ErrorRecoverySet["EOF"] = 1 << 29] = "EOF"; + // REVIEW: Name this something clearer. + ErrorRecoverySet[ErrorRecoverySet["TypeScriptS"] = 1 << 30] = "TypeScriptS"; + ErrorRecoverySet[ErrorRecoverySet["ExprStart"] = ErrorRecoverySet.SColon | ErrorRecoverySet.AddOp | ErrorRecoverySet.LCurly | ErrorRecoverySet.PreOp | ErrorRecoverySet.RegExp | ErrorRecoverySet.LParen | ErrorRecoverySet.LBrack | ErrorRecoverySet.ID | ErrorRecoverySet.Prefix | ErrorRecoverySet.RLit | ErrorRecoverySet.Func | ErrorRecoverySet.Literal] = "ExprStart"; + ErrorRecoverySet[ErrorRecoverySet["StmtStart"] = ErrorRecoverySet.ExprStart | ErrorRecoverySet.SColon | ErrorRecoverySet.Var | ErrorRecoverySet.Stmt | ErrorRecoverySet.While | ErrorRecoverySet.TypeScriptS] = "StmtStart"; + ErrorRecoverySet[ErrorRecoverySet["Postfix"] = ErrorRecoverySet.Dot | ErrorRecoverySet.LParen | ErrorRecoverySet.LBrack] = "Postfix"; + })(TypeScript.ErrorRecoverySet || (TypeScript.ErrorRecoverySet = {})); + var ErrorRecoverySet = TypeScript.ErrorRecoverySet; + (function (AllowedElements) { + AllowedElements[AllowedElements["None"] = 0] = "None"; + AllowedElements[AllowedElements["ModuleDeclarations"] = 1 << 2] = "ModuleDeclarations"; + AllowedElements[AllowedElements["ClassDeclarations"] = 1 << 3] = "ClassDeclarations"; + AllowedElements[AllowedElements["InterfaceDeclarations"] = 1 << 4] = "InterfaceDeclarations"; + AllowedElements[AllowedElements["AmbientDeclarations"] = 1 << 10] = "AmbientDeclarations"; + AllowedElements[AllowedElements["Properties"] = 1 << 11] = "Properties"; + AllowedElements[AllowedElements["Global"] = AllowedElements.ModuleDeclarations | AllowedElements.ClassDeclarations | AllowedElements.InterfaceDeclarations | AllowedElements.AmbientDeclarations] = "Global"; + AllowedElements[AllowedElements["QuickParse"] = AllowedElements.Global | AllowedElements.Properties] = "QuickParse"; + })(TypeScript.AllowedElements || (TypeScript.AllowedElements = {})); + var AllowedElements = TypeScript.AllowedElements; + (function (Modifiers) { + Modifiers[Modifiers["None"] = 0] = "None"; + Modifiers[Modifiers["Private"] = 1] = "Private"; + Modifiers[Modifiers["Public"] = 1 << 1] = "Public"; + Modifiers[Modifiers["Readonly"] = 1 << 2] = "Readonly"; + Modifiers[Modifiers["Ambient"] = 1 << 3] = "Ambient"; + Modifiers[Modifiers["Exported"] = 1 << 4] = "Exported"; + Modifiers[Modifiers["Getter"] = 1 << 5] = "Getter"; + Modifiers[Modifiers["Setter"] = 1 << 6] = "Setter"; + Modifiers[Modifiers["Static"] = 1 << 7] = "Static"; + })(TypeScript.Modifiers || (TypeScript.Modifiers = {})); + var Modifiers = TypeScript.Modifiers; + (function (ASTFlags) { + ASTFlags[ASTFlags["None"] = 0] = "None"; + ASTFlags[ASTFlags["ExplicitSemicolon"] = 1] = "ExplicitSemicolon"; + ASTFlags[ASTFlags["AutomaticSemicolon"] = 1 << 1] = "AutomaticSemicolon"; + ASTFlags[ASTFlags["Writeable"] = 1 << 2] = "Writeable"; + ASTFlags[ASTFlags["Error"] = 1 << 3] = "Error"; + ASTFlags[ASTFlags["DotLHSPartial"] = 1 << 4] = "DotLHSPartial"; + ASTFlags[ASTFlags["DotLHS"] = 1 << 5] = "DotLHS"; + ASTFlags[ASTFlags["IsStatement"] = 1 << 6] = "IsStatement"; + ASTFlags[ASTFlags["StrictMode"] = 1 << 7] = "StrictMode"; + ASTFlags[ASTFlags["PossibleOptionalParameter"] = 1 << 8] = "PossibleOptionalParameter"; + ASTFlags[ASTFlags["ClassBaseConstructorCall"] = 1 << 9] = "ClassBaseConstructorCall"; + ASTFlags[ASTFlags["OptionalName"] = 1 << 10] = "OptionalName"; + // REVIEW: This flag is to mark lambda nodes to note that the LParen of an expression has already been matched in the lambda header. + // The flag is used to communicate this piece of information to the calling parseTerm, which intern will remove it. + // Once we have a better way to associate information with nodes, this flag should not be used. + ASTFlags[ASTFlags["SkipNextRParen"] = 1 << 11] = "SkipNextRParen"; + })(TypeScript.ASTFlags || (TypeScript.ASTFlags = {})); + var ASTFlags = TypeScript.ASTFlags; + (function (DeclFlags) { + DeclFlags[DeclFlags["None"] = 0] = "None"; + DeclFlags[DeclFlags["Exported"] = 1] = "Exported"; + DeclFlags[DeclFlags["Private"] = 1 << 1] = "Private"; + DeclFlags[DeclFlags["Public"] = 1 << 2] = "Public"; + DeclFlags[DeclFlags["Ambient"] = 1 << 3] = "Ambient"; + DeclFlags[DeclFlags["Static"] = 1 << 4] = "Static"; + DeclFlags[DeclFlags["LocalStatic"] = 1 << 5] = "LocalStatic"; + DeclFlags[DeclFlags["GetAccessor"] = 1 << 6] = "GetAccessor"; + DeclFlags[DeclFlags["SetAccessor"] = 1 << 7] = "SetAccessor"; + })(TypeScript.DeclFlags || (TypeScript.DeclFlags = {})); + var DeclFlags = TypeScript.DeclFlags; + (function (ModuleFlags) { + ModuleFlags[ModuleFlags["None"] = 0] = "None"; + ModuleFlags[ModuleFlags["Exported"] = 1] = "Exported"; + ModuleFlags[ModuleFlags["Private"] = 1 << 1] = "Private"; + ModuleFlags[ModuleFlags["Public"] = 1 << 2] = "Public"; + ModuleFlags[ModuleFlags["Ambient"] = 1 << 3] = "Ambient"; + ModuleFlags[ModuleFlags["Static"] = 1 << 4] = "Static"; + ModuleFlags[ModuleFlags["LocalStatic"] = 1 << 5] = "LocalStatic"; + ModuleFlags[ModuleFlags["GetAccessor"] = 1 << 6] = "GetAccessor"; + ModuleFlags[ModuleFlags["SetAccessor"] = 1 << 7] = "SetAccessor"; + ModuleFlags[ModuleFlags["IsEnum"] = 1 << 8] = "IsEnum"; + ModuleFlags[ModuleFlags["ShouldEmitModuleDecl"] = 1 << 9] = "ShouldEmitModuleDecl"; + ModuleFlags[ModuleFlags["IsWholeFile"] = 1 << 10] = "IsWholeFile"; + ModuleFlags[ModuleFlags["IsDynamic"] = 1 << 11] = "IsDynamic"; + ModuleFlags[ModuleFlags["MustCaptureThis"] = 1 << 12] = "MustCaptureThis"; + })(TypeScript.ModuleFlags || (TypeScript.ModuleFlags = {})); + var ModuleFlags = TypeScript.ModuleFlags; + (function (SymbolFlags) { + SymbolFlags[SymbolFlags["None"] = 0] = "None"; + SymbolFlags[SymbolFlags["Exported"] = 1] = "Exported"; + SymbolFlags[SymbolFlags["Private"] = 1 << 1] = "Private"; + SymbolFlags[SymbolFlags["Public"] = 1 << 2] = "Public"; + SymbolFlags[SymbolFlags["Ambient"] = 1 << 3] = "Ambient"; + SymbolFlags[SymbolFlags["Static"] = 1 << 4] = "Static"; + SymbolFlags[SymbolFlags["LocalStatic"] = 1 << 5] = "LocalStatic"; + SymbolFlags[SymbolFlags["GetAccessor"] = 1 << 6] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 1 << 7] = "SetAccessor"; + SymbolFlags[SymbolFlags["Property"] = 1 << 8] = "Property"; + SymbolFlags[SymbolFlags["Readonly"] = 1 << 9] = "Readonly"; + SymbolFlags[SymbolFlags["ModuleMember"] = 1 << 10] = "ModuleMember"; + SymbolFlags[SymbolFlags["InterfaceMember"] = 1 << 11] = "InterfaceMember"; + SymbolFlags[SymbolFlags["ClassMember"] = 1 << 12] = "ClassMember"; + SymbolFlags[SymbolFlags["BuiltIn"] = 1 << 13] = "BuiltIn"; + SymbolFlags[SymbolFlags["TypeSetDuringScopeAssignment"] = 1 << 14] = "TypeSetDuringScopeAssignment"; + SymbolFlags[SymbolFlags["Constant"] = 1 << 15] = "Constant"; + SymbolFlags[SymbolFlags["Optional"] = 1 << 16] = "Optional"; + SymbolFlags[SymbolFlags["RecursivelyReferenced"] = 1 << 17] = "RecursivelyReferenced"; + SymbolFlags[SymbolFlags["Bound"] = 1 << 18] = "Bound"; + SymbolFlags[SymbolFlags["CompilerGenerated"] = 1 << 19] = "CompilerGenerated"; + })(TypeScript.SymbolFlags || (TypeScript.SymbolFlags = {})); + var SymbolFlags = TypeScript.SymbolFlags; + (function (VarFlags) { + VarFlags[VarFlags["None"] = 0] = "None"; + VarFlags[VarFlags["Exported"] = 1] = "Exported"; + VarFlags[VarFlags["Private"] = 1 << 1] = "Private"; + VarFlags[VarFlags["Public"] = 1 << 2] = "Public"; + VarFlags[VarFlags["Ambient"] = 1 << 3] = "Ambient"; + VarFlags[VarFlags["Static"] = 1 << 4] = "Static"; + VarFlags[VarFlags["LocalStatic"] = 1 << 5] = "LocalStatic"; + VarFlags[VarFlags["GetAccessor"] = 1 << 6] = "GetAccessor"; + VarFlags[VarFlags["SetAccessor"] = 1 << 7] = "SetAccessor"; + VarFlags[VarFlags["AutoInit"] = 1 << 8] = "AutoInit"; + VarFlags[VarFlags["Property"] = 1 << 9] = "Property"; + VarFlags[VarFlags["Readonly"] = 1 << 10] = "Readonly"; + VarFlags[VarFlags["Class"] = 1 << 11] = "Class"; + VarFlags[VarFlags["ClassProperty"] = 1 << 12] = "ClassProperty"; + VarFlags[VarFlags["ClassBodyProperty"] = 1 << 13] = "ClassBodyProperty"; + VarFlags[VarFlags["ClassConstructorProperty"] = 1 << 14] = "ClassConstructorProperty"; + VarFlags[VarFlags["ClassSuperMustBeFirstCallInConstructor"] = 1 << 15] = "ClassSuperMustBeFirstCallInConstructor"; + VarFlags[VarFlags["Constant"] = 1 << 16] = "Constant"; + VarFlags[VarFlags["MustCaptureThis"] = 1 << 17] = "MustCaptureThis"; + })(TypeScript.VarFlags || (TypeScript.VarFlags = {})); + var VarFlags = TypeScript.VarFlags; + (function (FncFlags) { + FncFlags[FncFlags["None"] = 0] = "None"; + FncFlags[FncFlags["Exported"] = 1] = "Exported"; + FncFlags[FncFlags["Private"] = 1 << 1] = "Private"; + FncFlags[FncFlags["Public"] = 1 << 2] = "Public"; + FncFlags[FncFlags["Ambient"] = 1 << 3] = "Ambient"; + FncFlags[FncFlags["Static"] = 1 << 4] = "Static"; + FncFlags[FncFlags["LocalStatic"] = 1 << 5] = "LocalStatic"; + FncFlags[FncFlags["GetAccessor"] = 1 << 6] = "GetAccessor"; + FncFlags[FncFlags["SetAccessor"] = 1 << 7] = "SetAccessor"; + FncFlags[FncFlags["Definition"] = 1 << 8] = "Definition"; + FncFlags[FncFlags["Signature"] = 1 << 9] = "Signature"; + FncFlags[FncFlags["Method"] = 1 << 10] = "Method"; + FncFlags[FncFlags["HasReturnExpression"] = 1 << 11] = "HasReturnExpression"; + FncFlags[FncFlags["CallMember"] = 1 << 12] = "CallMember"; + FncFlags[FncFlags["ConstructMember"] = 1 << 13] = "ConstructMember"; + FncFlags[FncFlags["HasSelfReference"] = 1 << 14] = "HasSelfReference"; + FncFlags[FncFlags["IsFatArrowFunction"] = 1 << 15] = "IsFatArrowFunction"; + FncFlags[FncFlags["IndexerMember"] = 1 << 16] = "IndexerMember"; + FncFlags[FncFlags["IsFunctionExpression"] = 1 << 17] = "IsFunctionExpression"; + FncFlags[FncFlags["ClassMethod"] = 1 << 18] = "ClassMethod"; + FncFlags[FncFlags["ClassPropertyMethodExported"] = 1 << 19] = "ClassPropertyMethodExported"; + })(TypeScript.FncFlags || (TypeScript.FncFlags = {})); + var FncFlags = TypeScript.FncFlags; + (function (SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["IsIndexer"] = 1] = "IsIndexer"; + SignatureFlags[SignatureFlags["IsStringIndexer"] = 1 << 1] = "IsStringIndexer"; + SignatureFlags[SignatureFlags["IsNumberIndexer"] = 1 << 2] = "IsNumberIndexer"; + })(TypeScript.SignatureFlags || (TypeScript.SignatureFlags = {})); + var SignatureFlags = TypeScript.SignatureFlags; + function ToDeclFlags(fncOrVarOrSymbolOrModuleFlags) { + return fncOrVarOrSymbolOrModuleFlags; + } + TypeScript.ToDeclFlags = ToDeclFlags; + (function (TypeFlags) { + TypeFlags[TypeFlags["None"] = 0] = "None"; + TypeFlags[TypeFlags["HasImplementation"] = 1] = "HasImplementation"; + TypeFlags[TypeFlags["HasSelfReference"] = 1 << 1] = "HasSelfReference"; + TypeFlags[TypeFlags["MergeResult"] = 1 << 2] = "MergeResult"; + TypeFlags[TypeFlags["IsEnum"] = 1 << 3] = "IsEnum"; + TypeFlags[TypeFlags["BuildingName"] = 1 << 4] = "BuildingName"; + TypeFlags[TypeFlags["HasBaseType"] = 1 << 5] = "HasBaseType"; + TypeFlags[TypeFlags["HasBaseTypeOfObject"] = 1 << 6] = "HasBaseTypeOfObject"; + TypeFlags[TypeFlags["IsClass"] = 1 << 7] = "IsClass"; + })(TypeScript.TypeFlags || (TypeScript.TypeFlags = {})); + var TypeFlags = TypeScript.TypeFlags; + (function (TypeRelationshipFlags) { + TypeRelationshipFlags[TypeRelationshipFlags["SuccessfulComparison"] = 0] = "SuccessfulComparison"; + TypeRelationshipFlags[TypeRelationshipFlags["SourceIsNullTargetIsVoidOrUndefined"] = 1] = "SourceIsNullTargetIsVoidOrUndefined"; + TypeRelationshipFlags[TypeRelationshipFlags["RequiredPropertyIsMissing"] = 1 << 1] = "RequiredPropertyIsMissing"; + TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleSignatures"] = 1 << 2] = "IncompatibleSignatures"; + TypeRelationshipFlags[TypeRelationshipFlags["SourceSignatureHasTooManyParameters"] = 3] = "SourceSignatureHasTooManyParameters"; + TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleReturnTypes"] = 1 << 4] = "IncompatibleReturnTypes"; + TypeRelationshipFlags[TypeRelationshipFlags["IncompatiblePropertyTypes"] = 1 << 5] = "IncompatiblePropertyTypes"; + TypeRelationshipFlags[TypeRelationshipFlags["IncompatibleParameterTypes"] = 1 << 6] = "IncompatibleParameterTypes"; + })(TypeScript.TypeRelationshipFlags || (TypeScript.TypeRelationshipFlags = {})); + var TypeRelationshipFlags = TypeScript.TypeRelationshipFlags; + (function (CodeGenTarget) { + CodeGenTarget[CodeGenTarget["ES3"] = 0] = "ES3"; + CodeGenTarget[CodeGenTarget["ES5"] = 1] = "ES5"; + })(TypeScript.CodeGenTarget || (TypeScript.CodeGenTarget = {})); + var CodeGenTarget = TypeScript.CodeGenTarget; + (function (ModuleGenTarget) { + ModuleGenTarget[ModuleGenTarget["Synchronous"] = 0] = "Synchronous"; + ModuleGenTarget[ModuleGenTarget["Asynchronous"] = 1] = "Asynchronous"; + ModuleGenTarget[ModuleGenTarget["Local"] = 1 << 1] = "Local"; + })(TypeScript.ModuleGenTarget || (TypeScript.ModuleGenTarget = {})); + var ModuleGenTarget = TypeScript.ModuleGenTarget; + // Compiler defaults to generating ES5-compliant code for + // - getters and setters + TypeScript.codeGenTarget = 0 /* ES3 */; + TypeScript.moduleGenTarget = 0 /* Synchronous */; + TypeScript.optimizeModuleCodeGen = true; + function flagsToString(e, flags) { + var builder = ""; + for (var i = 1; i < (1 << 31); i = i << 1) { + if ((flags & i) != 0) { + for (var k in e) { + if (e[k] == i) { + if (builder.length > 0) { + builder += "|"; + } + builder += k; + break; + } + } + } + } + return builder; + } + TypeScript.flagsToString = flagsToString; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource3.js b/tests/baselines/reference/parserRealSource3.js new file mode 100644 index 00000000000..cfe6800fcf5 --- /dev/null +++ b/tests/baselines/reference/parserRealSource3.js @@ -0,0 +1,241 @@ +//// [parserRealSource3.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + // Note: Any addition to the NodeType should also be supported with addition to AstWalkerDetailCallback + export enum NodeType { + None, + Empty, + EmptyExpr, + True, + False, + This, + Super, + QString, + Regex, + Null, + ArrayLit, + ObjectLit, + Void, + Comma, + Pos, + Neg, + Delete, + Await, + In, + Dot, + From, + Is, + InstOf, + Typeof, + NumberLit, + Name, + TypeRef, + Index, + Call, + New, + Asg, + AsgAdd, + AsgSub, + AsgDiv, + AsgMul, + AsgMod, + AsgAnd, + AsgXor, + AsgOr, + AsgLsh, + AsgRsh, + AsgRs2, + ConditionalExpression, + LogOr, + LogAnd, + Or, + Xor, + And, + Eq, + Ne, + Eqv, + NEqv, + Lt, + Le, + Gt, + Ge, + Add, + Sub, + Mul, + Div, + Mod, + Lsh, + Rsh, + Rs2, + Not, + LogNot, + IncPre, + DecPre, + IncPost, + DecPost, + TypeAssertion, + FuncDecl, + Member, + VarDecl, + ArgDecl, + Return, + Break, + Continue, + Throw, + For, + ForIn, + If, + While, + DoWhile, + Block, + Case, + Switch, + Try, + TryCatch, + TryFinally, + Finally, + Catch, + List, + Script, + ClassDeclaration, + InterfaceDeclaration, + ModuleDeclaration, + ImportDeclaration, + With, + Label, + LabeledStatement, + EBStart, + GotoEB, + EndCode, + Error, + Comment, + Debugger, + GeneralNode = FuncDecl, + LastAsg = AsgRs2, + } +} + +//// [parserRealSource3.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + // Note: Any addition to the NodeType should also be supported with addition to AstWalkerDetailCallback + (function (NodeType) { + NodeType[NodeType["None"] = 0] = "None"; + NodeType[NodeType["Empty"] = 1] = "Empty"; + NodeType[NodeType["EmptyExpr"] = 2] = "EmptyExpr"; + NodeType[NodeType["True"] = 3] = "True"; + NodeType[NodeType["False"] = 4] = "False"; + NodeType[NodeType["This"] = 5] = "This"; + NodeType[NodeType["Super"] = 6] = "Super"; + NodeType[NodeType["QString"] = 7] = "QString"; + NodeType[NodeType["Regex"] = 8] = "Regex"; + NodeType[NodeType["Null"] = 9] = "Null"; + NodeType[NodeType["ArrayLit"] = 10] = "ArrayLit"; + NodeType[NodeType["ObjectLit"] = 11] = "ObjectLit"; + NodeType[NodeType["Void"] = 12] = "Void"; + NodeType[NodeType["Comma"] = 13] = "Comma"; + NodeType[NodeType["Pos"] = 14] = "Pos"; + NodeType[NodeType["Neg"] = 15] = "Neg"; + NodeType[NodeType["Delete"] = 16] = "Delete"; + NodeType[NodeType["Await"] = 17] = "Await"; + NodeType[NodeType["In"] = 18] = "In"; + NodeType[NodeType["Dot"] = 19] = "Dot"; + NodeType[NodeType["From"] = 20] = "From"; + NodeType[NodeType["Is"] = 21] = "Is"; + NodeType[NodeType["InstOf"] = 22] = "InstOf"; + NodeType[NodeType["Typeof"] = 23] = "Typeof"; + NodeType[NodeType["NumberLit"] = 24] = "NumberLit"; + NodeType[NodeType["Name"] = 25] = "Name"; + NodeType[NodeType["TypeRef"] = 26] = "TypeRef"; + NodeType[NodeType["Index"] = 27] = "Index"; + NodeType[NodeType["Call"] = 28] = "Call"; + NodeType[NodeType["New"] = 29] = "New"; + NodeType[NodeType["Asg"] = 30] = "Asg"; + NodeType[NodeType["AsgAdd"] = 31] = "AsgAdd"; + NodeType[NodeType["AsgSub"] = 32] = "AsgSub"; + NodeType[NodeType["AsgDiv"] = 33] = "AsgDiv"; + NodeType[NodeType["AsgMul"] = 34] = "AsgMul"; + NodeType[NodeType["AsgMod"] = 35] = "AsgMod"; + NodeType[NodeType["AsgAnd"] = 36] = "AsgAnd"; + NodeType[NodeType["AsgXor"] = 37] = "AsgXor"; + NodeType[NodeType["AsgOr"] = 38] = "AsgOr"; + NodeType[NodeType["AsgLsh"] = 39] = "AsgLsh"; + NodeType[NodeType["AsgRsh"] = 40] = "AsgRsh"; + NodeType[NodeType["AsgRs2"] = 41] = "AsgRs2"; + NodeType[NodeType["ConditionalExpression"] = 42] = "ConditionalExpression"; + NodeType[NodeType["LogOr"] = 43] = "LogOr"; + NodeType[NodeType["LogAnd"] = 44] = "LogAnd"; + NodeType[NodeType["Or"] = 45] = "Or"; + NodeType[NodeType["Xor"] = 46] = "Xor"; + NodeType[NodeType["And"] = 47] = "And"; + NodeType[NodeType["Eq"] = 48] = "Eq"; + NodeType[NodeType["Ne"] = 49] = "Ne"; + NodeType[NodeType["Eqv"] = 50] = "Eqv"; + NodeType[NodeType["NEqv"] = 51] = "NEqv"; + NodeType[NodeType["Lt"] = 52] = "Lt"; + NodeType[NodeType["Le"] = 53] = "Le"; + NodeType[NodeType["Gt"] = 54] = "Gt"; + NodeType[NodeType["Ge"] = 55] = "Ge"; + NodeType[NodeType["Add"] = 56] = "Add"; + NodeType[NodeType["Sub"] = 57] = "Sub"; + NodeType[NodeType["Mul"] = 58] = "Mul"; + NodeType[NodeType["Div"] = 59] = "Div"; + NodeType[NodeType["Mod"] = 60] = "Mod"; + NodeType[NodeType["Lsh"] = 61] = "Lsh"; + NodeType[NodeType["Rsh"] = 62] = "Rsh"; + NodeType[NodeType["Rs2"] = 63] = "Rs2"; + NodeType[NodeType["Not"] = 64] = "Not"; + NodeType[NodeType["LogNot"] = 65] = "LogNot"; + NodeType[NodeType["IncPre"] = 66] = "IncPre"; + NodeType[NodeType["DecPre"] = 67] = "DecPre"; + NodeType[NodeType["IncPost"] = 68] = "IncPost"; + NodeType[NodeType["DecPost"] = 69] = "DecPost"; + NodeType[NodeType["TypeAssertion"] = 70] = "TypeAssertion"; + NodeType[NodeType["FuncDecl"] = 71] = "FuncDecl"; + NodeType[NodeType["Member"] = 72] = "Member"; + NodeType[NodeType["VarDecl"] = 73] = "VarDecl"; + NodeType[NodeType["ArgDecl"] = 74] = "ArgDecl"; + NodeType[NodeType["Return"] = 75] = "Return"; + NodeType[NodeType["Break"] = 76] = "Break"; + NodeType[NodeType["Continue"] = 77] = "Continue"; + NodeType[NodeType["Throw"] = 78] = "Throw"; + NodeType[NodeType["For"] = 79] = "For"; + NodeType[NodeType["ForIn"] = 80] = "ForIn"; + NodeType[NodeType["If"] = 81] = "If"; + NodeType[NodeType["While"] = 82] = "While"; + NodeType[NodeType["DoWhile"] = 83] = "DoWhile"; + NodeType[NodeType["Block"] = 84] = "Block"; + NodeType[NodeType["Case"] = 85] = "Case"; + NodeType[NodeType["Switch"] = 86] = "Switch"; + NodeType[NodeType["Try"] = 87] = "Try"; + NodeType[NodeType["TryCatch"] = 88] = "TryCatch"; + NodeType[NodeType["TryFinally"] = 89] = "TryFinally"; + NodeType[NodeType["Finally"] = 90] = "Finally"; + NodeType[NodeType["Catch"] = 91] = "Catch"; + NodeType[NodeType["List"] = 92] = "List"; + NodeType[NodeType["Script"] = 93] = "Script"; + NodeType[NodeType["ClassDeclaration"] = 94] = "ClassDeclaration"; + NodeType[NodeType["InterfaceDeclaration"] = 95] = "InterfaceDeclaration"; + NodeType[NodeType["ModuleDeclaration"] = 96] = "ModuleDeclaration"; + NodeType[NodeType["ImportDeclaration"] = 97] = "ImportDeclaration"; + NodeType[NodeType["With"] = 98] = "With"; + NodeType[NodeType["Label"] = 99] = "Label"; + NodeType[NodeType["LabeledStatement"] = 100] = "LabeledStatement"; + NodeType[NodeType["EBStart"] = 101] = "EBStart"; + NodeType[NodeType["GotoEB"] = 102] = "GotoEB"; + NodeType[NodeType["EndCode"] = 103] = "EndCode"; + NodeType[NodeType["Error"] = 104] = "Error"; + NodeType[NodeType["Comment"] = 105] = "Comment"; + NodeType[NodeType["Debugger"] = 106] = "Debugger"; + NodeType[NodeType["GeneralNode"] = NodeType.FuncDecl] = "GeneralNode"; + NodeType[NodeType["LastAsg"] = NodeType.AsgRs2] = "LastAsg"; + })(TypeScript.NodeType || (TypeScript.NodeType = {})); + var NodeType = TypeScript.NodeType; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource4.js b/tests/baselines/reference/parserRealSource4.js new file mode 100644 index 00000000000..1d6ed0aaf13 --- /dev/null +++ b/tests/baselines/reference/parserRealSource4.js @@ -0,0 +1,568 @@ +//// [parserRealSource4.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + + export class BlockIntrinsics { + public prototype = undefined; + public toString = undefined; + public toLocaleString = undefined; + public valueOf = undefined; + public hasOwnProperty = undefined; + public propertyIsEnumerable = undefined; + public isPrototypeOf = undefined; + + constructor () { + // initialize the 'constructor' field + this["constructor"] = undefined; + } + } + + export interface IHashTable { + getAllKeys(): string[]; + add(key: string, data): boolean; + addOrUpdate(key: string, data): boolean; + map(fn: (k: string, v, c) => void , context): void; + every(fn: (k: string, v, c) => boolean, context): boolean; + some(fn: (k: string, v, c) => boolean, context): boolean; + count(): number; + lookup(key: string): any; + } + + export class StringHashTable implements IHashTable { + public itemCount = 0; + public table = ( new BlockIntrinsics()); + + public getAllKeys(): string[]{ + var result: string[] = []; + for (var k in this.table) { + if (this.table[k] != undefined) { + result[result.length] = k; + } + } + return result; + } + + public add(key: string, data): boolean { + if (this.table[key] != undefined) { + return false; + } + this.table[key] = data; + this.itemCount++; + return true; + } + + public addOrUpdate(key: string, data): boolean { + if (this.table[key] != undefined) { + this.table[key] = data; + return false; + } + this.table[key] = data; + this.itemCount++; + return true; + } + + public map(fn: (k: string, v, c) => void , context) { + for (var k in this.table) { + var data = this.table[k]; + if (data != undefined) { + fn(k, this.table[k], context); + } + } + } + + public every(fn: (k: string, v, c) => boolean, context) { + for (var k in this.table) { + var data = this.table[k]; + if (data != undefined) { + if (!fn(k, this.table[k], context)) { + return false; + } + } + } + return true; + } + + public some(fn: (k: string, v, c) => boolean, context) { + for (var k in this.table) { + var data = this.table[k]; + if (data != undefined) { + if (fn(k, this.table[k], context)) { + return true; + } + } + } + return false; + } + + public count(): number { return this.itemCount; } + + public lookup(key: string) { + var data = this.table[key]; + if (data != undefined) { + return data; + } + else { + return (null); + } + } + } + + // The resident table is expected to reference the same table object, whereas the + // transientTable may reference different objects over time + // REVIEW: WARNING: For performance reasons, neither the primary nor secondary table may be null + export class DualStringHashTable implements IHashTable { + + public insertPrimary = true; + + constructor (public primaryTable: IHashTable, + public secondaryTable: IHashTable) { } + + public getAllKeys(): string[]{ + return this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys()); + } + + public add(key: string, data): boolean { + if (this.insertPrimary) { + return this.primaryTable.add(key, data); + } + else { + return this.secondaryTable.add(key, data); + } + } + + public addOrUpdate(key: string, data): boolean { + if (this.insertPrimary) { + return this.primaryTable.addOrUpdate(key, data); + } + else { + return this.secondaryTable.addOrUpdate(key, data); + } + } + + public map(fn: (k: string, v, c) => void , context) { + this.primaryTable.map(fn, context); + this.secondaryTable.map(fn, context); + } + + public every(fn: (k: string, v, c) => boolean, context) { + return this.primaryTable.every(fn, context) && this.secondaryTable.every(fn, context); + } + + public some(fn: (k: string, v, c) => boolean, context) { + return this.primaryTable.some(fn, context) || this.secondaryTable.some(fn, context); + } + + public count() { + return this.primaryTable.count() + this.secondaryTable.count(); + } + + public lookup(key: string) { + var data = this.primaryTable.lookup(key); + if (data != undefined) { + return data; + } + else { + return this.secondaryTable.lookup(key); + } + } + } + + export function numberHashFn(key: number): number { + var c2 = 0x27d4eb2d; // a prime or an odd constant + key = (key ^ 61) ^ (key >>> 16); + key = key + (key << 3); + key = key ^ (key >>> 4); + key = key * c2; + key = key ^ (key >>> 15); + return key; + } + + export function combineHashes(key1: number, key2: number) { + return key2 ^ ((key1 >> 5) + key1); + } + + export class HashEntry { + public next: HashEntry; + + constructor (public key, public data) { } + } + + export class HashTable { + public itemCount: number = 0; + public table = new HashEntry[]; + + constructor (public size: number, public hashFn: (key) =>number, + public equalsFn: (key1, key2) =>boolean) { + for (var i: number = 0; i < this.size; i++) { + this.table[i] = null; + } + } + + public add(key, data): boolean { + var current: HashEntry; + var entry: HashEntry = new HashEntry(key, data); + var val: number = this.hashFn(key); + val = val % this.size; + + for (current = this.table[val]; current != null ; current = current.next) { + if (this.equalsFn(key, current.key)) { + return false; + } + } + entry.next = this.table[val]; + this.table[val] = entry; + this.itemCount++; + return true; + } + + public remove(key) { + var current: HashEntry; + var val: number = this.hashFn(key); + val = val % this.size; + var result = null; + var prevEntry: HashEntry = null; + + for (current = this.table[val]; current != null ; current = current.next) { + if (this.equalsFn(key, current.key)) { + result = current.data; + this.itemCount--; + if (prevEntry) { + prevEntry.next = current.next; + } + else { + this.table[val] = current.next; + } + break; + } + prevEntry = current; + } + return result; + } + + public count(): number { return this.itemCount; } + + public lookup(key) { + var current: HashEntry; + var val: number = this.hashFn(key); + val = val % this.size; + for (current = this.table[val]; current != null ; current = current.next) { + if (this.equalsFn(key, current.key)) { + return (current.data); + } + } + return (null); + } + } + + // Simple Hash table with list of keys and values matching each other at the given index + export class SimpleHashTable { + private keys = []; + private values = []; + + public lookup(key, findValue?: boolean) { + var searchArray = this.keys; + if (findValue) { + searchArray = this.values; + } + + for (var i = 0; i < searchArray.length; i++) { + if (searchArray[i] == key) { + return { + key: this.keys[i], + data: this.values[i], + }; + } + } + return null; + } + + public add(key, data): boolean { + var lookupData = this.lookup(key); + if (lookupData) { + return false; + } + + this.keys[this.keys.length] = key; + this.values[this.values.length] = data; + + return true; + } + } + +} + +//// [parserRealSource4.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + var BlockIntrinsics = (function () { + function BlockIntrinsics() { + this.prototype = undefined; + this.toString = undefined; + this.toLocaleString = undefined; + this.valueOf = undefined; + this.hasOwnProperty = undefined; + this.propertyIsEnumerable = undefined; + this.isPrototypeOf = undefined; + // initialize the 'constructor' field + this["constructor"] = undefined; + } + return BlockIntrinsics; + })(); + TypeScript.BlockIntrinsics = BlockIntrinsics; + var StringHashTable = (function () { + function StringHashTable() { + this.itemCount = 0; + this.table = (new BlockIntrinsics()); + } + StringHashTable.prototype.getAllKeys = function () { + var result = []; + for (var k in this.table) { + if (this.table[k] != undefined) { + result[result.length] = k; + } + } + return result; + }; + StringHashTable.prototype.add = function (key, data) { + if (this.table[key] != undefined) { + return false; + } + this.table[key] = data; + this.itemCount++; + return true; + }; + StringHashTable.prototype.addOrUpdate = function (key, data) { + if (this.table[key] != undefined) { + this.table[key] = data; + return false; + } + this.table[key] = data; + this.itemCount++; + return true; + }; + StringHashTable.prototype.map = function (fn, context) { + for (var k in this.table) { + var data = this.table[k]; + if (data != undefined) { + fn(k, this.table[k], context); + } + } + }; + StringHashTable.prototype.every = function (fn, context) { + for (var k in this.table) { + var data = this.table[k]; + if (data != undefined) { + if (!fn(k, this.table[k], context)) { + return false; + } + } + } + return true; + }; + StringHashTable.prototype.some = function (fn, context) { + for (var k in this.table) { + var data = this.table[k]; + if (data != undefined) { + if (fn(k, this.table[k], context)) { + return true; + } + } + } + return false; + }; + StringHashTable.prototype.count = function () { + return this.itemCount; + }; + StringHashTable.prototype.lookup = function (key) { + var data = this.table[key]; + if (data != undefined) { + return data; + } + else { + return (null); + } + }; + return StringHashTable; + })(); + TypeScript.StringHashTable = StringHashTable; + // The resident table is expected to reference the same table object, whereas the + // transientTable may reference different objects over time + // REVIEW: WARNING: For performance reasons, neither the primary nor secondary table may be null + var DualStringHashTable = (function () { + function DualStringHashTable(primaryTable, secondaryTable) { + this.primaryTable = primaryTable; + this.secondaryTable = secondaryTable; + this.insertPrimary = true; + } + DualStringHashTable.prototype.getAllKeys = function () { + return this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys()); + }; + DualStringHashTable.prototype.add = function (key, data) { + if (this.insertPrimary) { + return this.primaryTable.add(key, data); + } + else { + return this.secondaryTable.add(key, data); + } + }; + DualStringHashTable.prototype.addOrUpdate = function (key, data) { + if (this.insertPrimary) { + return this.primaryTable.addOrUpdate(key, data); + } + else { + return this.secondaryTable.addOrUpdate(key, data); + } + }; + DualStringHashTable.prototype.map = function (fn, context) { + this.primaryTable.map(fn, context); + this.secondaryTable.map(fn, context); + }; + DualStringHashTable.prototype.every = function (fn, context) { + return this.primaryTable.every(fn, context) && this.secondaryTable.every(fn, context); + }; + DualStringHashTable.prototype.some = function (fn, context) { + return this.primaryTable.some(fn, context) || this.secondaryTable.some(fn, context); + }; + DualStringHashTable.prototype.count = function () { + return this.primaryTable.count() + this.secondaryTable.count(); + }; + DualStringHashTable.prototype.lookup = function (key) { + var data = this.primaryTable.lookup(key); + if (data != undefined) { + return data; + } + else { + return this.secondaryTable.lookup(key); + } + }; + return DualStringHashTable; + })(); + TypeScript.DualStringHashTable = DualStringHashTable; + function numberHashFn(key) { + var c2 = 0x27d4eb2d; // a prime or an odd constant + key = (key ^ 61) ^ (key >>> 16); + key = key + (key << 3); + key = key ^ (key >>> 4); + key = key * c2; + key = key ^ (key >>> 15); + return key; + } + TypeScript.numberHashFn = numberHashFn; + function combineHashes(key1, key2) { + return key2 ^ ((key1 >> 5) + key1); + } + TypeScript.combineHashes = combineHashes; + var HashEntry = (function () { + function HashEntry(key, data) { + this.key = key; + this.data = data; + } + return HashEntry; + })(); + TypeScript.HashEntry = HashEntry; + var HashTable = (function () { + function HashTable(size, hashFn, equalsFn) { + this.size = size; + this.hashFn = hashFn; + this.equalsFn = equalsFn; + this.itemCount = 0; + this.table = new HashEntry[]; + for (var i = 0; i < this.size; i++) { + this.table[i] = null; + } + } + HashTable.prototype.add = function (key, data) { + var current; + var entry = new HashEntry(key, data); + var val = this.hashFn(key); + val = val % this.size; + for (current = this.table[val]; current != null; current = current.next) { + if (this.equalsFn(key, current.key)) { + return false; + } + } + entry.next = this.table[val]; + this.table[val] = entry; + this.itemCount++; + return true; + }; + HashTable.prototype.remove = function (key) { + var current; + var val = this.hashFn(key); + val = val % this.size; + var result = null; + var prevEntry = null; + for (current = this.table[val]; current != null; current = current.next) { + if (this.equalsFn(key, current.key)) { + result = current.data; + this.itemCount--; + if (prevEntry) { + prevEntry.next = current.next; + } + else { + this.table[val] = current.next; + } + break; + } + prevEntry = current; + } + return result; + }; + HashTable.prototype.count = function () { + return this.itemCount; + }; + HashTable.prototype.lookup = function (key) { + var current; + var val = this.hashFn(key); + val = val % this.size; + for (current = this.table[val]; current != null; current = current.next) { + if (this.equalsFn(key, current.key)) { + return (current.data); + } + } + return (null); + }; + return HashTable; + })(); + TypeScript.HashTable = HashTable; + // Simple Hash table with list of keys and values matching each other at the given index + var SimpleHashTable = (function () { + function SimpleHashTable() { + this.keys = []; + this.values = []; + } + SimpleHashTable.prototype.lookup = function (key, findValue) { + var searchArray = this.keys; + if (findValue) { + searchArray = this.values; + } + for (var i = 0; i < searchArray.length; i++) { + if (searchArray[i] == key) { + return { + key: this.keys[i], + data: this.values[i] + }; + } + } + return null; + }; + SimpleHashTable.prototype.add = function (key, data) { + var lookupData = this.lookup(key); + if (lookupData) { + return false; + } + this.keys[this.keys.length] = key; + this.values[this.values.length] = data; + return true; + }; + return SimpleHashTable; + })(); + TypeScript.SimpleHashTable = SimpleHashTable; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource5.js b/tests/baselines/reference/parserRealSource5.js new file mode 100644 index 00000000000..9c64899fab7 --- /dev/null +++ b/tests/baselines/reference/parserRealSource5.js @@ -0,0 +1,129 @@ +//// [parserRealSource5.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + // TODO: refactor indent logic for use in emit + export class PrintContext { + public builder = ""; + public indent1 = " "; + public indentStrings: string[] = []; + public indentAmt = 0; + + constructor (public outfile: ITextWriter, public parser: Parser) { + } + + public increaseIndent() { + this.indentAmt++; + } + + public decreaseIndent() { + this.indentAmt--; + } + + public startLine() { + if (this.builder.length > 0) { + CompilerDiagnostics.Alert(this.builder); + } + var indentString = this.indentStrings[this.indentAmt]; + if (indentString === undefined) { + indentString = ""; + for (var i = 0; i < this.indentAmt; i++) { + indentString += this.indent1; + } + this.indentStrings[this.indentAmt] = indentString; + } + this.builder += indentString; + } + + public write(s) { + this.builder += s; + } + + public writeLine(s) { + this.builder += s; + this.outfile.WriteLine(this.builder); + this.builder = ""; + } + + } + + export function prePrintAST(ast: AST, parent: AST, walker: IAstWalker) { + var pc: PrintContext = walker.state; + + ast.print(pc); + pc.increaseIndent(); + return ast; + } + + + export function postPrintAST(ast: AST, parent: AST, walker: IAstWalker) { + var pc: PrintContext = walker.state; + pc.decreaseIndent(); + return ast; + } +} + +//// [parserRealSource5.js] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. +/// +var TypeScript; +(function (TypeScript) { + // TODO: refactor indent logic for use in emit + var PrintContext = (function () { + function PrintContext(outfile, parser) { + this.outfile = outfile; + this.parser = parser; + this.builder = ""; + this.indent1 = " "; + this.indentStrings = []; + this.indentAmt = 0; + } + PrintContext.prototype.increaseIndent = function () { + this.indentAmt++; + }; + PrintContext.prototype.decreaseIndent = function () { + this.indentAmt--; + }; + PrintContext.prototype.startLine = function () { + if (this.builder.length > 0) { + CompilerDiagnostics.Alert(this.builder); + } + var indentString = this.indentStrings[this.indentAmt]; + if (indentString === undefined) { + indentString = ""; + for (var i = 0; i < this.indentAmt; i++) { + indentString += this.indent1; + } + this.indentStrings[this.indentAmt] = indentString; + } + this.builder += indentString; + }; + PrintContext.prototype.write = function (s) { + this.builder += s; + }; + PrintContext.prototype.writeLine = function (s) { + this.builder += s; + this.outfile.WriteLine(this.builder); + this.builder = ""; + }; + return PrintContext; + })(); + TypeScript.PrintContext = PrintContext; + function prePrintAST(ast, parent, walker) { + var pc = walker.state; + ast.print(pc); + pc.increaseIndent(); + return ast; + } + TypeScript.prePrintAST = prePrintAST; + function postPrintAST(ast, parent, walker) { + var pc = walker.state; + pc.decreaseIndent(); + return ast; + } + TypeScript.postPrintAST = postPrintAST; +})(TypeScript || (TypeScript = {})); diff --git a/tests/baselines/reference/parserRealSource6.js b/tests/baselines/reference/parserRealSource6.js new file mode 100644 index 00000000000..e747b95e610 --- /dev/null +++ b/tests/baselines/reference/parserRealSource6.js @@ -0,0 +1,422 @@ +//// [parserRealSource6.ts] +// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. +// See LICENSE.txt in the project root for complete license information. + +/// + +module TypeScript { + export class TypeCollectionContext { + public script: Script = null; + + constructor (public scopeChain: ScopeChain, public checker: TypeChecker) { + } + } + + export class MemberScopeContext { + public type: Type = null; + public ast: AST = null; + public scope: SymbolScope; + public options = new AstWalkOptions(); + + constructor (public flow: TypeFlow, public pos: number, public matchFlag: ASTFlags) { + } + } + + export class EnclosingScopeContext { + + public scopeGetter: () => SymbolScope = null; + public objectLiteralScopeGetter: () => SymbolScope = null; + public scopeStartAST: AST = null; + public skipNextFuncDeclForClass = false; + public deepestModuleDecl: ModuleDeclaration = null; + public enclosingClassDecl: TypeDeclaration = null; + public enclosingObjectLit: UnaryExpression = null; + public publicsOnly = true; + public useFullAst = false; + private scriptFragment: Script; + + constructor (public logger: ILogger, + public script: Script, + public text: ISourceText, + public pos: number, + public isMemberCompletion: boolean) { + } + + public getScope(): SymbolScope { + return this.scopeGetter(); + } + + public getObjectLiteralScope(): SymbolScope { + return this.objectLiteralScopeGetter(); + } + + public getScopeAST() { + return this.scopeStartAST; + } + + public getScopePosition() { + return this.scopeStartAST.minChar; + } + + public getScriptFragmentStartAST(): AST { + return this.scopeStartAST; + } + + public getScriptFragmentPosition(): number { + return this.getScriptFragmentStartAST().minChar; + } + + public getScriptFragment(): Script { + if (this.scriptFragment == null) { + var ast = this.getScriptFragmentStartAST(); + var minChar = ast.minChar; + var limChar = (this.isMemberCompletion ? this.pos : this.pos + 1); + this.scriptFragment = TypeScript.quickParse(this.logger, ast, this.text, minChar, limChar, null/*errorCapture*/).Script; + } + return this.scriptFragment; + } + } + + export function preFindMemberScope(ast: AST, parent: AST, walker: IAstWalker) { + var memScope: MemberScopeContext = walker.state; + if (hasFlag(ast.flags, memScope.matchFlag) && ((memScope.pos < 0) || (memScope.pos == ast.limChar))) { + memScope.ast = ast; + if ((ast.type == null) && (memScope.pos >= 0)) { + memScope.flow.inScopeTypeCheck(ast, memScope.scope); + } + memScope.type = ast.type; + memScope.options.stopWalk(); + } + return ast; + } + + export function pushTypeCollectionScope(container: Symbol, + valueMembers: ScopedMembers, + ambientValueMembers: ScopedMembers, + enclosedTypes: ScopedMembers, + ambientEnclosedTypes: ScopedMembers, + context: TypeCollectionContext, + thisType: Type, + classType: Type, + moduleDecl: ModuleDeclaration) { + var builder = new SymbolScopeBuilder(valueMembers, ambientValueMembers, enclosedTypes, ambientEnclosedTypes, null, container); + var chain: ScopeChain = new ScopeChain(container, context.scopeChain, builder); + chain.thisType = thisType; + chain.classType = classType; + chain.moduleDecl = moduleDecl; + context.scopeChain = chain; + } + + export function popTypeCollectionScope(context: TypeCollectionContext) { + context.scopeChain = context.scopeChain.previous; + } + + export function preFindEnclosingScope(ast: AST, parent: AST, walker: IAstWalker) { + var context: EnclosingScopeContext = walker.state; + var minChar = ast.minChar; + var limChar = ast.limChar; + + // Account for the fact completion list may be called at the end of a file which + // is has not been fully re-parsed yet. + if (ast.nodeType == NodeType.Script && context.pos > limChar) + limChar = context.pos; + + if ((minChar <= context.pos) && + (limChar >= context.pos)) { + switch (ast.nodeType) { + case NodeType.Script: + var script =